yajra / pdo-via-oci8

PHP PDO_OCI functions via OCI8 extension
Other
88 stars 61 forks source link

Question mark in string literal is replaced with pseudo named parameter #37

Closed senojj closed 8 years ago

senojj commented 8 years ago

The way this library currently uses preg_replace on the statement, there is no way to use a question mark within a string literal in a query due to it being replaced by a named parameter in the prepare function.

Given a query like select 'http://www.test.com/?id=' || usr.id url from users usr the question mark would be replaced with a named parameter like ":p0".

Would it not be best to only match on question marks that are not contained within single quotes?

yajra commented 8 years ago

@jjware good catch. It does indeed change ? into :p0. If you can, please submit a PR. Will try to look at this more when I had the chance. Thanks!