cvs: pear /DB/DB mysqli.php
| From: | Daniel Convissor | Date: | Fri, 24 Dec 2004 19:56:33 +0000 |
| Subject: | cvs: pear /DB/DB mysqli.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-27808@lists.php.net to get a copy of this message | ||
danielc Fri Dec 24 14:56:33 2004 EDT
Modified files:
/pear/DB/DB mysqli.php
Log:
* $num_rows property not needed with mysqli.
* Correct case of one usage of numrows().
* Change mysqlRaiseError() to mysqliRaiseError().
http://cvs.php.net/diff.php/pear/DB/DB/mysqli.php?r1=1.34&r2=1.35&ty=u
Index: pear/DB/DB/mysqli.php
diff -u pear/DB/DB/mysqli.php:1.34 pear/DB/DB/mysqli.php:1.35
--- pear/DB/DB/mysqli.php:1.34 Fri Dec 17 11:52:43 2004
+++ pear/DB/DB/mysqli.php Fri Dec 24 14:56:32 2004
@@ -17,7 +17,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright 1997-2004 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version CVS: $Id: mysqli.php,v 1.34 2004/12/17 16:52:43 danielc Exp $
+ * @version CVS: $Id: mysqli.php,v 1.35 2004/12/24 19:56:32 danielc Exp $
* @link http://pear.php.net/package/DB
*/
@@ -51,7 +51,6 @@
var $phptype, $dbsyntax;
var $prepare_tokens = array();
var $prepare_types = array();
- var $num_rows = array();
var $transaction_opcount = 0;
var $autocommit = true;
var $fetchmode = DB_FETCHMODE_ORDERED; /* Default fetch mode */
@@ -269,7 +268,7 @@
$query = $this->modifyQuery($query);
if ($this->_db) {
if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+ return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
}
}
if (!$this->autocommit && $ismanip) {
@@ -277,24 +276,21 @@
$result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=0');
$result = @mysqli_query($this->connection, 'BEGIN');
if (!$result) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
}
$this->transaction_opcount++;
}
$result = @mysqli_query($this->connection, $query);
if (!$result) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
# this next block is still sketchy..
if (is_object($result)) {
- $numrows = $this->numrows($result);
+ $numrows = $this->numRows($result);
if (is_object($numrows)) {
return $numrows;
}
-# need to come up with different means for next line
-# since $result is object (int)$result won't fly...
-// $this->num_rows[(int)$result] = $numrows;
return $result;
}
return DB_OK;
@@ -358,7 +354,7 @@
if (!$errno) {
return null;
}
- return $this->mysqlRaiseError($errno);
+ return $this->mysqliRaiseError($errno);
}
if ($this->options['portability'] & DB_PORTABILITY_RTRIM) {
/*
@@ -386,9 +382,6 @@
*/
function freeResult($result)
{
-# need to come up with different means for next line
-# since $result is object (int)$result won't fly...
-// unset($this->num_rows[(int)$result]);
return @mysqli_free_result($result);
}
@@ -409,7 +402,7 @@
$cols = @mysqli_num_fields($result);
if (!$cols) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
return $cols;
@@ -429,7 +422,7 @@
{
$rows = @mysqli_num_rows($result);
if ($rows === null) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
return $rows;
}
@@ -459,14 +452,14 @@
if ($this->transaction_opcount > 0) {
if ($this->_db) {
if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+ return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
}
}
$result = @mysqli_query($this->connection, 'COMMIT');
$result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
$this->transaction_opcount = 0;
if (!$result) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
}
return DB_OK;
@@ -483,14 +476,14 @@
if ($this->transaction_opcount > 0) {
if ($this->_db) {
if (!@mysqli_select_db($this->connection, $this->_db)) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+ return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
}
}
$result = @mysqli_query($this->connection, 'ROLLBACK');
$result = @mysqli_query($this->connection, 'SET AUTOCOMMIT=1');
$this->transaction_opcount = 0;
if (!$result) {
- return $this->mysqlRaiseError();
+ return $this->mysqliRaiseError();
}
}
return DB_OK;
@@ -569,7 +562,7 @@
}
if ($result == 0) {
// Failed to get the lock, bail with a DB_ERROR_NOT_LOCKED error
- return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+ return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
}
// add the default value
@@ -682,7 +675,7 @@
if ($result == 0) {
// Failed to get the lock, can't do the conversion, bail
// with a DB_ERROR_NOT_LOCKED error
- return $this->mysqlRaiseError(DB_ERROR_NOT_LOCKED);
+ return $this->mysqliRaiseError(DB_ERROR_NOT_LOCKED);
}
$highest_id = $this->getOne("SELECT MAX(id) FROM ${seqname}");
@@ -768,7 +761,7 @@
}
// }}}
- // {{{ mysqlRaiseError()
+ // {{{ mysqliRaiseError()
/**
* Gather information about an error, then use that info to create a
@@ -780,7 +773,7 @@
* @see DB_common::errorCode()
* @see DB_common::raiseError()
*/
- function mysqlRaiseError($errno = null)
+ function mysqliRaiseError($errno = null)
{
if ($errno === null) {
if ($this->options['portability'] & DB_PORTABILITY_ERRORS) {
@@ -845,7 +838,7 @@
}
if (!is_a($id, 'mysqli_result')) {
- return $this->mysqlRaiseError(DB_ERROR_NEED_MORE_DATA);
+ return $this->mysqliRaiseError(DB_ERROR_NEED_MORE_DATA);
}
if ($this->options['portability'] & DB_PORTABILITY_LOWERCASE) {
@@ -945,7 +938,7 @@
$db->disconnect();
// XXX Fixme the mysql driver should take care of this
if (!@mysqli_select_db($this->connection,
$this->dsn['database'])) {
- return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+ return $this->mysqliRaiseError(DB_ERROR_NODBSELECTED);
}
}
return $sql;