Yes indeed!

Some bits and pieces are taken from an INI file, some from the user’s input.

Elements include table names, column names, and may be an arbitrarily 
structured (but legal) WHERE clause which might  include some variable names 
such as that date.

Meir

 

From: Perl [mailto:[email protected]] On Behalf Of Gabor Szabo
Sent: יום ה 31 יולי 2014 19:41
To: Perl in Israel
Subject: Re: [Israel.pm] Not understood behavior of 'eval'

 

Do I understand you correctly that you are trying to build and SQL statement on 
the fly?

Something like this?

 

my $sql = 'SELECT * FROM costumers WHERE';

my @params;

if ($day eq 'Sunday') {

   $sql .= ' date = ? ';

   push @params, $date;

}

....

 

$sth = $dbh->prepare($sql);

$sth->execute(@params);

 

 

Could you give a bit more context?

 

regards

   Gabor

 

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to