[PYTHON DB-SIG] RE: Looking for examples of oracledb usage
Mon, 21 Apr 1997 15:26:14 -0700
Would you believe I was wondering what the oracledbmodule bind variable syntax
was the night before I got this email?
I have one question, though: I assume I can do :0 through :9 easily, but how
do I do more than 10 bind variables?
Harold Poskanzer Software Engineer
Infoseek Corporation email@example.com
2620 Augustine Dr #250 Phone: 408/567-2741
Santa Clara, CA 95054 http://www.infoseek.com/
Proof of Intelligent Life on the Net
> The :N syntax uses database facilities for "binding" the parameter
> values to the SQL statement, while the form you mention is simply
> altering the SQL statement that gets sent to the database. There are
> several benefits to using parameter binding:
> 1) you don't need to worry about escaping string values
> 2) certain types of values *can't* be specified in the SQL
> statement (typically, LONG/BLOB/IMAGE.. whatever you want to call it)
> 3) you can actually achieve higher efficiencies using parameter
> binding. The standard sequence of operations with a database is: parse
> the statement, bind parameters, execute the statement, fetch the
> results. With parameter binding, you can fill in values to the bound
> memory and re-execute the statement (skipping the parse/bind steps). By
> altering the SQL string, you have to go through all the steps again. The
> parse step is surprisingly expensive!
> You will see the use of "?" in some database interfaces rather than the
> :N syntax (which comes from Oracle, actually). The :N variety was chosen
> because binding positionally is quite handy in a variety of contexts.
> I hope that clears things up!
> -----Original Message-----
> From: Daniel Larsson
> Sent: Thursday, April 17, 1997 1:17 PM
> To: firstname.lastname@example.org
> Subject: Re: Looking for examples of oracledb usage
> Anthony Baxter wrote in article
> >something like
> >curs.execute("select * from db where blah = :1 and foo =
> >works for me.
> In general, how does this differ from using the standard string
> curs.execute("select * from db where blah = %d and foo = %d" %
> (123, 456))
> (I assume these examples are equivalent, but I'm asking for the
> >>>> Roy Smith wrote
> >> I'm looking for example of python code that uses the oracledb
> >> I've got simple stuff working, but havn't yet figured out how
> to do
> >> variable binding in an execute call. The documentation says,
> >> are specified in a database-specific notation that is based
> on the
> >> in the parameter tuple (position-based rather than
> name-based)", but
> >> not quite sure what all that means.
> DB-SIG - SIG on Tabular Databases in Python
> send messages to: email@example.com
> administrivia to: firstname.lastname@example.org
DB-SIG - SIG on Tabular Databases in Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org