We use doctrine 2 and want to write parameterised code like this:
attributes @> \'{' . $con->quote($attrId) . ':' . (int)$value . '}\'';
to have a query like this:
WHERE attributes @>'{"color":14}';
The "color"
is the custom (user chosen) name of an attribute. So I feel that quote()
is an appropriate function to shield it. But it wraps a parameter with single quotes, what makes the request syntax incorrect.
quoteIdentifier()
function wraps with double quotes, BUT I'm not sure if it's right to use it in this context.
How to build a safe code to get the request I need?