Skip to Content.
Sympa Menu

freetds - [freetds] FreeTDS returned data lenght????

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "David Nsengiyumva" <davidn AT finsolutions.co.za>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] FreeTDS returned data lenght????
  • Date: Wed, 15 Oct 2003 13:08:55 +0200

Hi Everybody,

Does anyone know how FreeTDS knows the lenght of the returned data; not the
size of the result set, but the individual data in each field of every
particular row in the result set????

For what I see, in the ct-lib layer, the " ct_describe " function sets the
members of the CS_DATAFMT parameter (datafmt) using the TDSCOLINFO (curcol)
structure ("column_size" field of the structure). But what I don't
understand is that when I run a Query that's supposed to return strings
whose lenght is more than 45 it works but when the fields of the returned
values include Date/Time data then it fails.

Basically what happens is that in the " cs_convert " function (ct.c file)
the swicth statement where it checks for " desttype " (switch (desttype)),
it goes to SYBTEXT case and since " len " is greater than " destlen " then
it throws an exception....

I've debugged it and found that "len" is the returned value of the "
tds_convert " function which also just returns whatever is returned by
different " tds_convert_????? " functions (tds_convert_datetime,
tds_convert_binary, tds_convert_real, etc). In my case it's "
tds_convert_datetime " function and the returned value is 22.

And "destlen" is just the "maxlength" field of the "CS_DATAFMT" structure
that is obtained from the TDSCOLINFO structure. In my case it has value 8. I
really don't anderstand where it gets that value!!!

Anyway I obtain the len > destlen so the " cs_convert " (cs.c file) throws a
"Data-conversion resulted in overflow" exception...

Can you assist please....

David Nsengiyumva

Software Developer
Tel: +27 21 464 7215
Cel: +27 73 351 3975
http://www.finsolutions.co.za

CONFIDENTIALITY CAUTION
This page and any accompanying documents contain privileged and confidential
information for the specific individual to whom it is addressed, and are
protected by law. If the reader is not the intended recipient, you are
hereby notified that any review, dissemination, distribution or copying or
the taking of any action based on the contents of this communication is
strictly prohibited. If you have received this communication in error,
please desist from reading the contents, notify us immediately and destroy
the communication.







Archive powered by MHonArc 2.6.24.

Top of Page