mirror of
https://github.com/dg/dibi.git
synced 2025-02-24 10:53:17 +01:00
DibiConnection: inTransaction() is back, implemented in drivers
This commit is contained in:
parent
c37475838f
commit
d61bd79982
@ -156,7 +156,6 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver
|
||||
public function getInsertId($sequence)
|
||||
{
|
||||
return ibase_gen_id($sequence, 0, $this->connection);
|
||||
//throw new NotSupportedException('Firebird/InterBase does not support autoincrementing.');
|
||||
}
|
||||
|
||||
|
||||
@ -220,6 +219,17 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
return $this->inTransaction;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return resource
|
||||
|
@ -170,6 +170,17 @@ class DibiMsSqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('MSSQL driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -168,6 +168,17 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('MSSQL 2005 driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -247,6 +247,17 @@ class DibiMySqlDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
return (bool) mysql_fetch_field(mysql_query('SELECT @@autocommit', $this->connection));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -231,6 +231,17 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
return (bool) mysqli_fetch_field_direct(mysqli_query($this->connection, 'SELECT @@autocommit'), 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mysqli
|
||||
|
@ -178,6 +178,17 @@ class DibiOdbcDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
return (bool) odbc_autocommit($this->connection);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -186,6 +186,17 @@ class DibiOracleDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('Oracle driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -197,6 +197,17 @@ class DibiPdoDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
return (bool) $this->connection->getAttribute(PDO::ATTR_AUTOCOMMIT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return PDO
|
||||
|
@ -207,6 +207,17 @@ class DibiPostgreDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('PostgreSQL driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -193,6 +193,17 @@ class DibiSqliteDriver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('SQLite driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -183,6 +183,17 @@ class DibiSqlite3Driver extends DibiObject implements IDibiDriver
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
throw new NotSupportedException('SQLite3 driver does not support transaction testing.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
@ -452,11 +452,13 @@ class DibiConnection extends DibiObject
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
public function inTransaction()
|
||||
{
|
||||
trigger_error('Deprecated: use "SELECT @@autocommit" query instead.', E_USER_WARNING);
|
||||
$this->connect();
|
||||
return $this->driver->inTransaction();
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,6 +145,12 @@ interface IDibiDriver
|
||||
*/
|
||||
function rollback($savepoint = NULL);
|
||||
|
||||
/**
|
||||
* Is in transaction?
|
||||
* @return bool
|
||||
*/
|
||||
function inTransaction();
|
||||
|
||||
/**
|
||||
* Returns the connection resource.
|
||||
* @return mixed
|
||||
|
Loading…
x
Reference in New Issue
Block a user