BLOBS and python
Alex
cut_me_out at hotmail.com
Thu May 4 15:48:45 EDT 2000
> I'm trying to insert an image as a blob, but unless I escape any
> quotes ("') within it, it seems to puke. The problem is, it's an
> image and if I escape the quotes, I change the image. How can I do
> this?
>
> import cgi
> import MySQLdb
> query = cgi.FieldStorag()
> image = query["filename"].value
>
> c = MySQLdb.connect(...)
> con = c.cursor()
> con.execute("INSERT INTO foo (myblob) VALUES ('%s')" % image)
Don't know whether it'll be fast enough for you, but
More information about the Python-list
mailing list