TDBC

View Ticket
Login
Ticket Hash: 491a0e30c429a113905f87a9f98112082ead0ac2
Title: tdbc::mysql needs trim function to retrieve integers
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: not_specified Resolution: Unable_To_Reproduce
Last Modified: 2017-12-12 19:42:11
Version Found In: 1.0b17
User Comments:
anonymous added on 2012-12-09 04:56:38:
Attempts to retrieve integers from a table in mysql return what appears to be random gibberish unless the column name of interest is expressed as the argument of a TRIM() function in the SQL query.

Here is the output of "db columns" for a simple straightforward table in a mysql database:

% db columns mytable
a_id {name a_id type integer precision 11 scale 0 nullable 0}

Column a_id contains a small number of rows of three-digit integers.  Try to query one:

% db allrows {SELECT a_id from mytable where a_id=241}
{a_id 3796751089905}

Now enclose column name in a TRIM() function:

% db allrows {SELECT TRIM(a_id) from mytable where a_id=241}
{trim(a_id) 241}

Tcl 8.6b3.

% /usr/bin/mysql --version
/usr/bin/mysql  Ver 14.14 Distrib 5.5.28, for debian-linux-gnu (x86_64) using readline 6.2

kbk added on 2013-01-22 03:42:25:
I note that the constant returned is 0x00000374000000f1.
My guess is that there's a 32- vs 64-bit glitch going on, because 0x000000f1 is
the desired value of '241'. The fact that I haven't seen it fail on a 32-bit
machine would tend to support this hypothesis.

stu (claiming to be Stu) added on 2017-05-26 05:01:07:
With the attached patch that adds a naive test, I cannot reproduce on amd64 or i386.

$ mysql --version
mysql  Ver 15.1 Distrib 10.0.30-MariaDB, for OpenBSD (i386) using readline 4.3

$ mysql --version
mysql  Ver 15.1 Distrib 10.0.30-MariaDB, for OpenBSD (amd64) using readline 4.3

$ echo 'puts [info patchlevel]' | tclsh8.6
8.6.6

kbk added on 2017-12-12 19:42:11:
I, too, am unable to reproduce the symptoms described. I'm presuming that some other fix in the beta cycle resolved the problem.

Attachments: