From c24f2b870522ec5fa8a5c78a9ebc4787e4bacbbb Mon Sep 17 00:00:00 2001 From: David Grudl Date: Thu, 8 Jan 2009 00:42:01 +0000 Subject: [PATCH] - API cleanup: some method in DibiConnection marked as deprecated --- dibi/drivers/mssql.php | 2 -- dibi/drivers/mysql.php | 3 --- dibi/drivers/mysqli.php | 3 --- dibi/drivers/odbc.php | 3 --- dibi/drivers/oracle.php | 3 --- dibi/drivers/pdo.php | 3 --- dibi/drivers/postgre.php | 3 --- dibi/libs/DibiConnection.php | 21 +++++++++++++++++++++ 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/dibi/drivers/mssql.php b/dibi/drivers/mssql.php index fb9a6a65..c5005261 100644 --- a/dibi/drivers/mssql.php +++ b/dibi/drivers/mssql.php @@ -36,11 +36,9 @@ */ class DibiMsSqlDriver extends DibiObject implements IDibiDriver { - /** @var resource Connection resource */ private $connection; - /** @var resource Resultset resource */ private $resultSet; diff --git a/dibi/drivers/mysql.php b/dibi/drivers/mysql.php index 76d7ceb0..3b8be27a 100644 --- a/dibi/drivers/mysql.php +++ b/dibi/drivers/mysql.php @@ -42,15 +42,12 @@ */ class DibiMySqlDriver extends DibiObject implements IDibiDriver { - /** @var resource Connection resource */ private $connection; - /** @var resource Resultset resource */ private $resultSet; - /** @var bool Is buffered (seekable and countable)? */ private $buffered; diff --git a/dibi/drivers/mysqli.php b/dibi/drivers/mysqli.php index f1e2fd8a..2c4fa925 100644 --- a/dibi/drivers/mysqli.php +++ b/dibi/drivers/mysqli.php @@ -42,15 +42,12 @@ */ class DibiMySqliDriver extends DibiObject implements IDibiDriver { - /** @var mysqli Connection resource */ private $connection; - /** @var mysqli_result Resultset resource */ private $resultSet; - /** @var bool Is buffered (seekable and countable)? */ private $buffered; diff --git a/dibi/drivers/odbc.php b/dibi/drivers/odbc.php index 36c7704a..94773122 100644 --- a/dibi/drivers/odbc.php +++ b/dibi/drivers/odbc.php @@ -35,15 +35,12 @@ */ class DibiOdbcDriver extends DibiObject implements IDibiDriver { - /** @var resource Connection resource */ private $connection; - /** @var resource Resultset resource */ private $resultSet; - /** @var int Cursor */ private $row = 0; diff --git a/dibi/drivers/oracle.php b/dibi/drivers/oracle.php index 2d9fe586..6bac3140 100644 --- a/dibi/drivers/oracle.php +++ b/dibi/drivers/oracle.php @@ -35,15 +35,12 @@ */ class DibiOracleDriver extends DibiObject implements IDibiDriver { - /** @var resource Connection resource */ private $connection; - /** @var resource Resultset resource */ private $resultSet; - /** @var bool */ private $autocommit = TRUE; diff --git a/dibi/drivers/pdo.php b/dibi/drivers/pdo.php index b4e9bbe8..4af4ce2f 100644 --- a/dibi/drivers/pdo.php +++ b/dibi/drivers/pdo.php @@ -36,15 +36,12 @@ */ class DibiPdoDriver extends DibiObject implements IDibiDriver { - /** @var PDO Connection resource */ private $connection; - /** @var PDOStatement Resultset resource */ private $resultSet; - /** @var int|FALSE Affected rows */ private $affectedRows = FALSE; diff --git a/dibi/drivers/postgre.php b/dibi/drivers/postgre.php index 0f7b2b3d..5d23cbf4 100644 --- a/dibi/drivers/postgre.php +++ b/dibi/drivers/postgre.php @@ -36,15 +36,12 @@ */ class DibiPostgreDriver extends DibiObject implements IDibiDriver { - /** @var resource Connection resource */ private $connection; - /** @var resource Resultset resource */ private $resultSet; - /** @var bool Escape method */ private $escMethod = FALSE; diff --git a/dibi/libs/DibiConnection.php b/dibi/libs/DibiConnection.php index 266c492e..c0fe57c4 100644 --- a/dibi/libs/DibiConnection.php +++ b/dibi/libs/DibiConnection.php @@ -208,12 +208,25 @@ class DibiConnection extends DibiObject + /** + * Returns the connection resource. + * @return IDibiDriver + */ + final public function getDriver() + { + return $this->driver; + } + + + /** * Returns the connection resource. * @return resource + * @deprecated use getDriver()->getResource() */ final public function getResource() { + trigger_error('Deprecated: use getDriver()->getResource(...) instead.', E_USER_WARNING); return $this->driver->getResource(); } @@ -435,9 +448,11 @@ class DibiConnection extends DibiObject * @param string unescaped string * @param string type (dibi::FIELD_TEXT, dibi::FIELD_BOOL, ...) * @return string escaped and quoted string + * @deprecated */ public function escape($value, $type = dibi::FIELD_TEXT) { + trigger_error('Deprecated: use getDriver()->escape(...) instead.', E_USER_WARNING); $this->connect(); // MySQL & PDO require connection return $this->driver->escape($value, $type); } @@ -449,9 +464,11 @@ class DibiConnection extends DibiObject * @param string value * @param string type (dibi::FIELD_BINARY) * @return string decoded value + * @deprecated */ public function unescape($value, $type = dibi::FIELD_BINARY) { + trigger_error('Deprecated: use getDriver()->unescape(...) instead.', E_USER_WARNING); return $this->driver->unescape($value, $type); } @@ -461,9 +478,11 @@ class DibiConnection extends DibiObject * Delimites identifier (table's or column's name, etc.). * @param string identifier * @return string delimited identifier + * @deprecated */ public function delimite($value) { + trigger_error('Deprecated: use getDriver()->escape(...) instead.', E_USER_WARNING); return $this->driver->escape($value, dibi::IDENTIFIER); } @@ -475,9 +494,11 @@ class DibiConnection extends DibiObject * @param int $limit * @param int $offset * @return void + * @deprecated */ public function applyLimit(&$sql, $limit, $offset) { + trigger_error('Deprecated: use getDriver()->applyLimit(...) instead.', E_USER_WARNING); $this->driver->applyLimit($sql, $limit, $offset); }