
October 26th, 2012, 12:44 AM
|
 |
Contributing User
|
|
Join Date: Aug 2002
Location: Queensland, Australia
|
|
|
Match string not surround by quotes
I need to do a string replacement within an SQL statement but only where the the pattern does not occur within a text string. This is to compensate for PHP PDOs lack of native functions for construction a CSV of placeholder in an IN statement.
So I might have a query like:
SELECT * FROM table where colId IN(XX).
I would then search for "XX" and replace it with a generated string to produce
SELECT * FROM table WHERE colId IN(?, ?, ?)
That part is easy.
What I want to avoid is:
SELECT * from table WHERE colDesc "Hello XX World"
becoming
SELECT * FROM table WHERE colDesc "Hello ?, ?, ? World"
__________________
Ooh, they have the Internet on computers now!
|