Skip to Content.
Sympa Menu

freetds - RE: [freetds] Need Help on dblib program

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] Need Help on dblib program
  • Date: Thu, 31 Jul 2003 17:43:25 -0400

> From: Steven J. Backus [mailto:backus AT math.utah.edu]
> Sent: July 31, 2003 5:08 PM
>
> > What does your log show? Does it stop just before the
> "family" conversion?
>
> The last few lines from the log are:
>
> 15:01:26.158004 dbconvert() srctype = 39 desttype = 47
> 15:01:26.269232 dbconvert() calling tds_convert
> 15:01:26.378415 dbconvert() called tds_convert returned 4
> 15:01:26.491374 dbconvert() outputting 4 bytes character data
> destlen = -2

Well, then we know things went awry before that. We have to look at
tds_convert's input (see my last message) but I'll bet 10:1 it's corrupted.
Why is it four bytes?

A little before the I5 conversion is the dage conversion. Your table has
that as datatype float, 8 bytes, and you're binding it to a C float, 4
bytes. Does anything change if you redefine the age column as datatype
"real" instead?

> Then I do "c" again, another watch point appears:
>
> Old value = 84 'T'
> New value = 0 '\000'
> dbconvert (dbproc=0x807b910, srctype=39, src=0x807d214
> "I64TY", srclen=3, desttype=47,
> dest=0x804763c "I64", destlen=-2) at dblib.c:1907
> 1907 ret = len;
> (gdb) bt
> #0 dbconvert (dbproc=0x807b910, srctype=39, src=0x807d214
> "I64TY", srclen=3, desttype=47,
> dest=0x804763c "I64", destlen=-2) at dblib.c:1907
> #1 0x804a471 in buffer_transfer_bound_data (rowtype=-1,
> compute_id=0, buf=0x807b914,
> dbproc=0x807b910, row_num=2) at dblib.c:449

Oh, boy. We're supposed to believe that assigning "len" to "ret" changes
the value of your bound variable. I'll choose to believe that's not true,
that it's actually the statement prior:

dest[len] = 0;

that's doing the job, as expected. The real question is: what happened to
cause tds_convert() to return 4 when its varchar input was "I64" and srclen
was 3?

> And yet again:
>
> Hardware watchpoint 2: *(DBCHAR *) 134510143
>
> Old value = 0 '\000'
> New value = -33 'ß'
> (gdb) bt
> #0 0xdfae22bf in ?? ()
> #1 0xdfad3339 in ?? ()

This is expected. You're exiting the program. Memory's being freed and
reused on the way out.

The next step is to try changing the age to type real. That will avoid the
8->4 byte conversion, and I think the problem will go away. If not, log the
inputs to dbconvert and tds_convert.

My guess is we're doing something silly with dage, but I don't see what it
is yet.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.






Archive powered by MHonArc 2.6.24.

Top of Page