Add reset/check for query call count

Whenever a query is executed without the db_return method and it is a
select query, then it is counted and if it is over a max value it will
return false and terminate.

With those functions that counter value can be checked and reset.

To be used carefully. It is recommended to rather make often called
queries with the same values prepare/execute style instead of resetting
the count.
This commit is contained in:
Clemens Schwaighofer
2014-12-09 14:04:14 +09:00
parent fa6856eb2a
commit c6709f6782

View File

@@ -758,6 +758,29 @@
// PUBLIC METHODS
// *************************************************************
// METHOD db_reset_query_called
// PARAMS query
// RETURN none
// DESC resets the call times for the max query called to 0
// USE CAREFULLY: rather make the query prepare -> execute
public function db_reset_query_called($query)
{
$this->query_called[md5($query)] = 0;
}
// METHOD db_get_query_called
// PARAMS query
// RETURN count of query called
// DESC gets how often a query was called already
public function db_get_query_called($query)
{
$md5 = md5($query);
if ($this->query_called[$md5])
return $this->query_called[$md5];
else
return 0;
}
// METHOD db_close
// PARAMS none
// RETURN none