Skip to Content.
Sympa Menu

freetds - Re: SQL Length limitations on insert

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Rusty Conover <rconover AT zootweb.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: SQL Length limitations on insert
  • Date: Wed, 28 Jun 2000 09:13:27 -0600


FreeTDSers,

Thanks for all of your replies, actually I already fixed the problem. The
problem was that the SQL statement was being buffered in the TCP/IP layer for
send
to the server then the socket was closed()'ed before that data actually got to
the server. Linger on close is the default socket behavior yet this wasn't
always
working correctly since the TDS response would arrive after the socket has
been
closed. So anyways the change to fix this problem is to set the TCP_NODELAY
socket parameter so that anything sent over the socket to the SQL server
automatically dosen't get buffered by TCP/IP andthe data should be sent
immediately.

The change was only this addition of code in src/tds/login.c which comes after
the actual socket connect() call.

old lines:
if (connect(tds->s, (struct sockaddr *) &sin, sizeof(sin)) <0) {
perror("connect");
tds_free_socket(tds);
return NULL;
}

new code:
{
int socket_option = 1;

if(setsockopt(tds->s, IPPROTO_TCP, TCP_NODELAY, (char
*)&socket_option, sizeof(int)) < 0) {
fprintf(stderr, "Error setting nodelay socket
option!\n");
} else {
fprintf(stderr, "Set nodelay option!\n");
}
}

This seems to fix the problem on all cases, so I'd be glad to here if anybody
else has any luck with this fix.

Rusty
--
---------------------------------------------
Rusty Conover | rusty AT zootweb.com
Systems Programmer | 406-586-5050 x242
Zoot Enterprises | http://www.zootweb.com
---------------------------------------------

"Nullum magnum ingenium sine mixtura dementiae fuit." -- Seneca






Archive powered by MHonArc 2.6.24.

Top of Page