cvs: php4 /pear/DB STATUS common.php odbc.php
| From: | Stig Bakken | Date: | Sun, 10 Dec 2000 02:31:26 +0000 |
| Subject: | cvs: php4 /pear/DB STATUS common.php odbc.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3050@lists.php.net to get a copy of this message | ||
ssb Sat Dec 9 18:31:26 2000 EDT
Modified files:
/php4/pear/DB STATUS common.php odbc.php
Log:
* implemented numCols and transactions for ODBC
* added "not capable" versions of affectedRows, errorNative, nextId
and createSequence to DB_common.
# all methods should exist in all backends now
# more backends need tests!
Index: php4/pear/DB/STATUS
diff -u php4/pear/DB/STATUS:1.10 php4/pear/DB/STATUS:1.11
--- php4/pear/DB/STATUS:1.10 Sat Dec 9 18:07:00 2000
+++ php4/pear/DB/STATUS Sat Dec 9 18:31:26 2000
@@ -13,13 +13,13 @@
FEATURE ibase msql mssql mysql oci8 odbc pgsql sybase
simpleQuery x x x T x x T x
-numCols x x x T x - T x
-numRows - x - T - - T -
-errorNative - - - T x - T -
+numCols x x x T x x T x
+numRows n x x T n n T n
+errorNative n n n T x n T n
prepare/execute x e e E e e E e
-sequences - - - E - - - -
-affectedRows - - - T x - T -
-fetch modes x x x T x - T x
-transactions x n n n x - x n
-auto-commit x n n n x - - n
+sequences n n n E n n n n
+affectedRows n n n T x n T n
+fetch modes x x x T x x T x
+transactions x n n n x x x n
+auto-commit x n n n x x x n
error mapping - - - x - x - -
Index: php4/pear/DB/common.php
diff -u php4/pear/DB/common.php:1.31 php4/pear/DB/common.php:1.32
--- php4/pear/DB/common.php:1.31 Sat Dec 9 18:07:00 2000
+++ php4/pear/DB/common.php Sat Dec 9 18:31:26 2000
@@ -21,7 +21,7 @@
//
/**
- * DB_common is a base class for DB implementations, and should be
+ * DB_common is a base class for DB implementations, and must be
* inherited by all such.
*/
@@ -795,6 +795,38 @@
// {{{ numRows()
function numRows($result)
+ {
+ return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+ }
+
+ // }}}
+ // {{{ affectedRows()
+
+ function affectedRows()
+ {
+ return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+ }
+
+ // }}}
+ // {{{ errorNative()
+
+ function errorNative()
+ {
+ return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+ }
+
+ // }}}
+ // {{{ nextId()
+
+ function nextId($seq_name, $ondemand = true)
+ {
+ return $this->raiseError(DB_ERROR_NOT_CAPABLE);
+ }
+
+ // }}}
+ // {{{ createSequence()
+
+ function createSequence($seq_name)
{
return $this->raiseError(DB_ERROR_NOT_CAPABLE);
}
Index: php4/pear/DB/odbc.php
diff -u php4/pear/DB/odbc.php:1.19 php4/pear/DB/odbc.php:1.20
--- php4/pear/DB/odbc.php:1.19 Sat Dec 9 18:07:00 2000
+++ php4/pear/DB/odbc.php Sat Dec 9 18:31:26 2000
@@ -26,9 +26,6 @@
//
// XXX ERRORMSG: The error message from the odbc function should
// be registered here.
-// XXX ADDREF: As soon as Zend/PHP gets support for returning
-// references, this return value should be made into
-// a reference.
//
require_once 'DB/common.php';
@@ -231,6 +228,51 @@
}
// }}}
+ // {{{ numCols()
+
+ function numCols($result)
+ {
+ $cols = @odbc_num_fields($result);
+ if (!$cols) {
+ return $this->raiseError($php_errormsg);
+ }
+ return $cols;
+ }
+
+ // }}}
+ // {{{ autoCommit()
+
+ function autoCommit($onoff = false)
+ {
+ if (!@odbc_autocommit($this->connection, $onoff)) {
+ return $this->raiseError($php_errormsg);
+ }
+ return DB_OK;
+ }
+
+ // }}}
+ // {{{ commit()
+
+ function commit()
+ {
+ if (!@odbc_commit($this->connection)) {
+ return $this->raiseError($php_errormsg);
+ }
+ return DB_OK;
+ }
+
+ // }}}
+ // {{{ rollback()
+
+ function rollback()
+ {
+ if (!@odbc_commit($this->connection)) {
+ return $this->raiseError($php_errormsg);
+ }
+ return DB_OK;
+ }
+
+ // }}}
}
// Local variables: