Insert blob data to MySQL

Steve Holden sholden at holdenweb.com
Sat May 4 16:46:26 EDT 2002


"Gerhard Häring" <gerhard at bigfoot.de> wrote in message
news:slrnad7acj.vc.gerhard at lilith.my-fqdn.de...
> Steve Holden wrote in comp.lang.python:
> > "Billy Ng" <kwokng at earthlink.net> wrote ...
> >> Hi folks,
> >>
> >> Would any body tell me how to insert a blob object to the mysql blob
field
> >>
> >
> > Here "cc" is a cursor on a MySQLdb connection ...
> >
> >>>> cc.execute("""CREATE TABLE blobtbl (
> > ...             i       integer primary key auto_increment,
> > ...             b       blob)""")
> > 0L
> > [...]
> > must-remember-to-delete-that-table-ly y'rs  - steve
>
> Aren't transactions cool? ;-)
>
> PostgreSQL-rules-ly yours,
>
> Gerhard
>
> PS: I know you could get transactions by using a different table type
> in the CREATE statement.


Indeed. My experience with (for example) SQL Server has taught me that DDL
statements are often committed whether or not they are part of an explicit
transaction. Of course, the fact that the table was still there without
commit() doesn't tell me anything with MySQL's default type though.

regards
 Steve
--
Steve Holden: http://www.holdenweb.com/ ; Python Web Programming:
http://pydish.holdenweb.com/pwp/








More information about the Python-list mailing list