Skip to Content.
Sympa Menu

freetds - Re: large queries and TDS 7.0 revisited

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: large queries and TDS 7.0 revisited
  • Date: 22 Oct 2000 23:16:23 -0600


Brian Bruns <camber AT ais.org> writes:

> Query times are a combination of size of result set (columns and rows) and
> the usefulness of indexes and the query optimizers ability to generate a
> decent query plan. You may want to run it with showplan and noexec to see
> if your query plan is any good. The size of the query text in the process
> should be negligible and more importantly has nothing to do with the
> client (ours or microsofts). Of course there could be a bug, but I find
> it hard to envision anything the small query/large query code differences
> could be doing to cause it.
>
> On to the meat of your post. There should only be one reference to '512'
> left in write.c (And I just checked in the fix for that...) If you are
> seeing more, then the snapshot is not picking up the right stuff.
>
> Why not send me the text of the query offlist and I'll run it through
> under TDS 4.2 with the latest code to see what's up.
>


Brian,

The problem for large queries taking a while to send is your
tds7_ascii2unicode() function in login.c. In the body of your for
loop you are continually calling strlen() which computes the length of
the string each time the loop is executed. You really only need to
compute the length of the string once, also you can make the length a
constant so the function is even faster. Here are my fixes:

char *tds7_ascii2unicode(const char *in_string, char *out_string, int maxlen)
{
register int out_pos = 0;
const size_t string_length = strlen(in_string);
register int i;

memset(out_string, 0, string_length*2);
for (i=0; i<string_length; i++) {
out_string[out_pos]=in_string[i];
out_pos += 2;
}
return out_string;
}

Cheers,

Rusty
--
Rusty Conover
Systems Programmer
Zoot Enterprises Inc, www.zootweb.com




Archive powered by MHonArc 2.6.24.

Top of Page