diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-22 14:54:19 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-22 14:54:19 +0200 |
commit | df0fd496fbc7dfcf468f72881e81ef6424fe39fd (patch) | |
tree | 24fb915bb70e01ddf7146eb83f5910538e80c1df /doc/examples | |
parent | f12586c0fa5c8a877b4a6538d9ebb0c0a1a33745 (diff) | |
parent | f472f1a6382abc698f74a1afbb07b2274b3a3d45 (diff) |
merge master
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/blob.py | 13 | ||||
-rw-r--r-- | doc/examples/blob_with.py | 12 |
2 files changed, 25 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() + 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" + |