Back to the month index |
Back to the list index
|
Luis Alberto Vianna Tavares (luisvt@openlink.com.br)
Wed, 4 Sep 1996 01:08:49 -0300
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Antoine: "[mSQL] Using files containing statements"
- Previous message: Gary Bickford: "Re: [mSQL] Should I create tables for intermediate results?"
- Maybe in reply to: Gary Bickford: "[mSQL] Should I create tables for intermediate results?"
Message-Id: <01BB9B90.B232F320@oprj055.openlink.com.br> From: Luis Alberto Vianna Tavares <luisvt@openlink.com.br> Subject: RE: [mSQL] insert's query using variables in a perl5... Date: Wed, 4 Sep 1996 01:08:49 -0300Thanks for all,
Luis Tavares
----------
De: Coy, John[SMTP:jcoy@arkansas.net]
Enviada em: Sábado, 2 de Setembro de 1995 20:32
Para: msql-list@bunyip.com
Assunto: Re: [mSQL] insert's query using variables in a perl5...
At 08:28 PM 9/2/96 +0100, you wrote:
>Hi, there.:)B
>
>On Sun, 1 Sep 1996, Luis Alberto Vianna Tavares wrote:
>
>> How can I make a insert's query using variables in a perl5 and MsqlPerl ?
>> Like:
>> INSERT INTO table( field1, field2 ) VALUES ( $var1, $var2 )
>
>As long as you put your query in double quotes, you should be fine. I.e.:
>
>$dbh->$query("INSERT INTO table(field1,field2 ) VALUES ($var1,$var2 )");
>
You'll also have to 'quote' your variables, something like this will do:
$var1 = $dbh->quote($var1);
$var2 = $dbh->quote($var2);
$dbh->query("INSERT INTO table (field1, field2) VALUES ($var1, $var2)");
Presuming $var1 and $var2 are char() type variables. If they are ints,
then you don't have to quote them at all.
--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!
- application/ms-tnef attachment: stored
- Next message: Antoine: "[mSQL] Using files containing statements"
- Previous message: Gary Bickford: "Re: [mSQL] Should I create tables for intermediate results?"
- Maybe in reply to: Gary Bickford: "[mSQL] Should I create tables for intermediate results?"