Gadfly: single-quote in varchar?

Sam Penrose spenrose at intersight.com
Wed May 22 13:50:06 EDT 2002


I cannot get Gadfly to INSERT a string containing a single-quote (') 
into a VARCHAR field. Gadfly appears to insist that strings passed to 
its parsing framework be delimited with single quotes:

 >>> cursor.execute("INSERT INTO t (Description) VALUES ('alpha')")
NOT
 >>> cursor.execute('INSERT INTO t (Description) VALUES ("alpha")')

which may or may not be connected, (and rules out the obvious 'INSERT 
INTO t (Description) VALUES ("alpha's before beta")') but at any rate no 
variation on

 >>> cursor.execute("INSERT INTO t (Description) VALUES ('alpha\'s before 
beta')")
 >>> cursor.execute("INSERT INTO t (Description) VALUES ('alpha\\'s 
before beta')")
 >>> cursor.execute("INSERT INTO t (Description) VALUES ('alpha\\\'s 
before beta')")

seems to work, although some fail silently, neither raising an error or 
inserting the row. Description has been defined as a VARCHAR field and 
happily accepts strings with other punctuation, including double-quotes. 
Anyone know if this is a Gadfly constraint, or notice some dunderheaded 
mistake I'm making?

Gadfly 1.0.0rc1, Unix python 2.2 on Mac OS X.

TIA,
Sam






More information about the Python-list mailing list