| Issue 194: | ppc64 failures inserting and querying values | |
| 1 person starred this issue and may be notified of changes. | Back to list |
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
Status:
Hold
Dec 22, 2011
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. |