cvs: php4 /pear/DB mysql.php
| From: | Thomas V.V.Cox | Date: | Thu, 26 Jul 2001 00:09:19 +0000 |
| Subject: | cvs: php4 /pear/DB mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-345@lists.php.net to get a copy of this message | ||
cox Wed Jul 25 20:09:19 2001 EDT
Modified files:
/php4/pear/DB mysql.php
Log:
return useful error message on connect and non existant database
Index: php4/pear/DB/mysql.php
diff -u php4/pear/DB/mysql.php:1.66 php4/pear/DB/mysql.php:1.67
--- php4/pear/DB/mysql.php:1.66 Mon Jul 23 18:21:22 2001
+++ php4/pear/DB/mysql.php Wed Jul 25 20:09:18 2001
@@ -126,8 +126,9 @@
}
if ($dsninfo['database']) {
- if (!mysql_select_db($dsninfo['database'], $conn)) {
- return $this->mysqlRaiseError();
+ if (!@mysql_select_db($dsninfo['database'], $conn)) {
+ return $this->raiseError(DB_ERROR_NODBSELECTED, null, null,
+ null, mysql_error($conn));
}
}
@@ -383,7 +384,7 @@
$result->getCode() == DB_ERROR_NOSUCHTABLE) {
$repeat = 1;
$result = $this->createSequence($seq_name);
- // Since createSequence initializes the ID to be 1,
+ // Since createSequence initializes the ID to be 1,
// we do not need to retrieve the ID again (or we will get 2)
if (DB::isError($result)) {
return $result;
@@ -400,7 +401,7 @@
// application locks, but unlike LOCK TABLES, it does not abort
// the current transaction and is much less frequently used.
$result = $this->getOne("SELECT
GET_LOCK('${sqn}_seq_lock',10)");
- if (DB::isError($result)) {
+ if (DB::isError($result)) {
return $result;
}
if ($result == 0) {
@@ -421,11 +422,11 @@
return $result;
}
- // If another thread has been waiting for this lock,
+ // If another thread has been waiting for this lock,
// it will go thru the above procedure, but will have no
// real effect
$result = $this->getOne("SELECT
RELEASE_LOCK('${sqn}_seq_lock')");
- if (DB::isError($result)) {
+ if (DB::isError($result)) {
return $result;
}
@@ -513,7 +514,7 @@
$errno = $this->errorCode(mysql_errno($this->connection));
}
return $this->raiseError($errno, null, null, null,
- mysql_error($this->connection));
+ @mysql_error($this->connection));
}
// }}}