I tried to invoke the query method of my adapter (which is named
dhatabase) with this code:
p = context.REQUEST.get('delete_this')
if p:
s = ', '.join([str(x) for x in p])
t = delete from person where person_id in (%s); % s
context.dhatabase.query(query_string=t)
...and
P.S. I know that dtml-var... rather than dtml-sqlvar... is an
unorthodox and apparently undocumented construct to use within a ZSQL
definition. But I need it because dtml-sqlvar... malformats the string.
What do you mean by 'malformats the string'?
Have you tried dtml-sqltest clause? It
I also have a broader question: When one is composing dynamic SQL in
Python
scripts, what are the pros and cons of executing them by going directly
to
the database adapter (as suggested above) vs passing it in as the sole
argument of an empty ZSQL method? By empty ZQL method I mean
-Original Message-
From: Maciej Wisniowski [mailto:[EMAIL PROTECTED]
Sent: Monday, June 18, 2007 1:34 AM
To: Ken Winter
Cc: 'Zope-DB List'
Subject: Re: [Zope-DB] Using dtml-vars in ZSQL methods?
I tried to invoke the query method of my adapter (which is named
dhatabase
'
Subject: RE: [Zope-DB] Using dtml-vars in ZSQL methods?
I also have a broader question: When one is composing dynamic SQL in
Python
scripts, what are the pros and cons of executing them by going directly
to
the database adapter (as suggested above) vs passing it in as the sole
-Original Message-
From: Charlie Clark [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 16, 2007 6:24 PM
To: Ken Winter; 'Zope-DB List'
Subject: Re: [Zope-DB] Using dtml-vars in ZSQL methods?
...
FWIW you
might want to call the query or execute methods directly on the DA
connection
Ken Winter wrote at 2007-6-16 16:03 -0400:
...
Exception Type
KeyError
Exception Value
'id_list'
Traceback (innermost last):
...
* Module Products.CMFCore.FSPythonScript, line 164, in _exec
* Module None, line 4, in people_delete_control
FSControllerPythonScript at
I have done.
~ Thanks
~ Ken
-Original Message-
From: Jaroslav Lukesh [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 16, 2007 1:41 AM
To: Ken Winter; 'Zope-DB List'
Subject: Re: [Zope-DB] Using dtml-vars in ZSQL methods?
It is just because 'delete_this' is a string, not the list
message to this thread documenting some further
experiments I have done.
~ Thanks
~ Ken
-Original Message-
From: Jaroslav Lukesh [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 16, 2007 1:41 AM
To: Ken Winter; 'Zope-DB List'
Subject: Re: [Zope-DB] Using dtml-vars in ZSQL methods
PROTECTED]
Sent: Saturday, June 16, 2007 3:27 PM
To: Ken Winter; 'Zope-DB List'
Subject: RE: [Zope-DB] Using dtml-vars in ZSQL methods?
...
Second..it would be *really* helpful to see the full traceback instead
of just *Keyerror*. It's somewhat boring to ask every time for it :-)
--On 16. Juni
Charlie ~ I tried several experiments based on your suggestion. See results
inserted below. ~ Thanks, Ken
-Original Message-
From: Charlie Clark [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 16, 2007 3:54 PM
To: Ken Winter; 'Zope-DB List'
Subject: Re: [Zope-DB] Using dtml-vars
Am 17.06.2007, 00:14 Uhr, schrieb Ken Winter [EMAIL PROTECTED]:
dtml-comment
title: Method to delete one Person by id
connection_id: dhatabase
arguments:
person_id
/dtml-comment
delete from person
where person_id = dtml-var person_id
When I tried to delete a couple of People
12 matches
Mail list logo