Re: [PROPOSAL] DML value format - Mailing list pgsql-general

From Michael Glaesemann
Subject Re: [PROPOSAL] DML value format
Date
Msg-id 97567662-EA91-43A4-9D10-2FD01A1C8649@seespotcode.net
Whole thread Raw
In response to [PROPOSAL] DML value format  (Alejandro Torras <atec_post@yahoo.es>)
List pgsql-general
On Aug 10, 2007, at 5:56 , Alejandro Torras wrote:

> Is there some way to put values in a INSERT statement
> without taking care of apostrophes?
>
> In example:
> INSERT INTO persons VALUES ('Harry', 'O'Callaghan');

This is pretty much a solved problem: don't interpolate into SQL
statements. Use bind parameters (and prepared statements, if you have
them) instead. For example

sth = dbh.prepare "INSERT INTO persons (given_name, family_name)
VALUES (?, ?)"
sth.execute("Harry", "O'Callaghan")


Michael Glaesemann
grzm seespotcode net



pgsql-general by date:

Previous
From: Brad Nicholson
Date:
Subject: Cluster and MVCC
Next
From: Guido Neitzer
Date:
Subject: Re: Database Select Slow