Hello, I'm trying to use PostGreSQL with Zope, but I'm having problems using the SQL INSERT method in Z methods which require parameters. For example, I make a Z SQL Method named 'foo'. In it: INSERT INTO messages VALUES (<!--#sqlvar auteur type="string"-->, 'blahblahblah', 'now', 'f') I write the name auteur in the 'arguments' form. Next I create a DTML document with: <form action="foo" method="GET"> Auteur: <input width="30" name="auteur" value=""><br> <input type="submit" name="SUBMIT" value="Envoyer"> <form> When submitting the form, it displays me a new page (generated by Zope) asking me again the auteur parameter, as if the auteur variable wasn't passed to the Z SQL method :-( Someone posted a mail recently with an example use of INSERT, where he put '(auteur)' after the 'INSERT INTO messages' text: INSERT INTO messages (auteur) ... When I try this, I get: Error, pg.error: server fatal error. Please report to your db administrator. SQL used: INSERT INTO messages (auteur) VALUES ('testing again', 'blahblahblah', 'now', 'f') Is there something specific to PostGreSQL ? (Using Zope 1.10.2, PostGreSQL 6.4.2, PyGreSQL-2.2, ZPyGreSQLDA 0.02) I looked in the Z SQL Method User's guide, but nothing is written about adding data to a DB :-( -- Luc Stepniewski <lstep@mail.dotcom.fr> http://www.planete.net/~rstep/pubkey.txt KeyID: 1024D/76A31F52 GnuPG: 819D 1F8E 7BE2 B80C AA2C 0473 CCED 48B6 76A3 1F52
lstep@mail.dotcom.fr wrote:
Hello,
I'm trying to use PostGreSQL with Zope, but I'm having problems using the SQL INSERT method in Z methods which require parameters.
For example, I make a Z SQL Method named 'foo'. In it: INSERT INTO messages VALUES (<!--#sqlvar auteur type="string"-->, 'blahblahblah', 'now', 'f')
I write the name auteur in the 'arguments' form.
Next I create a DTML document with: <form action="foo" method="GET"> Auteur: <input width="30" name="auteur" value=""><br>
why no type=text ?
<input type="submit" name="SUBMIT" value="Envoyer"> <form>
When submitting the form, it displays me a new page (generated by Zope) asking me again the auteur parameter, as if the auteur variable wasn't passed to the Z SQL method :-(
Someone posted a mail recently with an example use of INSERT, where he put '(auteur)' after the 'INSERT INTO messages' text: INSERT INTO messages (auteur) ...
When I try this, I get:
Error, pg.error: server fatal error. Please report to your db administrator.
A good to test your SQL is using psql. And upgrading to PyGreSQL 2.3 or later, which return proper sql messages
SQL used:
INSERT INTO messages (auteur) VALUES ('testing again', 'blahblahblah', 'now', 'f')
This is definitely wrong ;( something like INSERT INTO messages (auteur,title,bookdate,any_good) VALUES ('testing again', 'blahblahblah', 'now', 'f') might have worked. You may also mean current_date or current_time instead of now or now()
participants (2)
-
Hannu Krosing -
lstep@mail.dotcom.fr