Re: [Zope-DB] Null characters & booleans

2005-04-08 Thread Cliff Ford
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.

Cliff
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:


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:

 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
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


Re: [Zope-DB] Null characters & booleans

2005-04-08 Thread Charlie Clark

On 2005-04-08 at 10:44:59 [+0200], Andrew Veitch 
<[EMAIL PROTECTED]> wrote:
> We'd be willing to provide patches for both these issues if there's
> interest and agreement it's a sensible way to go.

The most sensible thing is if the DA does not have to do the quoting at all 
and that this is either done by the underlying Python driver or better 
still by the database. This is significantly faster and safer.

If you use our mxODBCZopeDA as an ExternalMethod you can use bound 
parameters  (have your cake and eat it).

We started some work on a replacement last year after EuroPython and you 
can check the archives for our progress. My cycling accident interrupted 
work :-/ but I'm starting to look at using SimpleTemplates in conjunction 
with a considerably simplified DB.py which will do little more than call 
the .execute() on the connection.

Charlie
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db


[Zope-DB] Null characters & booleans

2005-04-08 Thread Andrew Veitch
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:


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:

 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/
___
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db