google-code-export / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Pymssql mishandles bigint indexes greater than 24 bits. #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create table "test_index" with one bigint column "id"
2. Execute SQL: insert into test_index (id) values (123456789)
3. Execute this python program:

import _mssql
conn = _mssql.connect(server=DB_Server, user=DB_user, password=DB_password, 
database=Database)
id = 123456789
print 'Selecting id = ', id
conn.execute_query('SELECT * FROM test_index WHERE id = %s', id)
for row in conn:
    print "ID=%s\n" % row['id']

What is the expected output?

LogSrv1$ ./try.py
Selecting id =  123456789
ID=123456789.0

What do you see instead?

LogSrv1$ ./try.py
Selecting id =  123456789
ID=123456792.0

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

/Python26/lib/site-packages/pymssql-1.9.905.1-py2.6.egg-info/
Microsoft Windows Server 2003 R2

Please provide any additional information below.

Thank you for looking at this and/or suggesting a workaround!

Original issue reported on code.google.com by eric.wou...@gmail.com on 8 Jun 2010 at 4:39

GoogleCodeExporter commented 9 years ago
Also tried with: /Python26/lib/site-packages/pymssql-1.9.908-py2.6.egg-info/ 
and got the same results.

Original comment by eric.wou...@gmail.com on 8 Jun 2010 at 4:55

GoogleCodeExporter commented 9 years ago
A colleague followed up and reported:

This is working for me on Python 2.4 pymssql-1.0.1:

import pymssql
conn = pymssql.connect(host='192.168.47.25', user='sa', password='speech',
database='SpeechCorpus')
a=conn.cursor()
a.execute('select * from test_index')
a.fetchall()

This correctly returns

[(Decimal("123456789"),)]

Original comment by eric.wou...@gmail.com on 9 Jun 2010 at 1:28

GoogleCodeExporter commented 9 years ago
Could you please retry your test using the latest version please.

Original comment by dam...@gmail.com on 9 Jun 2010 at 8:15

GoogleCodeExporter commented 9 years ago
This issue occurs only on Windows platforms, when I get the chance I will do 
further investigation.

Original comment by dam...@gmail.com on 23 Jun 2010 at 9:14

GoogleCodeExporter commented 9 years ago
My tests using Windows 7 x32 and the latest code in /trunk this works okay now.

Original comment by dam...@gmail.com on 4 Jan 2011 at 8:24