[Zope-DB] Null characters & booleans

Andrew Veitch andrew at logicalprogression.net
Fri Apr 8 04:44:59 EDT 2005


We're doing a lot with relational databases and Zope at the moment. We 
are trying to get our code to work with as many different relational 
backends as possible with a minimal amount of rewriting.

The first issue we've got is chr(0) appearing in input strings. Using 
Postres/Psycopg if we do:

<dtml-sqlvar variable type="string">

and variable contains a chr(0) then it will fail.

Obviously we can get round this by variable.replace(chr(0), '') on 
every variable before it goes in to the ZSQL method but that's not 
ideal. Would it be sensible to look at patching sqlvar or is this just 
a problem specific to Postgres?

The second issue we've got is with Booleans. It is quite annoying to 
have to do:

<dtml-sqlvar "str(variable)" type="string"> to insert Booleans. Also I 
think that some databases expect their Booleans to be other than 'true' 
and 'false' so introducing a Boolean quoting type would push this logic 
down to the DA rather than complicating the application.

We'd be willing to provide patches for both these issues if there's 
interest and agreement it's a sensible way to go.

A

-- 
Logical Progression Ltd, 20 Forth Street, Edinburgh EH1 3LH, UK
Tel: +44 (0)131 550 3733 Web: http://www.logicalprogression.net/



More information about the Zope-DB mailing list