[Zope-DB] Null characters & booleans

Cliff Ford Cliff.Ford at ed.ac.uk
Fri Apr 8 05:54:06 EDT 2005

Watch out if you need to use fields longer than 4000 characters - Oracle 
CLOBs return handles rather than contents, as in MySQL Text fields for 
example. So you need extra coding in your presentation later. Also, 
watch out for Database X returning result.FieldName whilst Database Y 
returns result.FIELDNAME.

I don't suppose I need to mention DateTime fields!

I suspect you might be better off having some database specific code 
rather than trying to patch the ZSQL Method code.


Andrew Veitch wrote:
> 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

More information about the Zope-DB mailing list