Message158703
I agree this would be very handy, but the database engines I know which accept "bind variables" (Oracle, MySQL, JDBC) only accept simple types.
So to handle ?? it would be necessary to modify the SQL statement passed to the database server: "name in (?, ?, ?)".
This has some drawbacks IMO:
- One advantage of bind variables is that the SQL server sees the same statement for different invocations of execute() and thus can reuse computed data (parsed query, execution plan, etc) . The "??" placeholder would silently kill this optimization.
- cursor.executemany() would have to format and pass a different statement for each row, which would break the implementations that prepare the statement once and pass all the rows in a single call.
- cx_Oracle has a cursor.prepare(stmt) function which explicitly exposes the above mechanism; it could not work with "??".
Yes, the IN operator in SQL is difficult to address. I've tried several approaches to this, one of them was to create a temporary table and joint it in the main query... |
|
Date |
User |
Action |
Args |
2012-04-19 07:42:08 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, rhettinger |
2012-04-19 07:42:08 | amaury.forgeotdarc | set | messageid: <1334821328.01.0.499800399262.issue14619@psf.upfronthosting.co.za> |
2012-04-19 07:42:07 | amaury.forgeotdarc | link | issue14619 messages |
2012-04-19 07:42:07 | amaury.forgeotdarc | create | |
|