Thanks to those who responded. However, this thread is going away from
what I really asked... not how to quote a string, but to confirm
whether or not SQLite had any idiosyncrasies related to string-quoting
other than the normal "escape single-quotes within the string."
Btw, I am using $dbh->quote.
On Jun 9, 2005, at 1:02 PM, Dennis Cote wrote:
Clark Christensen wrote:
IOW, something like.
$sql = "update t1 set a = ?";
$string = $dbh->quote( qq(some long string; has many
'single quotes') );
$sth = $dbh->prepare($sql);
$rc = $sth->execute($string);
will probably eliminate both the prepare() error, and an
UPDATE error later.
-Clark
Clark,
The arguments passed to sqlite as parameters should not be quoted.
These strings do not pass through the parser, they are used as literal
values when the SQL statement is executed. If you do quote this
string, the quotes will be included in the value of field a in your
database.
You'll have to excuse my PERL (it's not a language I use)... but if
arguments to execute() are passed as parameters to sqlite then you
should do something like this.
$sql = "update t1 set a = ?";
$string = "some long string; has many 'single quotes'";
$sth = $dbh->prepare($sql);
$rc = $sth->execute($string);
HTH
Dennis Cote
--
Puneet Kishor