[Zope] Objet : [Zope] RE: Dynamic SQL problem

François-Régis CHALAOUX fchalaou@strasbourg.synthelabo.fr
Mon, 19 Apr 1999 16:26:45 +0100


Thanks Aaron,
It is working perfectly now. Cool :)

FR


>>> Aaron Watters <arw@ifu.net> 19/04/99 15:21:32 >>>
Dear François-Régis Chalaoux,

You have a gadfly problem.

There are too many layers of syntax here for my
myopic eyes, however looking real hard at the following:

    insert into softdomain (idsoftware,iddomain)
    values( (select idsoftware from software where
    name = <!--#sqlvar name type=string-->),
    <!--#sqlvar iddomain type=string-->)

Gadfly only supports *literals* in "INSERT ... VALUES (...)"
You cannot put a query inside the parens.   Instead of

    insert into table (a,b) values ((select max(a) from table), 5)

you can do this

    insert into table (a,b)
    select max(a) as a, 5 as b from table

or even (Gadfly 1.0, not beta whatever)

   insert into table (a,b)
   select (select max(a) from table) as a, 5 as b from dual

And you can always do a rewrite similar to the second one I think.
And if "select * from dual" doesn't work upgrade.

The "INSERT INTO...VALUES" is highly optimized using the assumption
that no queries ever occur in the values...

Regards,  -- Aaron Watters http://www.chordate.com 

===
stop procrastinating tomorrow.



_______________________________________________
Zope maillist  -  Zope@zope.org 
http://www.zope.org/mailman/listinfo/zope 

(For developer-specific issues, use the companion list,
zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )