|
|
sybperl-l Archive
Up Prev Next
From: "Kiriakos Georgiou" <kiriakos dot georgiou at nrl dot navy dot mil>
Subject: RE: using sybperl, how to insert data that contains a quote with in it
Date: Jan 5 2001 4:54PM
DBI/DBD-Sybase has the very cool quote function so you can do things
like:
$dbh->do(sprintf "INSERT INTO table (a, b) values(%s, %s)",
$dbh->quote($a), $dbh->quote($b));
If sybperl lacks this function (I don't use sybperl) you probably want
to define your own and call it like above.
-Kiriakos
-----Original Message-----
From: owner-SYBPERL-L@list.cren.net
[mailto:owner-SYBPERL-L@list.cren.net]On Behalf Of Michael Peppler
Sent: Friday, January 05, 2001 10:54 AM
To: SybPerl Discussion List
Subject: Re: using sybperl, how to insert data that contains a quote
with in it
Klein, Shoshana R writes:
> Below is my sql statement to insert data into a table.
> the variable $in_name contains on occasion a single quote for
example john
> o'brien.
Double the quotes that you want to escape:
$in_name =~ s/'/''/g;
Michael
--
Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
http://www.mbay.net/~mpeppler - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|