Skip site navigation (1) Skip section navigation (2)

perl and postgresql

From: "Sugrue, Sean" <sean(dot)sugrue(at)analog(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: perl and postgresql
Date: 2003-03-17 16:39:53
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

I am trying to execute the following query within perl


use DBI;


$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)){

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

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


pgsql-novice by date

Next:From: douggorleyDate: 2003-03-17 16:55:11
Subject: Re: perl and postgresql
Previous:From: Tom LaneDate: 2003-03-17 14:51:45
Subject: Re: 'UNIQUE'

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group