function dpq in Migrate 6.2
Print a SQL string from a DBTNG Query object. Includes quoted arguments. Modified slightly from devel module.
Parameters
$query: A Query object.
$return: Whether to return or print the string. Default to FALSE.
$name: Optional name for identifying the output.
File
- ./
migrate.module, line 747
Code
function dpq($query, $return = FALSE, $name = NULL) {
$query
->preExecute();
$sql = (string) $query;
$quoted = array();
$connection = Database::getConnection();
foreach ((array) $query
->arguments() as $key => $val) {
$quoted[$key] = $connection
->quote($val);
}
$sql = strtr($sql, $quoted);
return $sql;
}