[Zope] call SQL method

Ze Octavio joc@hiper.com.br
Fri, 25 Feb 2000 15:47:42 -0300


Oi Pedro,

Pedro Silva wrote:
> 
> 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?

If the sqlmethod need it. Yes.

 
> 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>'
>         )
> 

My suggestion is to use sqlvar instead of only the tag. So you can
use:<dtml-sqlvar fname type=string> instead of '<dtml-var fname>'

>         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?


  No, you CANT use var in a call tag. So you have to do in this way:

<dtml-call
"sqlInsert(nome=fname,apelido=lname,morada=address,localidade=fzip,casa=restzip,and_so_on)">

Best Regards,

-- 
Ze Octavio
--
Hiperlógica <http://hiper.com.br>
Automação de web-sites | Web-site automation
São Paulo | Brasil | Fone: +55-11-8168067