[Zope] More Zope/PostGreSQL/PoPyDA.

acg acarrasco@udiberica.com
Tue, 28 Aug 2001 10:55:47 +0200


----- Original Message -----
From: "Jim Penny" <jpenny@universal-fasteners.com>
To: "acg" <acarrasco@udiberica.com>
Sent: Monday, August 27, 2001 10:00 PM
Subject: Re: [Zope] More Zope/PostGreSQL/PoPyDA.


> On Mon, Aug 27, 2001 at 02:28:09PM +0200, acg wrote:
> > My personal configuration:
> >  ZPoPyDA 2.0.7
> >  Zope 2.4.0
> >  Python 2.1.1
> >  Debian/GNU Linux
> >
> I don't know.  Frankly, I do not like the -sqltest and -sqlgroup
> tags because I can hardly ever figure out what they do.  But, I
> think that they in fact expand to a simple text string long
> before the database adapter sees it.  So I am purely guessing
> that you will see the same independent of DA.

Yes, I think so too. "before the database adapter sees it."


>
> > Another bug or is it only a bad dtml construction?
> > Again from ZopeBook I see this
> >
> > Examples
> >
> > Sample usage:
> >
> > select * from employees
> >
> > <dtml-sqlgroup where>
> >
> > <dtml-sqltest salary op=gt type=float optional>
> >
> > <dtml-and>
> >
> > <dtml-sqltest first op=eq type=string multiple optional>
> >
> > <dtml-and>
> >
> > <dtml-sqltest last op=eq type=string multiple optional>
> >
> > </dtml-sqlgroup>
> >
> > (...)
> >
> > If salary is 50000 and last is Smith it renders:
> >
> > select * from employees
> >
> > where
> >
> > (salary > 50000.0
> >
> > and
> >
> > last='Smith'
> >
> > )

This example is from Chapter 10, Dinamic SQL Querys, Creating complex
queries with sqlgroup tag.

>
> Actually, yes, this does look right.
>
> >
> > Mmmm..., is ZPoPyDA supposse to do that? I don?t think so. My code:
> >
>
> And from here on, I get lost with what functions you are calling and what
> parameter values are being used.

This is the ZSQLMethod selectDepartments I use to have a combo box with all
departments. This is what i have in the management interface to try with it
before I use it. I test this with blank arguments (nothing in an input text)
and I get this (in spanish):

<<< There was no data matching this Mostrar Departamentos query.
----------------------------------------------------------------------------
----
SQL used:

SELECT * FROM Departamentos
where
nombre = ''
ORDER BY idDepartamento

>>>>> Mmmm... Itīs supposse to do a SQL like "SELECT * FROM Departamentos
ORDER BY idDepartamento" because the argument "nombre" is optional and it
hasnīt to be rendered by Zope

> > > Arguments: id, name.> > > >  SELECT * FROM Departments> >
<dtml-sqlgroup where>> >  <dtml-sqltest id op=eq type=int optional>> >
<dtml-and>> >  <dtml-sqltest name op=eq type=string optional> IT WORKS!!!
with the fix by Jim Penny> > </dtml-sqlgroup>> > ORDER BY id> > > > My Query
Result without blanks arguments, Zope renders...> > > > SELECT * FROM
Departments> > where> > name = ''> > ORDER BY idDepartamento> > > > Ups! Is
it my code or is it a new bug? I?m thinking about change to psicopg... Is it
a good idea?> > > > Antonio Carrasco> > > > > > > > >