Skip to content

When the column is a bigint, and the client is a 64-bit python, 1*10^12 gets truncated and is negative #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GoogleCodeExporter opened this issue Mar 18, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. a = 1000000000000
2. c.execute("insert into bigint_tbl values (?)", a)
3. db.commit()
4. select * from bigint_tbl

What is the expected output? What do you see instead?
Expected output is:
  1000000000000
Actual output
  -727379968L

What version of the product are you using? On what operating system?
2.1.7, 2.1.8 Solaris 10 x86 (so far)



Please provide any additional information below.

Python 2.6.5 (r265:79063, Nov 23 2010, 04:04:44)
[GCC 4.3.3] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxint
9223372036854775807

374:1> select @@VERSION
374:2> go





        ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

        Microsoft SQL Server 2008 R2 (RTM) - 10.50.1720.0 (X64)
        Jun 12 2010 01:34:59
        Copyright (c) Microsoft Corporation
        Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7600: )


(1 row affected)

Unsurprisingly, the answer is to use 1000000000000L, but it seems that when the 
native int is 4 bits, this is unnecessary.

Original issue reported on code.google.com by pedri...@gmail.com on 5 Jan 2011 at 9:05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant