1
0
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:
Olov Danielson 2010-01-10 17:14:32 +00:00
parent 9ede835f5e
commit d896a8c2d9
2 changed files with 22 additions and 1 deletions

View File

@ -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.

View File

@ -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;
}