dp.cx blog

Posted on

Filed under php, and zend-db

This is for my own edification in the future, but if you're looking for a non-escaped string as a parameter to a query, it's not Zend\DB\Raw that you're looking for, as that doesn't exist.

What you're looking for is new \Zend\Db\Sql\Expression() to handle those raw strings. This prevents issues like

INNER JOIN x ON a.val = x.val AND x.val = 10`

becoming

INNER JOIN `x` ON `a`.`val` = `x`.`val` AND `x`.`val` = `10`