Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab9c5a0

Browse files
rhermanklinkdpgeorge
authored andcommitted
unix-ffi/sqlite3: Add optional parameter for URI support.
This commit adds the ability to enable URI on the connect, as can be donein the cpython sqlite3 module. URI allows, among other things, to createa shared named in-memory database, which non URI filenames cannot create.Signed-off-by: Robert Klink <rhermanklink@ripe.net>
1 parent0a65c3d commitab9c5a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

‎unix-ffi/sqlite3/sqlite3.py‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
sq3=ffilib.open("libsqlite3")
77

88
sqlite3_open=sq3.func("i","sqlite3_open","sp")
9+
# int sqlite3_config(int, ...);
10+
sqlite3_config=sq3.func("i","sqlite3_config","ii")
911
# int sqlite3_close(sqlite3*);
1012
sqlite3_close=sq3.func("i","sqlite3_close","p")
1113
# int sqlite3_prepare(
@@ -52,6 +54,8 @@
5254
SQLITE_BLOB=4
5355
SQLITE_NULL=5
5456

57+
SQLITE_CONFIG_URI=17
58+
5559

5660
classError(Exception):
5761
pass
@@ -136,7 +140,9 @@ def fetchone(self):
136140
check_error(self.h,res)
137141

138142

139-
defconnect(fname):
143+
defconnect(fname,uri=False):
144+
sqlite3_config(SQLITE_CONFIG_URI,int(uri))
145+
140146
sqlite_ptr=bytes(get_ptr_size())
141147
sqlite3_open(fname,sqlite_ptr)
142148
returnConnections(int.from_bytes(sqlite_ptr,sys.byteorder))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp