lists in cx_Oracle

Daniel Dittmar daniel at dittmar.net
Tue May 10 18:43:53 EDT 2005


Andrew Dalke wrote:
> It sounds like you're saying that the interface is actually implemented
> by passing the execute string and a database-specific dictionary-like
> object; the latter created by the DB-API interface.

That's the way it's supposed to work. The program prepares a statement 
with placeholders only once and sends it with varying parameters to the 
database. That way, the statement has to be parsed by the database only 
once and the execution plan can be reused (with Oracle even between 
different sessions). It seems as if nothing ticks Oracle DBAs more off 
than if you're complaining about poor performance, but you're not using 
these prepared statements.

<History>
The :placeholder syntax comes from embedded SQL. You would write the 
names of actual program variables there and a precompiler would generate 
the code to 'bind' the program variables to SQL parameters. Embedded SQL 
has fallen out of favour and new APIs (ODBC, JDBC) use the question mark 
as the placeholder. The principle remains the same for many databases: 
the SQL string is sent unchanged to the database. Additionally, a list 
of actual values is sent for each execution.
</History>

Daniel



More information about the Python-list mailing list