mirror of
https://github.com/friendica/friendica
synced 2025-04-25 16:30:10 +00:00
Bugfix: dba::num_rows hadn't checked the object variable
This commit is contained in:
parent
9f62dd8627
commit
83e4141639
2 changed files with 85 additions and 25 deletions
|
@ -521,6 +521,16 @@ class dba {
|
|||
logger('Parameter mismatch. Query "'.$sql.'" - Parameters '.print_r($args, true), LOGGER_DEBUG);
|
||||
}
|
||||
|
||||
// beautify the SQL query - useful for "SHOW PROCESSLIST"
|
||||
// This is safe because we bind the parameters later.
|
||||
// The parameter values aren't part of the SQL.
|
||||
$search = array("\n", "\r", " ");
|
||||
$replace = array(' ', ' ', ' ');
|
||||
do {
|
||||
$oldsql = $sql;
|
||||
$sql = str_replace($search, $replace, $sql);
|
||||
} while ($oldsql != $sql);
|
||||
|
||||
$sql = self::$dbo->any_value_fallback($sql);
|
||||
|
||||
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
|
||||
|
@ -708,6 +718,9 @@ class dba {
|
|||
* @return int Number of rows
|
||||
*/
|
||||
static public function num_rows($stmt) {
|
||||
if (!is_object($stmt)) {
|
||||
return 0;
|
||||
}
|
||||
switch (self::$dbo->driver) {
|
||||
case 'pdo':
|
||||
return $stmt->rowCount();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue