[pypy-svn] r74040 - pypy/pysqlite2

arigo at codespeak.net arigo at codespeak.net
Sat Apr 24 18:44:54 CEST 2010


Author: arigo
Date: Sat Apr 24 18:44:53 2010
New Revision: 74040

Modified:
   pypy/pysqlite2/dbapi2.py
Log:
Fix for test/types.py on 64-bits platforms.


Modified: pypy/pysqlite2/dbapi2.py
==============================================================================
--- pypy/pysqlite2/dbapi2.py	(original)
+++ pypy/pysqlite2/dbapi2.py	Sat Apr 24 18:44:53 2010
@@ -682,10 +682,11 @@
 
         if param is None:
             sqlite.sqlite3_bind_null(self.statement, idx)
-        elif type(param) in (bool, int):
-            sqlite.sqlite3_bind_int(self.statement, idx, param)
-        elif type(param) is long:
-            sqlite.sqlite3_bind_int64(self.statement, idx, param)
+        elif type(param) in (bool, int, long):
+            if -2147483648 <= param <= 2147483647:
+                sqlite.sqlite3_bind_int(self.statement, idx, param)
+            else:
+                sqlite.sqlite3_bind_int64(self.statement, idx, param)
         elif type(param) is float:
             sqlite.sqlite3_bind_double(self.statement, idx, param)
         elif isinstance(param, str):



More information about the Pypy-commit mailing list