public Connection::prepareQuery($query)
Prepares a query string and returns the prepared statement.
This method caches prepared statements, reusing them when possible. It also prefixes tables names enclosed in curly-braces.
$query: The query string as SQL, with curly-braces surrounding the table names.
\Drupal\Core\Database\StatementInterface A PDO prepared statement ready for its execute() method.
Overrides Connection::prepareQuery
public function prepareQuery($query) { // mapConditionOperator converts LIKE operations to ILIKE for consistency // with MySQL. However, Postgres does not support ILIKE on bytea (blobs) // fields. // To make the ILIKE operator work, we type-cast bytea fields into text. // @todo This workaround only affects bytea fields, but the involved field // types involved in the query are unknown, so there is no way to // conditionally execute this for affected queries only. return parent::prepareQuery(preg_replace('/ ([^ ]+) +(I*LIKE|NOT +I*LIKE) /i', ' ${1}::text ${2} ', $query)); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Database!Driver!pgsql!Connection.php/function/Connection::prepareQuery/8.1.x