tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

Issue with 64-bit Linux #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
On my 64-bit Kubuntu Linux box I enyounter the following problem:

Decimal-values with NULL-value produce an exception when reading. This
happens because in src/getdata.cpp, function GetDataDecimal, the variable
cbFetched is of type SQLLEN which is 64 bits long. The return value -1 for
a NULL value is a 32 bit number, so it is not -1 in 64 bits and the
function tries to convert the empty string '' to a decimal which raises an
exception.

Possible solution to the problem: cbFetched must be of a 32-bit type,
regardless of the systems bit size. I am sorry, but I don't know, which
type could be the right one for this.

Regards, Axel

Original issue reported on code.google.com by axel.b.k...@googlemail.com on 8 Jan 2009 at 7:45

GoogleCodeExporter commented 8 years ago
I'm at a loss here: cbFetched really needs to be a SQLLEN -- we're passing a 
pointer
to a 8-bytes of memory (SQLLEN*) so it would be bad if the memory only 
contained 4-bytes.

I assume you are using unixODBC?  It allows you to set SIZEOF_LONG, so if the 
driver
and the driver-manager were compiled with different values, you might see this
behavior.  (Incidentally, what kind of whacked out option is that, changing the 
size
of long? ;)

What version of unixODBC are you using?  I'll look through their header files 
and see
what we can do.

Original comment by mkleehammer on 18 Mar 2009 at 5:40

GoogleCodeExporter commented 8 years ago
I am using unixODBC 2.2.11-16build2  on Kubuntu 8.10.

Regards, Axel

Original comment by axel.b.k...@googlemail.com on 21 Mar 2009 at 8:10

GoogleCodeExporter commented 8 years ago
Can you try this with 2.1.8?

Thanks.

Original comment by mkleehammer on 6 Sep 2010 at 6:05

GoogleCodeExporter commented 8 years ago
Closing due to inactivity.  I think these issues are cleared up in 2.1.8+

Original comment by mkleehammer on 21 Nov 2010 at 6:39

GoogleCodeExporter commented 8 years ago
This issue is still happening for me; I'm using unixODBC-2.2.11 and latest 
version of pyodbc. Code to recreate attached; server is running CentOS 5.9.

Original comment by jordanth...@gmail.com on 31 Mar 2014 at 10:12

Attachments:

GoogleCodeExporter commented 8 years ago
Just updated unixODBC to latest version; error still occurs.

Original comment by jordanth...@gmail.com on 1 Apr 2014 at 7:47