[pypy-commit] pypy default: Added sqlite3.Connection.enable_load_extension, untested because it requires your libsqlite to have been compiled with the right options. (CPython has no tests for it either). Manually tested by running the GeoDjango test suite.

alex_gaynor noreply at buildbot.pypy.org
Tue Nov 22 21:58:06 CET 2011


Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: 
Changeset: r49671:b38fa1e72083
Date: 2011-11-22 14:00 -0600
http://bitbucket.org/pypy/pypy/changeset/b38fa1e72083/

Log:	Added sqlite3.Connection.enable_load_extension, untested because it
	requires your libsqlite to have been compiled with the right
	options. (CPython has no tests for it either). Manually tested by
	running the GeoDjango test suite.

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -231,6 +231,9 @@
 sqlite.sqlite3_result_text.argtypes = [c_void_p, c_char_p, c_int, c_void_p]
 sqlite.sqlite3_result_text.restype = None
 
+sqlite.sqlite3_enable_load_extension.argtypes = [c_void_p, c_int]
+sqlite.sqlite3_enable_load_extension.restype = c_int
+
 ##########################################
 # END Wrapped SQLite C API and constants
 ##########################################
@@ -705,6 +708,14 @@
         from sqlite3.dump import _iterdump
         return _iterdump(self)
 
+    def enable_load_extension(self, enabled):
+        self._check_thread()
+        self._check_closed()
+
+        rc = sqlite.sqlite3_enable_load_extension(self.db, int(enabled))
+        if rc != SQLITE_OK:
+            raise OperationalError("Error enabling load extension")
+
 DML, DQL, DDL = range(3)
 
 class Cursor(object):


More information about the pypy-commit mailing list