freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Tom Samplonius <tom AT sdf.com>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: 4.2 limitation...
- Date: Tue, 2 Jan 2001 10:52:56 -0800 (PST)
On Tue, 2 Jan 2001, mjn wrote:
> $state="ca";
> my $sth = $dbh->prepare('SELECT * FROM authors WHERE state = $state');
>
> All of the variable syntax itterations that I know have failed...
As has been mentioned, single quoted strings are not expanded. That is
just the way Perl works.
Plus, you aren't quoting the string. It must be a valid SQL statement,
and SQL strings must be quoted:
$state="ca";
my $sth = $dbh->prepare("SELECT * FROM authors WHERE state = \"$state\"");
BTW, using "*" in SELECT is never a good idea. If colums are added, or
moved about, you must rewrite your code. An explicit column list is
always best.
Tom
-
4.2 limitation...,
mjn, 01/02/2001
- <Possible follow-up(s)>
- Re: 4.2 limitation..., Mark Schaal, 01/02/2001
- Re: 4.2 limitation..., Tom Samplonius, 01/02/2001
- Re: 4.2 limitation..., mjn, 01/02/2001
- Re: 4.2 limitation..., Michael Peppler, 01/02/2001
- Re: 4.2 limitation..., Roger Burton West, 01/02/2001
- Re: 4.2 limitation..., Michael Peppler, 01/02/2001
- Re: 4.2 limitation..., mjn, 01/04/2001
- Re: 4.2 limitation..., Michael Peppler, 01/04/2001
Archive powered by MHonArc 2.6.24.