Closed philoye closed 11 years ago
Hi Phil,
Sorry I've been a bit slow responding to these issues - hoping to catch up in the next couple of weeks.
Pretty sure I know what's causing that problem, but will need a bit of thought to fix.
Cheers
Jamie
any update on this issue? running into a similar problem.
Ok, I came up with a solution. Before replacing %s, I replace all % with %. Works like a charm.
Replace function _log_query with the function below.
protected static function _log_query($query, $parameters) {
// If logging is not enabled, do nothing
if (!self::$_config['logging']) {
return false;
}
if (count($parameters) > 0) {
// Escape the parameters
$parameters = array_map(array(self::$_db, 'quote'), $parameters);
// Replace placeholders in the query for vsprintf
$query = str_replace("%", "%", $query);
$query = str_replace("?", "%s", $query);
// Replace the question marks in the query with the parameters
$bound_query = vsprintf($query, $parameters);
} else {
$bound_query = $query;
}
self::$_last_query = $bound_query;
self::$_query_log[] = $bound_query;
return true;
}
This is fixed in commit 84bd58f902d93970a6626c2e3d360eed09a4b174
I'm running in an issue that only manifests when logging is on:
I get a php warning:
A little examination reveals that the $parameters array in _log_query() function gets an extra item that is undefined. Not sure what is happening though. It doesn't happen with a simpler expression, like COUNT().