[Zope] Re: dynamic sql query

Dieter Fischer dieter.fischer@grid-it.ch
Thu, 30 Jan 2003 13:33:15 +0100


Hello

This is an example of exUserFolder, it should also work for your problem:

Arguments:

table=3Dadressen
usernameColumn=3Ddbusername
username:string

SQL:

DELETE FROM <dtml-var table>
where <dtml-var usernameColumn>=3D<dtml-sqlvar username type=3Dstring>

---

Mit freundlichen Gr=FCssen - Meilleures salutations - Kind regards - Cord=
iali
saluti

Dieter Fischer
Grid IT GmbH
Im Niederholzboden 24
CH-4125 Riehen
Tel: +41 61 601 29 62
mailto:dieter.fischer@grid-it.ch
http://:www.grid-it.ch


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Euge=
n
> Nedelcu
> Sent: Thursday, January 30, 2003 1:05 PM
> To: martin f krafft
> Cc: zope@zope.org
> Subject: Re: [Zope] Re: dynamic sql query
>
>
> On Thu, Jan 30, 2003 at 12:51:39PM +0100, martin f krafft wrote:
> > first, shouldn't you be using dmtl-sqlvar? and second, i think the
> > problem is that dtml-var returns a string, which is single-quoted.
> > you'll need to fine a type=3D"" argument for dtml-sqlvar that renders
> > unquoted characters.
>
> I don't think you understand my problem...
> I need to pass this arguments to my zsql method:
>
> 1. database - string - the name of the database
> 2. table - string - the name of the table
> 3. pri - string - the name of the primary_key column
> 4. tuple_pri - tuple - a tuple with primary_keys of the rows
> 	which will be deleted.
>
> In sql the query would be (i.e):
>
> delete from test.test where id in (1,3,7,9)
>
> A zsql method like this:
>
> delete from <dtml-var database>.<dtml-var table> where
> <dtml-sqltest id type=3Dnb op=3Deq multiple>
>
> will work if the name of the primary_key is id, but I
> want to pass that column name myself.
>
> Hope that this make things more clear.
> Best regards.
>
> --
> ICQ: 165549179
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>