cvs: php4 /pear/DB oci8.php
| From: | James L. Pine | Date: | Mon, 31 Jul 2000 19:55:32 +0000 |
| Subject: | cvs: php4 /pear/DB oci8.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-998@lists.php.net to get a copy of this message | ||
jlp Mon Jul 31 12:55:32 2000 EDT
Modified files:
/php4/pear/DB oci8.php
Log:
added affectedRows, which takes no arguements and returns the number of rows affected by the last
query. if the query was a select, returns 0.
Index: php4/pear/DB/oci8.php
diff -u php4/pear/DB/oci8.php:1.4 php4/pear/DB/oci8.php:1.5
--- php4/pear/DB/oci8.php:1.4 Mon Jul 24 01:24:14 2000
+++ php4/pear/DB/oci8.php Mon Jul 31 12:55:32 2000
@@ -38,6 +38,7 @@
var $select_query = array();
var $prepare_types = array();
var $autoCommit = 1;
+ var $last_stmt = false;
// }}}
@@ -133,6 +134,7 @@
if (!$success) {
return new DB_Error();
}
+ $this->last_stmt=$result;
// Determine which queries that should return data, and which
// should return an error code only.
if (preg_match('/(SELECT|SHOW)/i', $query)) {
@@ -170,6 +172,7 @@
if (!$success) {
return new DB_Error();
}
+ $this->last_stmt=$result;
// Determine which queries that should return data, and which
// should return an error code only.
if (preg_match('/(SELECT|SHOW)/i', $query)) {
@@ -371,6 +374,7 @@
if (!$success) {
return new DB_Error();
}
+ $this->last_stmt=$stmt;
if ($this->select_query[$stmt]) {
return $stmt;
}
@@ -427,6 +431,26 @@
return new DB_Error();
}
return DB_OK;
+ }
+
+ // }}}
+ // {{{ affectedRows()
+
+ /**
+ * Gets the number of rows affected by the last query.
+ * if the last query was a select, returns 0.
+ *
+ * @return number of rows affected by the last query or DB_ERROR
+ */
+ function affectedRows() {
+ if ($this->last_stmt === false) {
+ return new DB_Error();
+ }
+ $result = OCIRowCount($this->last_stmt);
+ if ($result === false) {
+ return new DB_Error();
+ }
+ return $result;
}
// }}}