Problem with TSQL on 64 bits

From: Brett Viren <bv_at_bnl.gov>
Date: Fri, 14 May 2010 12:40:48 -0400


Hi RootTalk,

I've found a problem with TSQL that apparently has to do with running on 64 bit Linux. This is with ROOT 5.22/00a so maybe it has already been found and fixed. If so, please let me know which version has the fix.

The problem manifests itself with a value 0 being returned as a large number with the MSB garbage and the LSB all 0. The column in question is defined as "int(11)", "NOT NULL" and is a primary key. The database is MySQL 5.0.45.

I'm using a simple test like:

    TSQLServer *db = TSQLServer::Connect("mysql://dybdb1.ihep.ac.cn/testdb","dayabay", "secret");     TSQLStatement *s = db->Statement("select * from CalibPmtSpec where SEQNO = 0 order by SEQNO");

    cerr << "Process: " << s->Process() << endl;
    cerr << "StoreResult: " << s->StoreResult() << endl;
    cerr << "GetNumFields: " << s->GetNumFields() << endl;
    cerr << "GetFieldName(0): " << s->GetFieldName(0) << endl;
    cerr << "NextResultRow: " << s->NextResultRow() << endl;
    cerr << "GetString(0): " << s->GetString(0) << endl;

On 32 Bit Debian 5.0.4 the last line returns

  GetString(0): 0

On 64 bit Sci. Linux 5.3 the last line returns:

  GetString(0): 47871705481216

The correct value is 0 confirmed by doing a query through the mysql command line client.

You'll note this large number is 0x2B8A00000000. So, the bottom 32 bits are correctly 0. Each time I run the test on 64 bits I get a different number but the bottom 4 bytes are always 0.

Thanks,
-Brett.

Received on Fri May 14 2010 - 18:40:55 CEST

This archive was generated by hypermail 2.2.0 : Fri May 14 2010 - 23:50:01 CEST