ZSQL: Insert a result from a sql query
Hello, I am trying to insert a result from a sql query into another query I am selecting 1+max(ordernum) from a table as newordernum and then tries to insert this into a table. I call the sql method like this: <dtml-call expr="sqlAddNewClip(ordernum=newordernum)"> but keeps getting an error: Error Type: NameError Error Value: newordernum Please .. I have searched the mailinglist archieves for an answer but gets none -- ************************ Gitte Wange Jensen System Squid Developer MMManager Aps +45 29 72 79 72 gitte@mmmanager.org ************************
there's actually two problems here: 1. you might be returning a variable named "newordernum", but to get the result of that ZSQL query you need to refer to the ZSQL method name, not the name of the returned variable. 2. even though it seems your SQL code returns just one variable it actually returns a sequence, just like you have when a whole set of records is returned. here is how you could do it: <dtml-in expr="sqlSelectNextOrderNumber"> <dtml-call expr="REQUEST.set('ordernum', 'newordernum')"> </dtml-in> <dtml-call expr="sqlAddNewClip(ordernum=ordernum)"> or, a little shorter, <dtml-let ordernum="sqlSelectNextOrderNumber()[0].newordernum"> <dtml-call expr="sqlAddNewClip(ordernum=ordernum)"> </dtml-let> jens on 4/6/01 7:28, Gitte Wange at gitte@mmmanager.org wrote:
Hello,
I am trying to insert a result from a sql query into another query
I am selecting 1+max(ordernum) from a table as newordernum and then tries to insert this into a table. I call the sql method like this: <dtml-call expr="sqlAddNewClip(ordernum=newordernum)"> but keeps getting an error: Error Type: NameError Error Value: newordernum
Please .. I have searched the mailinglist archieves for an answer but gets none
fredericksburg.com serves between 30 and 50 thousand page views per day using Zope. Several times per day, the management side of zope slows to a crawl (several minutes between pages). The Web side slows, but not as noticeably. Most times, restarting zope (3-4 times per day) helps. Other times we have to restart everything. On this box we have other Zope installations as well as other non-zope sites. In order to get help from the list to fix this regular and frustrating problem, what would you need to know? Thanks. Bill
Bill Blevins wrote:
fredericksburg.com serves between 30 and 50 thousand page views per day using Zope.
Several times per day, the management side of zope slows to a crawl (several minutes between pages). The Web side slows, but not as noticeably. Most times, restarting zope (3-4 times per day) helps. Other times we have to restart everything.
On this box we have other Zope installations as well as other non-zope sites.
In order to get help from the list to fix this regular and frustrating problem, what would you need to know?
Thanks.
Bill
i see that box is a Windows 2000....(bleah) Only zope hangs or all the os?
Hi Bill, You may want to try using the debug logger to see if something is hanging... if you use the -M switch to z2.py, it will produce a log that you can postprocess to see where your app is getting slow. There'a s debug log analysis program at http://www.zope.org/Members/mcdonc/HowTos/DEBUG-LOG (ignore the bit in it which tells you to modify z2.py, this is already a part of Zopes 2.2.4+.) Run the generated debug log through this little program and see what you come up with. If any requests hang, there's a problem, and you should see a pattern. HTH, - C ----- Original Message ----- From: "Alberto Berti" <alberto@chiaroscuro.com> To: "Bill Blevins" <bblevins@fredericksburg.com> Cc: <zope@zope.org> Sent: Friday, April 06, 2001 9:46 AM Subject: Re: [Zope] S...L...O...W Zope
Bill Blevins wrote:
fredericksburg.com serves between 30 and 50 thousand page views per day using Zope.
Several times per day, the management side of zope slows to a crawl (several minutes between pages). The Web side slows, but not as noticeably. Most times, restarting zope (3-4 times per day) helps. Other times we have to restart everything.
On this box we have other Zope installations as well as other non-zope sites.
In order to get help from the list to fix this regular and frustrating problem, what would you need to know?
Thanks.
Bill
i see that box is a Windows 2000....(bleah) Only zope hangs or all the os?
_______________________________________________ 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 )
participants (5)
-
Alberto Berti -
Bill Blevins -
Chris McDonough -
Gitte Wange -
Jens Vagelpohl