Issue 194: ppc64 failures inserting and querying values
Status:  Hold
Owner: ----
Reported by Sanders....@gmail.com, Aug 3, 2011
What steps will reproduce the problem?
1. Create table (mysql)
USE mydb;
DROP TABLE IF EXISTS testtable;
CREATE TABLE testtable (
       rec_id BIGINT NOT NULL AUTO_INCREMENT,
       state TINYINT NOT NULL,
       PRIMARY KEY(rec_id)
);

2. Run program
import pyodbc

cnxn = pyodbc.connect('DRIVER={mysql};DATABASE=mydb;UID=me;PWD=blahblah')
cur = cnxn.cursor()

for x in range(5):
        cur.execute('''INSERT INTO testtable(state) VALUES(?)''',x)

cnxn.commit()

for r in cur.execute('''SELECT rec_id,state FROM testtable'''):
        print r 

What is the expected output? What do you see instead?

Expected:
(1L, 0)
(2L, 1)
(3L, 2)
(4L, 3)
(5L, 4)

Actual:
(1L, 0)
(2L, 0)
(3L, 0)
(4L, 0)
(5L, 0)


What version of the product are you using? On what operating system?

Red Hat Enterprise Linux Server release 6.0 (ppc64)
pyodbc 2.1.9
python 2.6.5


Please provide any additional information below.

I checked with the unixODBC folks and received this information on the SQL C types

"SQL_C_LONG is a 32 bit type, SQL_C_SMALLINT 16 bit and SQL_C_BIGINT 64. This doesnt change on 32/64 bit platforms. The names are a hangover from windows where a long is 32 bit both on 64 and 32 bit builds."

I made a patch which seems to work - testcase runs as well as provided unittest for mysql

diff ./cursor.h /old/src/cursor.h
59c59
<         int32_t l;
---
>         long l;
diff ./getdata.cpp /old/src/getdata.cpp
467c467
<     int32_t value = 0;
---
>     long value = 0;

Dec 18, 2011
Project Member #1 mkleehammer
I believe this is fixed in 3.0.x.  Can you test with a recent build?  I don't have a PPC box availble, but the 64-bit Linux (unixODBC), Windows (MS ODBC), and OS/X (iODBC) builds are working.

Marking as Hold until I hear back.  Thanks.

Status: Hold
Dec 22, 2011
#2 Sanders....@gmail.com
I pulled the lasted git build (12/22/2011) and built for ppc64 (created/installed RPM pyodbc-3.0.2_beta02-1.ppc64)

Problem appears to be fixed.