--- Puneet Kishor <[EMAIL PROTECTED]> wrote:
> While I await some insight into my previously posted
> "database locking"
> problem, I have a question regarding quoting text.
>
> Does SQLite have any issues with anything other than
> single-quotes? For
> example, with colon, or semi-colon?
>
> For example, I find occasional complaints if I try to
> update/insert a
> string like --
>
> $text = 'Some long-winded text with lot''s of different
> things like:
>
> * lists
> * more lists
>
> text with semi-colon; and even such: stuff.';
>
> UPDATE tbl SET col = $text WHERE ...
>
> causes error to effect that sql prepare failed (again,
> Perl/DBI
> specific errors).
>
>
> --
> Puneet Kishor
>
>
I think your $dbh->prepare() would be likely to fail if the
value you're updating isn't properly quoted for the SQL
statement.
The Perl DBI lets you get past this to some extent by
allowing you to use replaceable vars in the prepared
statement, and passing those vars as args to
$dbh->execute(). DBI also offers a quote() method against
the $dbh that could help avoid problems executing a
prepared stmt.
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