This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients amaury.forgeotdarc, rhettinger
Date 2012-04-19.07:42:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334821328.01.0.499800399262.issue14619@psf.upfronthosting.co.za>
In-reply-to
Content
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...
History
Date User Action Args
2012-04-19 07:42:08amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, rhettinger
2012-04-19 07:42:08amaury.forgeotdarcsetmessageid: <1334821328.01.0.499800399262.issue14619@psf.upfronthosting.co.za>
2012-04-19 07:42:07amaury.forgeotdarclinkissue14619 messages
2012-04-19 07:42:07amaury.forgeotdarccreate