[pypy-svn] r80282 - pypy/pysqlite2

antocuni at codespeak.net antocuni at codespeak.net
Fri Feb 4 13:42:25 CET 2011


Author: antocuni
Date: Fri Feb  4 13:42:23 2011
New Revision: 80282

Modified:
   pypy/pysqlite2/dbapi2.py
Log:
revert 96964ba376b4, and fix the test in another way: it's better to use logger_noopt because this way the name of the variables are preserved




Modified: pypy/pysqlite2/dbapi2.py
==============================================================================
--- pypy/pysqlite2/dbapi2.py	(original)
+++ pypy/pysqlite2/dbapi2.py	Fri Feb  4 13:42:23 2011
@@ -205,6 +205,46 @@
 sqlite.sqlite3_result_error.argtypes = [c_void_p, c_char_p, c_int]
 sqlite.sqlite3_result_text.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
 
+# new
+# ===================================
+
+# safe
+
+sqlite.sqlite3_libversion.argtypes = []
+sqlite.sqlite3_column_blob.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_column_bytes.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_column_double.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_column_int64.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_column_name.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_column_text.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_errcode.argtypes = [c_void_p]
+sqlite.sqlite3_errmsg.argtypes = [c_void_p]
+sqlite.sqlite3_column_count.argtypes = [c_void_p]
+sqlite.sqlite3_column_count.restype = c_int
+sqlite.sqlite3_reset.argtypes = [c_void_p]
+sqlite.sqlite3_reset.restype = c_int
+
+# unsafe
+
+
+sqlite.sqlite3_step.argtypes = [c_void_p]
+sqlite.sqlite3_step.restype = c_int
+sqlite.sqlite3_finalize.argtypes = [c_void_p]
+sqlite.sqlite3_finalize.restype = c_int
+
+## sqlite.sqlite3_column_type.argtypes = [c_void_p, c_int]
+## sqlite.sqlite3_column_type.restype = c_int
+## sqlite.sqlite3_total_changes.argtypes = [c_void_p]
+## sqlite.sqlite3_total_changes.restype = c_int
+## sqlite.sqlite3_bind_null.argtypes = [c_void_p, c_int]
+## sqlite.sqlite3_bind_null.restype = c_int
+## sqlite.sqlite3_busy_timeout.argtypes = [c_void_p, c_int]
+## sqlite.sqlite3_busy_timeout.restype = c_int
+## sqlite.sqlite3_value_type.argtypes = [c_void_p]
+## sqlite.sqlite3_value_type.restype = c_int
+
+
+
 ##########################################
 # END Wrapped SQLite C API and constants
 ##########################################
@@ -369,9 +409,13 @@
                 sql = "BEGIN " + self._isolation_level
                 statement = c_void_p()
                 next_char = c_char_p()
-                ret = sqlite.sqlite3_prepare_v2(self.db, sql, -1, byref(statement), next_char)
+                psql = c_char_p(sql)
+                ret = sqlite.sqlite3_prepare_v2(self.db, psql, -1, byref(statement), next_char)
                 if ret != SQLITE_OK:
-                    raise self._get_exception(ret)
+                    xx = self._get_exception(ret)
+                    if 'syntax error' in str(xx):
+                        import pdb;pdb.set_trace()
+                    raise xx
                 ret = sqlite.sqlite3_step(statement)
                 if ret != SQLITE_DONE:
                     raise self._get_exception(ret)
@@ -387,9 +431,13 @@
             sql = "COMMIT"
             statement = c_void_p()
             next_char = c_char_p()
-            ret = sqlite.sqlite3_prepare_v2(self.db, sql, -1, byref(statement), next_char)
+            psql = c_char_p(sql)
+            ret = sqlite.sqlite3_prepare_v2(self.db, psql, -1, byref(statement), next_char)
             if ret != SQLITE_OK:
-                raise self._get_exception(ret)
+                xx = self._get_exception(ret)
+                if 'syntax error' in str(xx) or 'token' in str(xx):
+                    import pdb;pdb.set_trace()
+                raise xx
             ret = sqlite.sqlite3_step(statement)
             if ret != SQLITE_DONE:
                 raise self._get_exception(ret)
@@ -630,14 +678,18 @@
 
         self.statement = c_void_p()
         next_char = c_char_p()
-        ret = sqlite.sqlite3_prepare_v2(self.con.db, sql, -1, byref(self.statement), byref(next_char))
+        psql = c_char_p(sql)
+        ret = sqlite.sqlite3_prepare_v2(self.con.db, psql, -1, byref(self.statement), byref(next_char))
         if ret == SQLITE_OK and self.statement.value is None:
             # an empty statement, we work around that, as it's the least trouble
             ret = sqlite.sqlite3_prepare_v2(self.con.db, "select 42", -1, byref(self.statement), byref(next_char))
             self.kind = "DQL"
 
         if ret != SQLITE_OK:
-            raise self.con._get_exception(ret)
+            xx =  self.con._get_exception(ret)
+            if 'syntax error' in str(xx):
+                import pdb;pdb.set_trace()
+            raise xx
         self.con._remember_statement(self)
         if _check_remaining_sql(next_char.value):
             raise Warning, "One and only one statement required"



More information about the Pypy-commit mailing list