large queries and TDS 7.0

Brandon M. Reynolds breynolds at comtime.com
Tue Oct 17 12:12:23 EDT 2000


SQL Server 7.0 does in fact use a packet size.  The packet size
is configurable by the server.  I'm not sure if you can change
it on a per session basis or what...  It defaults to 4096.

Anyway to get this to work I think we need to change TDS_MAX_QUERY to 4096
and change from:

int tds_put_byte(TDSSOCKET *tds, unsigned char c)
{
        /* FIX ME -- add packet size support */
        if ((IS_TDS70(tds) && tds->out_pos>=TDS_MAX_QUERY) ||
                (!IS_TDS70(tds) && tds->out_pos>=512)) {
                tds_write_packet(tds,0x0);
                tds_init_write_buf(tds);
        }
        tds->out_buf[tds->out_pos++]=c;
}

to:

int tds_put_byte(TDSSOCKET *tds, unsigned char c)
{
        /* FIX ME -- add packet size support */
        if ((IS_TDS70(tds) && tds->out_pos>=TDS_MAX_QUERY) ||
                (!IS_TDS70(tds) && tds->out_pos>=512)) {
                tds_write_packet(tds,0x0);
                tds_init_write_buf(tds);
        }
        if(tds->out_pos >= tds->out_len) {
                tds->out_buf = realloc(tds->out_buf,tds->out_len+2048);
                tds->out_len += 2048;
        }
        tds->out_buf[tds->out_pos++]=c;
}

also:

out_len needs to be maintained, eg. initialize it in mem.c and update it/use
it in a couple of other places.

Brandon M. Reynolds                    Ph: (330) 644-3059
Systems Engineer                       Fax: (330) 644-8110
Commercial Timesharing Inc.            Email: bmr at comtime.com



More information about the FreeTDS mailing list