summaryrefslogtreecommitdiff
path: root/doc/examples/blob_with.py
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-02-02 20:25:20 +0100
committerRuben Pollan <meskio@sindominio.net>2017-02-02 23:58:37 +0100
commitbb9cc1216873604459724860d606283c398ea06b (patch)
tree877eb31a32e52619092e90ab83241986bdd475ef /doc/examples/blob_with.py
parenta55df58db59d38d7d320f51fa760f20cf1f69312 (diff)
[feat] add support for the blob interfacedevelop
Pysqlcipher support for the sqlite blob interface: https://sqlite.org/c3ref/blob_open.html Copying the code from the PR in pysqlite: https://github.com/ghaering/pysqlite/pull/93
Diffstat (limited to 'doc/examples/blob_with.py')
-rw-r--r--doc/examples/blob_with.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/examples/blob_with.py b/doc/examples/blob_with.py
new file mode 100644
index 0000000..fff9037
--- /dev/null
+++ b/doc/examples/blob_with.py
@@ -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"
+