1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-06 14:16:39 +02:00

used NotSupportedException at appropriate places

This commit is contained in:
David Grudl
2011-01-25 18:23:30 +01:00
parent 9c52b8ea9d
commit 018b9da06d
11 changed files with 36 additions and 36 deletions

View File

@@ -44,12 +44,12 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('interbase')) { if (!extension_loaded('interbase')) {
throw new DibiDriverException("PHP extension 'interbase' is not loaded."); throw new NotSupportedException("PHP extension 'interbase' is not loaded.");
} }
} }
@@ -169,7 +169,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
public function begin($savepoint = NULL) public function begin($savepoint = NULL)
{ {
if ($savepoint !== NULL) { if ($savepoint !== NULL) {
throw new DibiDriverException('Savepoints are not supported in Firebird/Interbase.'); throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
} }
$this->transaction = ibase_trans($this->resource); $this->transaction = ibase_trans($this->resource);
$this->inTransaction = TRUE; $this->inTransaction = TRUE;
@@ -186,11 +186,11 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
public function commit($savepoint = NULL) public function commit($savepoint = NULL)
{ {
if ($savepoint !== NULL) { if ($savepoint !== NULL) {
throw new DibiDriverException('Savepoints are not supported in Firebird/Interbase.'); throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
} }
if (!ibase_commit($this->transaction)) { if (!ibase_commit($this->transaction)) {
DibiDriverException('Unable to handle operation - failure when commiting transaction.'); throw new DibiDriverException('Unable to handle operation - failure when commiting transaction.');
} }
$this->inTransaction = FALSE; $this->inTransaction = FALSE;
@@ -207,11 +207,11 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
public function rollback($savepoint = NULL) public function rollback($savepoint = NULL)
{ {
if ($savepoint !== NULL) { if ($savepoint !== NULL) {
throw new DibiDriverException('Savepoints are not supported in Firebird/Interbase.'); throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
} }
if (!ibase_rollback($this->transaction)) { if (!ibase_rollback($this->transaction)) {
DibiDriverException('Unable to handle operation - failure when rolbacking transaction.'); throw new DibiDriverException('Unable to handle operation - failure when rolbacking transaction.');
} }
$this->inTransaction = FALSE; $this->inTransaction = FALSE;
@@ -409,7 +409,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
*/ */
public function seek($row) public function seek($row)
{ {
throw new DibiDriverException("Firebird/Interbase do not support seek in result set."); throw new NotSupportedException("Firebird/Interbase do not support seek in result set.");
} }

View File

@@ -37,12 +37,12 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('mssql')) { if (!extension_loaded('mssql')) {
throw new DibiDriverException("PHP extension 'mssql' is not loaded."); throw new NotSupportedException("PHP extension 'mssql' is not loaded.");
} }
} }

View File

@@ -41,12 +41,12 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('sqlsrv')) { if (!extension_loaded('sqlsrv')) {
throw new DibiDriverException("PHP extension 'sqlsrv' is not loaded."); throw new NotSupportedException("PHP extension 'sqlsrv' is not loaded.");
} }
} }

View File

@@ -53,12 +53,12 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('mysql')) { if (!extension_loaded('mysql')) {
throw new DibiDriverException("PHP extension 'mysql' is not loaded."); throw new NotSupportedException("PHP extension 'mysql' is not loaded.");
} }
} }
@@ -397,7 +397,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
public function getRowCount() public function getRowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.'); throw new NotSupportedException('Row count is not available for unbuffered queries.');
} }
return mysql_num_rows($this->resultSet); return mysql_num_rows($this->resultSet);
} }
@@ -425,7 +425,7 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set.'); throw new NotSupportedException('Cannot seek an unbuffered result set.');
} }
return mysql_data_seek($this->resultSet, $row); return mysql_data_seek($this->resultSet, $row);

View File

@@ -54,12 +54,12 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('mysqli')) { if (!extension_loaded('mysqli')) {
throw new DibiDriverException("PHP extension 'mysqli' is not loaded."); throw new NotSupportedException("PHP extension 'mysqli' is not loaded.");
} }
} }
@@ -393,7 +393,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function getRowCount() public function getRowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.'); throw new NotSupportedException('Row count is not available for unbuffered queries.');
} }
return mysqli_num_rows($this->resultSet); return mysqli_num_rows($this->resultSet);
} }
@@ -421,7 +421,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set.'); throw new NotSupportedException('Cannot seek an unbuffered result set.');
} }
return mysqli_data_seek($this->resultSet, $row); return mysqli_data_seek($this->resultSet, $row);
} }

View File

@@ -42,12 +42,12 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiResultDrive
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('odbc')) { if (!extension_loaded('odbc')) {
throw new DibiDriverException("PHP extension 'odbc' is not loaded."); throw new NotSupportedException("PHP extension 'odbc' is not loaded.");
} }
} }
@@ -313,7 +313,7 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiResultDrive
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')'; $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
} }
if ($offset) throw new InvalidArgumentException('Offset is not implemented in driver odbc.'); if ($offset) throw new NotSupportedException('Offset is not implemented in driver odbc.');
} }

View File

@@ -44,12 +44,12 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('oci8')) { if (!extension_loaded('oci8')) {
throw new DibiDriverException("PHP extension 'oci8' is not loaded."); throw new NotSupportedException("PHP extension 'oci8' is not loaded.");
} }
} }

View File

@@ -42,12 +42,12 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('pdo')) { if (!extension_loaded('pdo')) {
throw new DibiDriverException("PHP extension 'pdo' is not loaded."); throw new NotSupportedException("PHP extension 'pdo' is not loaded.");
} }
} }
@@ -434,7 +434,7 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver, IDibiResultDriver
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
$row = @$this->resultSet->getColumnMeta($i); // intentionally @ $row = @$this->resultSet->getColumnMeta($i); // intentionally @
if ($row === FALSE) { if ($row === FALSE) {
throw new DibiDriverException('Driver does not support meta data.'); throw new NotSupportedException('Driver does not support meta data.');
} }
// PHP < 5.2.3 compatibility // PHP < 5.2.3 compatibility
// @see: http://php.net/manual/en/pdostatement.getcolumnmeta.php#pdostatement.getcolumnmeta.changelog // @see: http://php.net/manual/en/pdostatement.getcolumnmeta.php#pdostatement.getcolumnmeta.changelog

View File

@@ -43,12 +43,12 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver, IDibiResultDr
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('pgsql')) { if (!extension_loaded('pgsql')) {
throw new DibiDriverException("PHP extension 'pgsql' is not loaded."); throw new NotSupportedException("PHP extension 'pgsql' is not loaded.");
} }
} }

View File

@@ -51,12 +51,12 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiResultDri
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('sqlite')) { if (!extension_loaded('sqlite')) {
throw new DibiDriverException("PHP extension 'sqlite' is not loaded."); throw new NotSupportedException("PHP extension 'sqlite' is not loaded.");
} }
} }
@@ -326,7 +326,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function getRowCount() public function getRowCount()
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Row count is not available for unbuffered queries.'); throw new NotSupportedException('Row count is not available for unbuffered queries.');
} }
return sqlite_num_rows($this->resultSet); return sqlite_num_rows($this->resultSet);
} }
@@ -366,7 +366,7 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function seek($row) public function seek($row)
{ {
if (!$this->buffered) { if (!$this->buffered) {
throw new DibiDriverException('Cannot seek an unbuffered result set.'); throw new NotSupportedException('Cannot seek an unbuffered result set.');
} }
return sqlite_seek($this->resultSet, $row); return sqlite_seek($this->resultSet, $row);
} }

View File

@@ -46,12 +46,12 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver, IDibiResultDr
/** /**
* @throws DibiException * @throws NotSupportedException
*/ */
public function __construct() public function __construct()
{ {
if (!extension_loaded('sqlite3')) { if (!extension_loaded('sqlite3')) {
throw new DibiDriverException("PHP extension 'sqlite3' is not loaded."); throw new NotSupportedException("PHP extension 'sqlite3' is not loaded.");
} }
} }