-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] add support for the blob interface
Pysqlcipher support for the sqlite blob interface: https://sqlite.org/c3ref/blob_open.html Copying the code from the PR in pysqlite: ghaering/pysqlite#93
- Loading branch information
Showing
10 changed files
with
812 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pysqlcipher import dbapi2 as sqlite3 | ||
con = sqlite3.connect(":memory:") | ||
# creating the table | ||
con.execute("create table test(id integer primary key, blob_col blob)") | ||
con.execute("insert into test(blob_col) values (zeroblob(10))") | ||
# opening blob handle | ||
blob = con.blob("test", "blob_col", 1, 1) | ||
blob.write("a" * 5) | ||
blob.write("b" * 5) | ||
blob.seek(0) | ||
print blob.read() # will print "aaaaabbbbb" | ||
blob.close() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pysqlcipher import dbapi2 as sqlite3 | ||
con = sqlite3.connect(":memory:") | ||
# creating the table | ||
con.execute("create table test(id integer primary key, blob_col blob)") | ||
con.execute("insert into test(blob_col) values (zeroblob(10))") | ||
# opening blob handle | ||
with con.blob("test", "blob_col", 1, 1) as blob: | ||
blob.write("a" * 5) | ||
blob.write("b" * 5) | ||
blob.seek(0) | ||
print blob.read() # will print "aaaaabbbbb" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.