Escaping quotes in sql statement
I'm trying to insert a record into a dbm file. One of the fields that I'm inserting contains a single quote, which seems to be causing an error.
An example of working and not working code:
[code]
>>> db.execute(u"INSERT INTO cardsets (title, description) VALUES ('a','b')")
1
>>> db.execute(u"INSERT INTO cardsets (title, description) VALUES ('a','\'')")
Traceback (most recent call last):
File "<console>", line 1, in ?
[/code]
The second doesn't work with 1-4 backslashes.
This also doesn't work in the sports diary example that came with the sdk.
Any ideas on how to insert a single quote into a database?
Thanks, Ed