Posted by Sir Four at 4:47pm Aug 23 '09
You must sign in to send Sir Four a message
You must sign in to send Sir Four a message
Implementations of parameterized queries generally do a one-for-one substitution, which makes sense when we're talking about something like 'WHERE column = ?', however this has posed a nagging problem for me when it comes to the IN condition. If you know in advance exactly how many values you intend to pass to the query, you can do something like 'WHERE column IN (?, ?, ?)' and bind the three values. But trouble arises when the number of values is arbitrary. I'd like to do 'WHERE column IN (?)' and pass an arbitrary-length array of values. Has JDBC provided such functionality? Is it available in PHP (PDO)?
added on 5:11pm Aug 23 '09:
Also, I don't care for stored procedures, though I know it's possible to work around this problem that way.