summaryrefslogtreecommitdiff
path: root/doc/examples/blob.py
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/blob.py')
-rw-r--r--doc/examples/blob.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/examples/blob.py b/doc/examples/blob.py
new file mode 100644
index 0000000..2d63b9c
--- /dev/null
+++ b/doc/examples/blob.py
@@ -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()
+