From 60559d9a9f239bd6c49772d5c6152afbebc3fc92 Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 22 Feb 2009 20:03:09 +0000 Subject: [PATCH] - added mysql_info support --- dibi/drivers/mysql.php | 16 ++++++++++++++++ dibi/drivers/mysqli.php | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) 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