1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 13:17:58 +02:00

Implemented OracleDriver::getAffectedRows()

This commit is contained in:
Aleš Culek
2016-05-02 13:27:14 +02:00
committed by David Grudl
parent ddfd4a0f1a
commit 15e6d9f738

View File

@@ -44,6 +44,9 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
/** @var string Date and datetime format */ /** @var string Date and datetime format */
private $fmtDate, $fmtDateTime; private $fmtDate, $fmtDateTime;
/** @var int|FALSE Number of affected rows */
private $affectedRows = FALSE;
/** /**
* @throws Dibi\NotSupportedException * @throws Dibi\NotSupportedException
@@ -104,6 +107,7 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
*/ */
public function query($sql) public function query($sql)
{ {
$this->affectedRows = FALSE;
$res = oci_parse($this->connection, $sql); $res = oci_parse($this->connection, $sql);
if ($res) { if ($res) {
@oci_execute($res, $this->autocommit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT); @oci_execute($res, $this->autocommit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT);
@@ -112,6 +116,7 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
throw self::createException($err['message'], $err['code'], $sql); throw self::createException($err['message'], $err['code'], $sql);
} elseif (is_resource($res)) { } elseif (is_resource($res)) {
$this->affectedRows = oci_num_rows($res);
return $this->createResultDriver($res); return $this->createResultDriver($res);
} }
} else { } else {
@@ -147,7 +152,7 @@ class OracleDriver implements Dibi\Driver, Dibi\ResultDriver, Dibi\Reflector
*/ */
public function getAffectedRows() public function getAffectedRows()
{ {
throw new Dibi\NotImplementedException; return $this->affectedRows;
} }