CVS update: /cowiki/includes/cowiki/class/dao/
[email protected] 3 May 2005 01:02:37 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/05/02 18:02:37 Modified: cowiki/includes/cowiki/class/dao/class.StorageMySQLi.php cowiki/includes/cowiki/class/dao/class.StorageMySQL.php Log: Refactoring File Changes: Directory: /cowiki/includes/cowiki/class/dao/ ============================================= File [changed]: class.StorageMySQLi.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/dao/class.StorageMySQLi.php?r1=1.11&r2=1.12 Delta lines: +14 -13 --------------------- --- class.StorageMySQLi.php 3 May 2005 00:44:55 -0000 1.11 +++ class.StorageMySQLi.php 3 May 2005 01:02:35 -0000 1.12 @@ -2,7 +2,7 @@ /** * - * $Id: class.StorageMySQLi.php,v 1.11 2005/05/03 00:44:55 dgorski Exp $ + * $Id: class.StorageMySQLi.php,v 1.12 2005/05/03 01:02:35 dgorski Exp $ * * This file is part of coWiki. coWiki is free software under the terms of * the GNU General Public License (GPL). Read the LICENSE file. If you did @@ -17,7 +17,7 @@ * @author Daniel T. Gorski, <[email protected]> * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ * */ @@ -82,9 +82,16 @@ * @throws StorageConnectionFailureException */ public function connect($sHost, $sPort, $sUser, $sPass) { - if ($sPort != '') { $sHost = $sHost . ':' . $sPort; } - if (!$this->rLink = @mysqli_connect($sHost, $sUser, $sPass)) { + // Remember + $this->sHost = $sHost; + $this->sPort = $sPort; + $this->sUser = $sUser; + $this->sPass = $sPass; + + $sHostPort = $this->getHostString(); + + if (!$this->rLink = @mysqli_connect($sHostPort, $sUser, $sPass)) { // {{{ DEBUG }}} Logger::error( @@ -96,12 +103,6 @@ mysqli_connect_error() ); } - - // Remember - $this->sHost = $sHost; - $this->sPort = $sPort; - $this->sUser = $sUser; - $this->sPass = $sPass; } // -------------------------------------------------------------------- @@ -122,6 +123,9 @@ */ public function useDatabase($sDatabase) { + // Remember + $this->sDb = $sDatabase; + if(!@mysqli_select_db($this->rLink, $sDatabase)) { // {{{ DEBUG }}} @@ -134,9 +138,6 @@ mysqli_error($this->rLink) ); } - - // Remember - $this->sDb = $sDatabase; } // -------------------------------------------------------------------- File [changed]: class.StorageMySQL.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/dao/class.StorageMySQL.php?r1=1.30&r2=1.31 Delta lines: +14 -13 --------------------- --- class.StorageMySQL.php 3 May 2005 00:45:46 -0000 1.30 +++ class.StorageMySQL.php 3 May 2005 01:02:35 -0000 1.31 @@ -2,7 +2,7 @@ /** * - * $Id: class.StorageMySQL.php,v 1.30 2005/05/03 00:45:46 dgorski Exp $ + * $Id: class.StorageMySQL.php,v 1.31 2005/05/03 01:02:35 dgorski Exp $ * * This file is part of coWiki. coWiki is free software under the terms of * the GNU General Public License (GPL). Read the LICENSE file. If you did @@ -17,7 +17,7 @@ * @author Daniel T. Gorski, <[email protected]> * @copyright (C) Daniel T. Gorski, {@link http://www.develnet.org} * @license http://www.gnu.org/licenses/gpl.html - * @version $Revision: 1.30 $ + * @version $Revision: 1.31 $ * */ @@ -92,20 +92,21 @@ * @throws StorageConnectionFailureException */ public function connect($sHost, $sPort, $sUser, $sPass) { - if ($sPort != '') { $sHost = $sHost . ':' . $sPort; } - - if (!$this->rLink = @mysql_connect($sHost, $sUser, $sPass)) { - - // {{{ DEBUG }}} - Logger::error('MySQL error '.mysql_errno().': '.mysql_error()); - throw new StorageConnectionFailureException(mysql_error()); - } // Remember $this->sHost = $sHost; $this->sPort = $sPort; $this->sUser = $sUser; $this->sPass = $sPass; + + $sHostPort = $this->getHostString(); + + if (!$this->rLink = @mysql_connect($sHostPort, $sUser, $sPass)) { + + // {{{ DEBUG }}} + Logger::error('MySQL error '.mysql_errno().': '.mysql_error()); + throw new StorageConnectionFailureException(mysql_error()); + } } // -------------------------------------------------------------------- @@ -125,6 +126,9 @@ * @throws StorageDatabaseSelectionException */ public function useDatabase($sDatabase) { + // Remember + $this->sDb = $sDatabase; + if(!@mysql_select_db($sDatabase, $this->rLink)) { // {{{ DEBUG }}} @@ -132,9 +136,6 @@ throw new StorageDatabaseSelectionException(mysql_error()); } - - // Remember - $this->sDb = $sDatabase; } // --------------------------------------------------------------------