perl and postgresql

Поиск
Список
Период
Сортировка
От Sugrue, Sean
Тема perl and postgresql
Дата
Msg-id 8FDC0F9BE1F91D44BE964AA54AAA67B60357A4CE@wilmexm3.ad.analog.com
обсуждение исходный текст
Список pgsql-novice

I am trying to execute the following query within perl

#!/usr/local/bin/perl

use DBI;

$prod='stdf';


$dbh = DBI->connect("dbi:Pg:dbname=database;host=mink;port=0000","username","password");

$sth = $dbh->prepare("select *  from filestatus where fileformat = $prod");
if( defined($sth)){

$sth->execute;
#for when model numbers are available
while (@devices = $sth->fetchrow){
($product,$spec_key)=@devices;
print"product = $product and speckey = $spec_key \n"; }
}

i***************************************
it works if you put a literal value of 'stdf' for $prod
but it fails when I try to use a variable.

Another point is if it were an integer the variable would work.

Question: How can I get this to work. I've used q// qw// qq// qx//

Sean

В списке pgsql-novice по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 'UNIQUE'
Следующее
От: douggorley@shaw.ca
Дата:
Сообщение: Re: perl and postgresql