[DB-SIG] Towards a single parameter style

Kevin Jacobs jacobs@penguin.theopalgroup.com
Mon, 17 Feb 2003 17:17:38 -0500 (EST)


On Mon, 17 Feb 2003, Gerhard [unknown-8bit] H=E4ring wrote:
> * Kevin Jacobs <jacobs@penguin.theopalgroup.com> [2003-02-17 15:14 -050=
0]:
> > [...] here are a few things I'd rather get from DB-API 3000:
> >=20
> > connection =3D driver.connect(...)
> > statement =3D connection.prepare(sql)
> > print statement.description
> > cursor =3D statement.execute(param1, param2, param3)
> > cursor.fetchall()
>=20
> Looks good :-)
>=20
> > Of course, this syntax _requires_ that the backend support prepared
> > statements, instead of trying to piggyback it on to the regular execu=
te
> > syntax.
>=20
> How so? A driver could still emulate prepared statements, couldn't it?

Yes -- I suppose I meant that the driver or the backend have to support
this.  However, I'm of the opinion that emulating statements with bound
parameters is best left to the user, since they know enough about their S=
QL
to fake bound parameters.  The driver shouldn't be required to read their
minds and twist itself into knots to accomplish it (i.e., see my previous
messages on literal escaping and other nasty corner cases).

-Kevin

--=20
--
Kevin Jacobs
The OPAL Group - Enterprise Systems Architect
Voice: (216) 986-0710 x 19         E-mail: jacobs@theopalgroup.com
Fax:   (216) 986-0714              WWW:    http://www.theopalgroup.com