[Zope] call SQL method
Jim Sanford
jsanford@atinucleus.com
Fri, 25 Feb 2000 12:19:45 -0600
The variables should already be available to the ZSQL method within the REQUEST object. They would have been sent back by the form
when SUBMITted. Additionally, <dtml-sqlvar ...> should be used instead of <dtml-var ...>.
Your code should read:
INSERT INTO Registos
(nome, apelido, morada, localidade, casa, telemovel, data_nasc)
VALUES
('<dtml-sqlvar fname type=string>,
<dtml-sqlvar lname type=string>,
<dtml-sqlvar "address + ' ' +fzip+ '-' +restzip" type=string>,
<dtml-sqlvar localzip type=string>,
<dtml-sqlvar home_phone type=string>,
<dtml-sqlvar cel_phone type=string>
<dtml-sqlvar data_nasc type=string>
)
This is assuming that all the fields are character type fields ( Even though you didn't have single quotes around a couple of
them - phone numbers should normally be stored as strings and not as numerics.)
__________________________________________________________________
Jim Sanford
. Database/Web Engineer
/ \ / Accelerated Technology, Inc.
/ / 720 Oak Circle Drive East
/ / \ Mobile, AL 36609
/ / \ Voice: 334-661-5770 fax: 334-661-5788
/ \ E-Mail: jsanford@atinucleus.com
Web: http://www.atinucleus.com
Source Code, No Royalties, Any CPU...It just make sense !
__________________________________________________________________
----- Original Message -----
From: Pedro Silva <psilva@ruido-visual.pt>
To: Zope - Questions <zope@zope.org>
Sent: Friday, February 25, 2000 10:19 AM
Subject: [Zope] call SQL method
Hi,
for me to call a SQL Method from a DTML all I have to do is:
<dtml-call "sqlmethodname">
or I have to tell the parameteres of that sqlmethod?
The SQL Method that I'm trying to call insert information in a table. The
code that I have in that SQL Method is:
INSERT INTO Registos
(nome, apelido, morada, localidade, casa, telemovel, data_nasc)
VALUES
('<dtml-var fname>',
'<dtml-var lname>',
'<dtml-var address> <dtml-var fzip>-<dtml-var restzip>',
'<dtml-var localzip>',
<dtml-var home_phone>,
<dtml-var cel_phone>,
'<dtml-var data_nasc>'
)
The arguments are: nome apelido morada localidade casa telemovel
data_nasc
This arguments are the columns of the table.
The variables fname, lname, address, and so on, are the variables of
a form in a DTML document.
If in a DTML Method I call the sql method this way: <dtml-call
"sqlInsert('<dtml-var fname>','<dtml-var lname>','<dtml-var
address>','<dtml-var fzip>','<dtml-var restzip>','<dtml-var
localzip>','<dtml-var home_phone>','<dtml-var cel_phone>','<dtml-var
year_date>','<dtml-var mes_date>','<dtml-var dia_date>')">
Is correct this way?
please send your answers to: psilva@ruido-visual.pt
Pedro
_______________________________________________
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 )