On Tue, 2007-10-16 at 14:09 -0700, Richard Schneiderman wrote: > --- Richard Schneiderman <[EMAIL PROTECTED]> > wrote: > > > Date: Tue, 16 Oct 2007 13:50:35 -0700 (PDT) > > From: Richard Schneiderman <[EMAIL PROTECTED]> > > Subject: Informixdb blob usage > > To: [EMAIL PROTECTED] > > > > Mr. Haese, > > Thanks for creating Informixdb. It has been very > > useful at work. I have a question though. I have not > > been able to find a good sample query to update a > > blob > > field using your library. > > > > I tried rr = informixdb.Connection.Sblob(conn) but > > it > > keeps throwing erors. I'm not even sure this is > > close.
Oddly enough, it took about 20 hours for this message to appear here on the db-sig list, long after I already answered the question in private email. Now that the question is visible to the public, I'll also answer publicly, for the benefit of any future readers that find this question in an archive. To clarify, the OP is trying to update BYTE/TEXT columns (simple large objects), not BLOB/CLOB (smart large objects). Sblob instances are for updating/inserting contents of Smart Large Object columns. The "S" in Sblob stands for smart, and the "b" stands for "I couldn't bring myself to call it 'Slob'." :) To update/insert BYTE/TEXT columns, you may bind either a string or an informixdb.Binary(...) object to the query: #### import informixdb conn = informixdb.connect("stores_demo") cur = conn.cursor() cur.execute(""" update catalog set cat_descr = ? where catalog_num = ? """, ("This is the new description for catalog number 10001", "10001")) descr10002 = informixdb.Binary("Description for catalog number 10002") cur.execute(""" update catalog set cat_descr = ? where catalog_num = ? """, (descr10002, "10002")) #### Note that the ability to bind strings directly is an InformixDB-specific extension. If you want to stay within the bounds of the DB-API specifications for easier porting between databases, use informixdb.Binary. Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net _______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig