Re: "'" in SQL INSERT statement

From: Alessio Bragadini <alessio(at)albourne(dot)com>
To: Markus Wagner <wagner(at)imsd(dot)uni-mainz(dot)de>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: "'" in SQL INSERT statement
Date: 2001-01-25 10:30:56
Message-ID: 3A700060.3FD31A6D@albourne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Markus Wagner wrote:

> I have some data that I wish to transfer into a database using perl/DBI.

If you use Perl DBI you should issue statements like
$dbh->do ('INSERT INTO table (field1, field2) VALUES (?,?)',
undef, $value1, $value2);

This binding takes care of quoting and escapes all characters that may
cause problems in the database backed (e.g. "that's" becomes "that''s"
etc.)

There is a DBI mailing list where you can find more info and support:
see <http://www.isc.org/dbi-lists.html>

--
Alessio F. Bragadini alessio(at)albourne(dot)com
APL Financial Services http://village.albourne.com
Nicosia, Cyprus phone: +357-2-755750

"It is more complicated than you think"
-- The Eighth Networking Truth from RFC 1925

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Brett W. McCoy 2001-01-25 10:49:01 Re: "'" in SQL INSERT statement
Previous Message Oliver Elphick 2001-01-25 10:19:39 Re: "'" in SQL INSERT statement