Skip to content

Commit

Permalink
updated for Nette 2.0 beta: exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 1, 2011
1 parent 508e863 commit ac1f45b
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 93 deletions.
16 changes: 8 additions & 8 deletions dibi/drivers/firebird.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('interbase')) {
throw new NotSupportedException("PHP extension 'interbase' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'interbase' is not loaded.");
}
}

Expand Down Expand Up @@ -170,7 +170,7 @@ public function getInsertId($sequence)
public function begin($savepoint = NULL)
{
if ($savepoint !== NULL) {
throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
throw new DibiNotSupportedException('Savepoints are not supported in Firebird/Interbase.');
}
$this->transaction = ibase_trans($this->resource);
$this->inTransaction = TRUE;
Expand All @@ -187,7 +187,7 @@ public function begin($savepoint = NULL)
public function commit($savepoint = NULL)
{
if ($savepoint !== NULL) {
throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
throw new DibiNotSupportedException('Savepoints are not supported in Firebird/Interbase.');
}

if (!ibase_commit($this->transaction)) {
Expand All @@ -208,7 +208,7 @@ public function commit($savepoint = NULL)
public function rollback($savepoint = NULL)
{
if ($savepoint !== NULL) {
throw new NotSupportedException('Savepoints are not supported in Firebird/Interbase.');
throw new DibiNotSupportedException('Savepoints are not supported in Firebird/Interbase.');
}

if (!ibase_rollback($this->transaction)) {
Expand Down Expand Up @@ -312,7 +312,7 @@ public function escape($value, $type)
*/
public function escapeLike($value, $pos)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand Down Expand Up @@ -410,7 +410,7 @@ public function fetch($assoc)
*/
public function seek($row)
{
throw new NotSupportedException("Firebird/Interbase do not support seek in result set.");
throw new DibiNotSupportedException("Firebird/Interbase do not support seek in result set.");
}


Expand Down Expand Up @@ -444,7 +444,7 @@ public function getResultResource()
*/
public function getResultColumns()
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand Down
8 changes: 4 additions & 4 deletions dibi/drivers/mssql.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('mssql')) {
throw new NotSupportedException("PHP extension 'mssql' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'mssql' is not loaded.");
}
}

Expand Down Expand Up @@ -189,7 +189,7 @@ public function getResource()
*/
public function getReflector()
{
throw new NotSupportedException;
throw new DibiNotSupportedException;
}


Expand Down Expand Up @@ -292,7 +292,7 @@ public function applyLimit(&$sql, $limit, $offset)
}

if ($offset) {
throw new NotImplementedException('Offset is not implemented.');
throw new DibiNotImplementedException('Offset is not implemented.');
}
}

Expand Down
12 changes: 6 additions & 6 deletions dibi/drivers/mssql2005.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver, IDibiResult


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('sqlsrv')) {
throw new NotSupportedException("PHP extension 'sqlsrv' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'sqlsrv' is not loaded.");
}
}

Expand Down Expand Up @@ -197,7 +197,7 @@ public function getResource()
*/
public function getReflector()
{
throw new NotSupportedException;
throw new DibiNotSupportedException;
}


Expand Down Expand Up @@ -300,7 +300,7 @@ public function applyLimit(&$sql, $limit, $offset)
}

if ($offset) {
throw new NotImplementedException('Offset is not implemented.');
throw new DibiNotImplementedException('Offset is not implemented.');
}
}

Expand All @@ -327,7 +327,7 @@ public function __destruct()
*/
public function getRowCount()
{
throw new NotSupportedException('Row count is not available for unbuffered queries.');
throw new DibiNotSupportedException('Row count is not available for unbuffered queries.');
}


Expand All @@ -351,7 +351,7 @@ public function fetch($assoc)
*/
public function seek($row)
{
throw new NotSupportedException('Cannot seek an unbuffered result set.');
throw new DibiNotSupportedException('Cannot seek an unbuffered result set.');
}


Expand Down
8 changes: 4 additions & 4 deletions dibi/drivers/mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver, IDibiResultDriv


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('mysql')) {
throw new NotSupportedException("PHP extension 'mysql' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'mysql' is not loaded.");
}
}

Expand Down Expand Up @@ -398,7 +398,7 @@ public function __destruct()
public function getRowCount()
{
if (!$this->buffered) {
throw new NotSupportedException('Row count is not available for unbuffered queries.');
throw new DibiNotSupportedException('Row count is not available for unbuffered queries.');
}
return mysql_num_rows($this->resultSet);
}
Expand Down Expand Up @@ -426,7 +426,7 @@ public function fetch($assoc)
public function seek($row)
{
if (!$this->buffered) {
throw new NotSupportedException('Cannot seek an unbuffered result set.');
throw new DibiNotSupportedException('Cannot seek an unbuffered result set.');
}

return mysql_data_seek($this->resultSet, $row);
Expand Down
2 changes: 1 addition & 1 deletion dibi/drivers/mysql.reflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function getIndexes($table)
*/
public function getForeignKeys($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}

}
8 changes: 4 additions & 4 deletions dibi/drivers/mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('mysqli')) {
throw new NotSupportedException("PHP extension 'mysqli' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'mysqli' is not loaded.");
}
}

Expand Down Expand Up @@ -394,7 +394,7 @@ public function __destruct()
public function getRowCount()
{
if (!$this->buffered) {
throw new NotSupportedException('Row count is not available for unbuffered queries.');
throw new DibiNotSupportedException('Row count is not available for unbuffered queries.');
}
return mysqli_num_rows($this->resultSet);
}
Expand Down Expand Up @@ -422,7 +422,7 @@ public function fetch($assoc)
public function seek($row)
{
if (!$this->buffered) {
throw new NotSupportedException('Cannot seek an unbuffered result set.');
throw new DibiNotSupportedException('Cannot seek an unbuffered result set.');
}
return mysqli_data_seek($this->resultSet, $row);
}
Expand Down
12 changes: 6 additions & 6 deletions dibi/drivers/odbc.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver, IDibiResultDrive


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('odbc')) {
throw new NotSupportedException("PHP extension 'odbc' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'odbc' is not loaded.");
}
}

Expand Down Expand Up @@ -133,7 +133,7 @@ public function getAffectedRows()
*/
public function getInsertId($sequence)
{
throw new NotSupportedException('ODBC does not support autoincrementing.');
throw new DibiNotSupportedException('ODBC does not support autoincrementing.');
}


Expand Down Expand Up @@ -314,7 +314,7 @@ public function applyLimit(&$sql, $limit, $offset)
$sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
}

if ($offset) throw new NotSupportedException('Offset is not implemented in driver odbc.');
if ($offset) throw new DibiNotSupportedException('Offset is not implemented in driver odbc.');
}


Expand Down Expand Up @@ -484,7 +484,7 @@ public function getColumns($table)
*/
public function getIndexes($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand All @@ -496,7 +496,7 @@ public function getIndexes($table)
*/
public function getForeignKeys($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}

}
18 changes: 9 additions & 9 deletions dibi/drivers/oracle.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver, IDibiResultDri


/**
* @throws NotSupportedException
* @throws DibiNotSupportedException
*/
public function __construct()
{
if (!extension_loaded('oci8')) {
throw new NotSupportedException("PHP extension 'oci8' is not loaded.");
throw new DibiNotSupportedException("PHP extension 'oci8' is not loaded.");
}
}

Expand Down Expand Up @@ -124,7 +124,7 @@ public function query($sql)
*/
public function getAffectedRows()
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand Down Expand Up @@ -269,7 +269,7 @@ public function escape($value, $type)
*/
public function escapeLike($value, $pos)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand Down Expand Up @@ -332,7 +332,7 @@ public function __destruct()
*/
public function getRowCount()
{
throw new NotSupportedException('Row count is not available for unbuffered queries.');
throw new DibiNotSupportedException('Row count is not available for unbuffered queries.');
}


Expand All @@ -356,7 +356,7 @@ public function fetch($assoc)
*/
public function seek($row)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand Down Expand Up @@ -437,7 +437,7 @@ public function getTables()
*/
public function getColumns($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand All @@ -449,7 +449,7 @@ public function getColumns($table)
*/
public function getIndexes($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}


Expand All @@ -461,7 +461,7 @@ public function getIndexes($table)
*/
public function getForeignKeys($table)
{
throw new NotImplementedException;
throw new DibiNotImplementedException;
}

}
Loading

0 comments on commit ac1f45b

Please sign in to comment.