From: Brendan McKenna <brendan@w3s.ie>
To: pgsql-interfaces@hub.org
Subject: Dumb Perl-related question
Date: Thu, 17 Jun 1999 18:33:03 +0000
Message-ID: <199906171726.SAA17199@w3s.ie> (raw)
Hi,
This question is so dumb that I am embarassed to ask it, but I can't
seem to figure it out myself. I have a select statement with a where clause,
where I am trying to select all values from the database that match a string
literal. Only whenever I try to specify a string literal in the query, it
gives me a syntax error on the first word in the literal.
What I'm doing looks like this:
$query = "select recipe_name, occasion, num_served, prep_time, " .
"freezable, instructions " .
"from recipe " .
"where recipe_name = '$recipe';";
$result = $dbconn->exec($query);
$rstatus = $result->resultStatus;
if ($rstatus != PGRES_TUPLES_OK && $rstatus != PGRES_EMPTY_QUERY) {
croak "getRecipe: Database error during query: " .
$dbconn->errorMessage;
}
Every time, it prints out the following error:
getRecipeEquipment: Database error during query: ERROR: parser: parse error at or near "no" at ./recipeDisplay line 33
The recipe name I am using is 'No Such Recipe'.
There would only be one row ever returned, since recipe_name is the
primary key of the recipe table.
I am using perl 5.005_55, postgreSQL 6.4.2 (with the Pg module which
is distributed with it).
I have tried every different type of quote that my keyboard will
allow me to enter, casts, you name it, I think I've tried it. Well,
obviously not, since I am certain that this MUST work somehow or another.
About half of the things I've tried work fine in psql, just not in the Perl
interface.
Any help would be greatly appreciated.
Brendan
--
Brendan McKenna
Technical Director Phone: +353-(0)61-338177 x4143
W3 Services Ltd. Fax: +353-(0)61-338065
Innovation Centre Email: brendan@w3s.ie
National Technological Park
Limerick
Ireland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: brendan@w3s.ie, pgsql-interfaces@hub.org
Subject: Re: Dumb Perl-related question
In-Reply-To: <199906171726.SAA17199@w3s.ie>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox