Skip to Content.
Sympa Menu

freetds - For long queries

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Gregg Jensen" <greggj AT savvis.com>
  • To: freetds
  • Subject: For long queries
  • Date: Tue, 1 Sep 1998 10:20:46


Included below is a patch that will fix a bug with long queries that are
sent to Sybase. If you have a query that bumps the buffer over 256
characters, the query gets trimed and the server interprets it incorrectly
returning the wrong results, not an error (unless where it trimmed it would
cause a syntax error).

I have another patch for dblib that will provide the ability to switch
protocols prior to a database login. I have been using this with sqsh-1.4
and sybperl-2.09.04 for some time. This allows you to have a connection to
both Sybase and MS-SQL in one script. If interested I can send it in.

Gregg Jensen



*** src/tds/token.c Sat Aug 8 07:36:20 1998
--- /usr/pkg/tds/src/tds/token.c Tue Sep 1 09:11:33 1998
***************
*** 349,355 ****
buf = (unsigned char *) malloc(bufsize);
memset(buf,'\0',bufsize);
buf[0]=33; /* this number stays the same even if I change
the query */
! buf[1]=strlen(query)+1; /* length of string + 1 ?! */
memcpy(&buf[6],query,strlen(query));
tds->out_flag=0x0F;
}
--- 349,357 ----
buf = (unsigned char *) malloc(bufsize);
memset(buf,'\0',bufsize);
buf[0]=33; /* this number stays the same even if I change
the query */
! buf[1]=(strlen(query)+1)%256;
! buf[2]=(strlen(query)+1)/256;
!
memcpy(&buf[6],query,strlen(query));
tds->out_flag=0x0F;
}



  • For long queries, Gregg Jensen, 09/01/1998

Archive powered by MHonArc 2.6.24.

Top of Page