[freetds] [ freetds-Patches-731907 ] Choosingdatalengthwhenbinding fixed types

Arnar Birgisson arnarb at oddi.is
Mon May 5 07:19:07 EDT 2003


Hi there..

According to mssql 7.0 and 8.0 documentation, their varchar supports up
to 4K bytes. I don't know about Sybase.

Here's the TDSDUMP log generated when I ran a php page that didn't do
anything but call the stored procedure. It starts at line 139
(dbrpcinit). This should go through as the log is little over 12kb. The
recieved packet is at line 182.

Arnar

> -----Original Message-----
> From: freetds-bounces at lists.ibiblio.org 
> [mailto:freetds-bounces at lists.ibiblio.org] On Behalf Of 
> ZIGLIO Frediano
> Sent: 5. maí 2003 10:45
> To: FreeTDS Development Group
> Subject: RE: [freetds] [ freetds-Patches-731907 ] 
> Choosingdatalengthwhenbinding fixed types
> 
> 
> > On Sun, 4 May 2003 20:05:16 -0000, "Arnar Birgisson" 
> <arnarb at oddi.is>
> > wrote:
> > >   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?
> > 
> > Arnar, 
> > 
> > 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.  
> > 
> > Hälsingar, 
> > 
> 
> I think we try to pass a varchar(400) instead a xvarchar(400) 
> (varchar support maximun 255 characters)...
> 
> Parameters are not tested deeply before passing it...
> 
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freetds.log
Type: application/octet-stream
Size: 12037 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20030505/96ea3727/attachment.obj 


More information about the FreeTDS mailing list