ZSQL question - probably a stupid one!
Hi, I have am using ZSQL against a postgres database using psgcopg. I have a set of queries which are doing inserts then the last one is doing something like this; SELECT currval('blahseq') I want to be able to set an object name for this value which is different to the field name that the SQL will return. Does this make sense? How do I do this? Thanks, Dan - Dan Jacobs - 07956 246 659
OK - I am doing something wrong here so let me explain what I am trying to do maybe then someone can advice. I have. 1. a form that submits to a dtml method 2. dtml method does a dtml-call to some ZSQL 3. the ZSQL is doing a load of inserts then 1 select at the end. My new question. How do I display the results of the select at the end? Can I do this from my dtml method (2)? Then depending on the answer and how it works I might need the first question answered. Thanks in advance, Dan On Wed, 25 Sep 2002, Dan Jacobs wrote:
Hi,
I have am using ZSQL against a postgres database using psgcopg.
I have a set of queries which are doing inserts then the last one is doing something like this; SELECT currval('blahseq')
I want to be able to set an object name for this value which is different to the field name that the SQL will return.
Does this make sense? How do I do this?
Thanks,
Dan
- Dan Jacobs - 07956 246 659
_______________________________________________ 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 )
- Dan Jacobs - 07956 246 659
On Wed, Sep 25, 2002 at 07:06:22PM +0100, Dan Jacobs wrote:
I have.
1. a form that submits to a dtml method 2. dtml method does a dtml-call to some ZSQL 3. the ZSQL is doing a load of inserts then 1 select at the end.
My new question. How do I display the results of the select at the end?
What about doing the select in a separate ZSQL method that could be called from DTML. -Tim -- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
OK, the selec is actually this SELECT currval('pieceseq') which is taking the latest value of a sequentially assigned id number. according to the docs you can only do this within after an insert... dj On Wed, 25 Sep 2002, Tim Wilson wrote:
On Wed, Sep 25, 2002 at 07:06:22PM +0100, Dan Jacobs wrote:
I have.
1. a form that submits to a dtml method 2. dtml method does a dtml-call to some ZSQL 3. the ZSQL is doing a load of inserts then 1 select at the end.
My new question. How do I display the results of the select at the end?
What about doing the select in a separate ZSQL method that could be called from DTML.
-Tim
-- Tim Wilson | Visit Sibley online: | Check out: Henry Sibley HS | http://www.isd197.org | http://www.zope.com W. St. Paul, MN | | http://slashdot.org wilson@visi.com | <dtml-var pithy_quote> | http://linux.com
_______________________________________________ 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 )
- Dan Jacobs - 07956 246 659
something like this; SELECT currval('blahseq')
I want to be able to set an object name for this value which is different to the field name that the SQL will return.
SELECT currval('blahseq') AS myname should return a column named 'myname'. Julian.
participants (3)
-
Dan Jacobs -
Julian Melville -
Tim Wilson