The documentation outlines the C interface for incremental blob
input/output, and mentions the C typedef for a blob handle.

http://www.sqlite.org/c3ref/blob_open.html
http://www.sqlite.org/c3ref/blob.html

typedef struct sqlite3_blob sqlite3_blob;


Can this same interface be accessed in Python?

My application manipulates image and audio content. However, on my
constrained platform (Python 2.5, sqlite3, Maemo, Nokia Internet Tablet),
reading and writing the media data via the conventional blob interface (as
illustrated in teh following www.initd.org SnippetsBlobs.py example) could
consume excessive memory. Specifically, all of the binary data are read into
blobdata object at once, via the read() call. Since the media files can be
arbitrarily large, this call could easily exceed available memory.

*blob*data = *open*('c:\\*sqlite*3\\img.jpg','rb').read()

con = *sqlite*.connect(':memory:')
cur = con.cursor()

cur.execute("Create table picture_table(images)")
cur.execute("Insert into picture_table(images) values
(?)",(*sqlite*.Binary(*blob*data),))
con.commit()


Instead, I need to incrementally read and write media data to a blob, to
avoid consuming arbitrary memory.

Can this be done from Python via the sqlite3 module? Can you point me to
examples?

Thanks.

Norm.

www.nbyoung.com
www.personalsyndication.com
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to