I've tried to insert big blob with direct SQL, and the following code
works:

class Photo(SQLObject):
    description = UnicodeCol()
    picture = BLOBCol(default=None)

url = "firebird://user:[EMAIL PROTECTED]/test"
conn = connectionForURI(url)

new_photo = Photo(description="photo", picture=None, connection=conn)

blob = file("myimage.jpg", "rb").read()
dbapiconn = conn.getConnection()
dbapiconn.begin()
cur = dbapiconn.cursor()
cur.execute("UPDATE PHOTO SET PICTURE=? WHERE ID=?", (blob,
new_photo.id))
dbapiconn.commit()


But I'm not sure that storing big amounts of data in BLOBs is great
idea. I'd store pictures on filesystem and store file name in
database.

--
Oleg


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to