1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 00:24:19 +02:00

refactoring in drivers

This commit is contained in:
David Grudl
2008-09-04 18:18:58 +00:00
parent 52d2ecf5b0
commit f935968aa7
5 changed files with 43 additions and 83 deletions

View File

@@ -122,7 +122,8 @@ class DibiOracleDriver extends /*Nette::*/Object implements IDibiDriver
throw new DibiDriverException($err['message'], $err['code'], $sql);
}
} else {
$this->throwException($sql);
$err = oci_error($this->connection);
throw new DibiDriverException($err['message'], $err['code'], $sql);
}
return is_resource($this->resultSet) ? clone $this : NULL;
@@ -174,7 +175,8 @@ class DibiOracleDriver extends /*Nette::*/Object implements IDibiDriver
public function commit()
{
if (!oci_commit($this->connection)) {
$this->throwException();
$err = oci_error($this->connection);
throw new DibiDriverException($err['message'], $err['code']);
}
$this->autocommit = TRUE;
}
@@ -189,7 +191,8 @@ class DibiOracleDriver extends /*Nette::*/Object implements IDibiDriver
public function rollback()
{
if (!oci_rollback($this->connection)) {
$this->throwException();
$err = oci_error($this->connection);
throw new DibiDriverException($err['message'], $err['code']);
}
$this->autocommit = TRUE;
}
@@ -339,19 +342,6 @@ class DibiOracleDriver extends /*Nette::*/Object implements IDibiDriver
/**
* Converts database error to DibiDriverException.
*
* @throws DibiDriverException
*/
protected function throwException($sql = NULL)
{
$err = oci_error($this->connection);
throw new DibiDriverException($err['message'], $err['code'], $sql);
}
/**
* Returns the connection resource.
*