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:
>>> db.execute(u"INSERT INTO cardsets (title, description) VALUES ('a','b')")
>>> db.execute(u"INSERT INTO cardsets (title, description) VALUES ('a','\'')")
Traceback (most recent call last):
File "<console>", line 1, in ?
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?