Commit 23d2950c authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #73 from stof/statement_interface_change

Statement interface change
parents 4a62347d d699a52e
...@@ -39,7 +39,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -39,7 +39,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
} }
} }
function prepare($sql) public function prepare($sql)
{ {
$stmt = @db2_prepare($this->_conn, $sql); $stmt = @db2_prepare($this->_conn, $sql);
if (!$stmt) { if (!$stmt) {
...@@ -47,8 +47,8 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -47,8 +47,8 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
} }
return new DB2Statement($stmt); return new DB2Statement($stmt);
} }
function query() public function query()
{ {
$args = func_get_args(); $args = func_get_args();
$sql = $args[0]; $sql = $args[0];
...@@ -57,7 +57,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -57,7 +57,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
return $stmt; return $stmt;
} }
function quote($input, $type=\PDO::PARAM_STR) public function quote($input, $type=\PDO::PARAM_STR)
{ {
$input = db2_escape_string($input); $input = db2_escape_string($input);
if ($type == \PDO::PARAM_INT ) { if ($type == \PDO::PARAM_INT ) {
...@@ -67,24 +67,24 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -67,24 +67,24 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
} }
} }
function exec($statement) public function exec($statement)
{ {
$stmt = $this->prepare($statement); $stmt = $this->prepare($statement);
$stmt->execute(); $stmt->execute();
return $stmt->rowCount(); return $stmt->rowCount();
} }
function lastInsertId($name = null) public function lastInsertId($name = null)
{ {
return db2_last_insert_id($this->_conn); return db2_last_insert_id($this->_conn);
} }
function beginTransaction() public function beginTransaction()
{ {
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_OFF); db2_autocommit($this->_conn, DB2_AUTOCOMMIT_OFF);
} }
function commit() public function commit()
{ {
if (!db2_commit($this->_conn)) { if (!db2_commit($this->_conn)) {
throw new DB2Exception(db2_conn_errormsg($this->_conn)); throw new DB2Exception(db2_conn_errormsg($this->_conn));
...@@ -92,7 +92,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -92,7 +92,7 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON); db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
} }
function rollBack() public function rollBack()
{ {
if (!db2_rollback($this->_conn)) { if (!db2_rollback($this->_conn)) {
throw new DB2Exception(db2_conn_errormsg($this->_conn)); throw new DB2Exception(db2_conn_errormsg($this->_conn));
...@@ -100,12 +100,12 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection ...@@ -100,12 +100,12 @@ class DB2Connection implements \Doctrine\DBAL\Driver\Connection
db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON); db2_autocommit($this->_conn, DB2_AUTOCOMMIT_ON);
} }
function errorCode() public function errorCode()
{ {
return db2_conn_error($this->_conn); return db2_conn_error($this->_conn);
} }
function errorInfo() public function errorInfo()
{ {
return array( return array(
0 => db2_conn_errormsg($this->_conn), 0 => db2_conn_errormsg($this->_conn),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment