[freetds] [ freetds-Patches-731907 ] Choosing datalength whenbinding fixed types

James K. Lowden jklowden at schemamania.org
Mon May 5 06:42:35 EDT 2003

On Sun, 4 May 2003 20:05:16 -0000, "Arnar Birgisson" <arnarb at oddi.is>
>   CREATE procedure sp_save_persistentdata
>   	@data varchar(2048)
>   as
>   -- $Id: sp_save_persistentdata.sql,v 1.1 2003/05/02 22:22:09 arnarb
> Exp $
>   update kerfisnotendur set persistent_data = @data
>   	where username = user
>   go
> and I call it from PHP 4.3.2RC2 linked with FreeTDS 0.61 (with your
> modified patch applied) with this:
>   $var = "some base-64 encoded data";
>   $stm = mssql_init("sp_save_persistentdata", $conn);
>   mssql_bind($stm, "@data", $var, SQLVARCHAR, false, false, 0);
>   mssql_execute($stm,true);
> This works fine as long as the string $var is not longer than about 400
> characters, as soon as it gets larger I start getting "Stored procedure
> execution failed" from PHP. I stepped through mssql_execute in the PHP
> source and it correctly calls dbrpcexec, which returns SUCCESS, and then
> immediately calls dbsqlok which returns FAIL. Stepping throught dbsqlok
> reveals that an "end token" is read from sql server and the call to
> tds_process_end returns a failure code. I didn't go any further than
> that, except for checking the SQL server logs, which for this operation
> contain this:
>   2003-05-04 11:46:37.37 ods      Error: 17805, Severity: 18, State: 3
>   2003-05-04 11:46:37.37 ods      Invalid buffer received from client..
> Any ideas on how to proceed?


I would be interested in seeing the TDSDUMP log for your session.  It
should be possible to see from it what's wrong with what FreeTDS sent to
your server.  

The mailing list restricts attachments to 75 KB.  You can either trim the
log or post it as a patch to source forge.  



More information about the FreeTDS mailing list