mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-01-31 16:52:20 +01:00
Added rowcount function to db
This commit is contained in:
parent
9ede835f5e
commit
d896a8c2d9
21
ykval-db.php
21
ykval-db.php
@ -353,10 +353,31 @@ or false on failure.
|
||||
return $this->query($query, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function to do a custom query on database connection
|
||||
*
|
||||
* @param string $query Database query
|
||||
* @return mixed
|
||||
*
|
||||
*/
|
||||
public function customQuery($query)
|
||||
{
|
||||
return $this->query($query, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to do a custom query on database connection
|
||||
*
|
||||
* @return int number of rows affected by last statement or 0 if database connection is not functional.
|
||||
*
|
||||
*/
|
||||
public function rowCount()
|
||||
{
|
||||
if($this->dbh) return $this->dbh->rowCount();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* helper function used to get rows from Db table in reversed order.
|
||||
* defaults to obtaining 1 row.
|
||||
|
@ -210,7 +210,7 @@ class SyncLib
|
||||
error_log("ykval-synclib:critical: failed to update internal DB with new counters");
|
||||
return false;
|
||||
} else {
|
||||
if (mysql_affected_rows()>0) $this->log("notice", "updated database ", $params);
|
||||
if ($this->db->rowCount()>0) $this->log("notice", "updated database ", $params);
|
||||
else $this->log('notice', 'database not updated', $params);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user