[Zope-DB] Question on ZSQL and Dates

Charlie Clark charlie@begeistert.org
Wed, 23 Oct 2002 20:45:54 +0000


On 2002-10-23 at 18:22:06 [+0000], you wrote:
> Yes. sysdate is Oracle's way of saying "give me the current time
> in your own format". Which database backend are you (currently ;-)
> using ?
MySQL and thanx to Michal, I've got it working
does 
SELECT * from MyTable
WHERE
x <=3D y <=3D z

really have to be replaced by
SELECT * from MyTable
WHERE
x <=3D y
AND
y <=3D z

SQL is worse than I thought. I guess I'm really spoilt by "growing up" with=
 
Python!

> Also, what's the error message you get from Zope when you
> try your solution ?
Depends exactly what I'm doing. I quite often don't get an error message ju=
st 
garbage from the calculation. Database datetime values are returned nicely 
for display but useless for calculations... if I add or take something from=
 
them I get a float? back with a suspicious value like 19690512e8 + 5 for 
1969/05/13. So Zope isn't giving me the datetime value back as an DateTime 
object.
 
> One possibility is that the database expects a specific date
> format and that Zope's DateTime objects don't use this per
> default.
That seems to be the case. This changes magically when mxDateTime is around=
 
apparently:
"I was surprised by that because the other way (from MySQL to Zope)
converts date/time/datetime values to DateTime objects if mxDateTime
is available. Of course I expected that I can give DateTime objects to
update methods too"
in http://lists.zope.org/pipermail/zope-db/2002-May/000558.html
 
> It's easy to install egenix-mx-base in Zope.
I've got it installed and it's visible but I thought it would be nice to ge=
t 
Zope to use it instead of the built-in DateTime stuff. I tried doing this 
manually but wasn't getting anywhere fast.

Anyway the problem is solved for the time being now.

Thanx to everyone for their help.

Charlie
-- 
Charlie Clark
Helmholtzstr. 20
D=1Asseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226