diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index 7d02f657..f98484f3 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -178,6 +178,22 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver + /** + * Retrieves information about the most recently executed query. + * @return array + */ + public function getInfo() + { + $res = array(); + preg_match_all('#(.+?): +(\d+) *#', mysql_info($this->connection), $matches, PREG_SET_ORDER); + foreach ($matches as $m) { + $res[$m[1]] = (int) $m[2]; + } + return $res; + } + + + /** * Gets the number of affected rows by the last INSERT, UPDATE or DELETE query. * @return int|FALSE number of rows or FALSE on error diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index 9ddad7bb..078aed5b 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -162,6 +162,22 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver + /** + * Retrieves information about the most recently executed query. + * @return array + */ + public function getInfo() + { + $res = array(); + preg_match_all('#(.+?): +(\d+) *#', mysqli_info($this->connection), $matches, PREG_SET_ORDER); + foreach ($matches as $m) { + $res[$m[1]] = (int) $m[2]; + } + return $res; + } + + + /** * Gets the number of affected rows by the last INSERT, UPDATE or DELETE query. * @return int|FALSE number of rows or FALSE on error