summaryrefslogtreecommitdiff
path: root/tests/blobs.py
blob: a10cac06082012359bdcdf9e53d4e4398ba3c0c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
from pysqlcipher import dbapi2 as sqlite3
con = sqlite3.connect("blobs.db")
# 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)
assert blob.read() == "aaaaabbbbb"
blob.close()