[DB-SIG] db module wrapper
randall at tnr.cc
Fri Aug 20 07:51:49 CEST 2004
Ian Bicking wrote:
> Randall Smith wrote:
>> The only oddity is non-standard escapes like Postgresql's '\'. '\' is
>> not a problem to handle, I just have to know when to treat it as an
>> escape character and when not to. Do you know of any other databases
>> that use '\' as an escape character or any other non-standard escape
>> characters in use?
> MySQL also uses \', as well as strings like "maybe?", "\'maybe?\'", or
> "\"maybe?\"". SQLite and Firebird -- other databases I am familiar with
> -- don't use backslash quoting.
> Also note 'maybe\\' and 'maybe\\\'?' (and so on). Backslash quoting can
> be a pain.
Thanks. You obviously have experience with this issue. The 'maybe\\'
example would currently break my program. I can fix this by assuming an
even number of '\' will not escape a quote. I've been collecting your
examples using them as test cases. I think I'm close to completing the
parameter abstraction feature.
On a different topic, a new question has come to mind. What is a good
way for the wrapper to know what module it is using? It needs to know
if it is psycopg, pgdb, cx_Oracle, mx.ODBC.Windows, or whatever for some
module specific behavior. I can get dbmodule.__version__, but
dbmodule.__name__ is not reliable. I currently rely on a string passed
in at initialization.
More information about the DB-SIG