logo       

cvs: pear /DB/DB mysql.php: msg#00348

Subject: cvs: pear /DB/DB mysql.php
cox             Tue Jun 18 20:41:06 2002 EDT

  Modified files:              
    /pear/DB/DB mysql.php 
  Log:
  Allow connect/use the MySQL driver without specifying any database
  
  
Index: pear/DB/DB/mysql.php
diff -u pear/DB/DB/mysql.php:1.4 pear/DB/DB/mysql.php:1.5
--- pear/DB/DB/mysql.php:1.4    Thu May 23 05:14:37 2002
+++ pear/DB/DB/mysql.php        Tue Jun 18 20:41:06 2002
@@ -16,7 +16,7 @@
 // | Author: Stig Bakken <ssb@xxxxxxx>                                    |
 // +----------------------------------------------------------------------+
 //
-// $Id: mysql.php,v 1.4 2002/05/23 09:14:37 cox Exp $
+// $Id: mysql.php,v 1.5 2002/06/19 00:41:06 cox Exp $
 //
 // Database independent query interface definition for PHP's MySQL
 // extension.
@@ -203,8 +203,10 @@
         $ismanip = DB::isManip($query);
         $this->last_query = $query;
         $query = $this->modifyQuery($query);
-        if (!@mysql_select_db($this->_db, $this->connection)) {
-            return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+        if ($this->_db) {
+            if (!@mysql_select_db($this->_db, $this->connection)) {
+                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+            }
         }
         if (!$this->autocommit && $ismanip) {
             if ($this->transaction_opcount == 0) {
@@ -413,8 +415,10 @@
     function commit()
     {
         if ($this->transaction_opcount > 0) {
-            if (!@mysql_select_db($this->_db, $this->connection)) {
-                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
             }
             $result = @mysql_query('COMMIT', $this->connection);
             $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
@@ -435,8 +439,10 @@
     function rollback()
     {
         if ($this->transaction_opcount > 0) {
-            if (!@mysql_select_db($this->_db, $this->connection)) {
-                return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+            if ($this->_db) {
+                if (!@mysql_select_db($this->_db, $this->connection)) {
+                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
+                }
             }
             $result = @mysql_query('ROLLBACK', $this->connection);
             $result = @mysql_query('SET AUTOCOMMIT=1', $this->connection);
@@ -504,9 +510,6 @@
     function nextId($seq_name, $ondemand = true)
     {
         $seqname = $this->getSequenceName($seq_name);
-        if (!@mysql_select_db($this->_db, $this->connection)) {
-            return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED);
-        }
         do {
             $repeat = 0;
             $this->pushErrorHandling(PEAR_ERROR_RETURN);
@@ -685,8 +688,7 @@
 
     function modifyLimitQuery($query, $from, $count)
     {
-        $query = $query . " LIMIT $from, $count";
-        return $query;
+        return $query . " LIMIT $from, $count";
     }
 
     // }}}
@@ -847,4 +849,4 @@
     // binmode
 }
 
-?>
+?>
\ No newline at end of file



-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe