Project

General

Profile

« Previous | Next » 

Revision 1974

Added by darkviper about 11 years ago

/framework/WbDatabase fixed little problem with multiple database connections

View differences:

branches/2.8.x/CHANGELOG
11 11
! = Update/Change
12 12
===============================================================================
13 13

  
14
04 Oct-2013 Build 1974 Manuela v.d.Decken(DarkViper)
15
! /framework/WbDatabase  fixed little problem with multiple database connections
14 16
03 Oct-2013 Build 1973 Manuela v.d.Decken(DarkViper)
15 17
! /update-script.php last correction for loading PasswordHash packet
16 18
# -- Typo fix line 87
branches/2.8.x/wb/admin/interface/version.php
51 51

  
52 52
// check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
53 53
if(!defined('VERSION')) define('VERSION', '2.8.3');
54
if(!defined('REVISION')) define('REVISION', '1973');
54
if(!defined('REVISION')) define('REVISION', '1974');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/WbDatabase.php
40 40

  
41 41
	private $_db_handle  = null; // readonly from outside
42 42
	private $_db_name    = '';
43
	private $_sInstanceIdentifier = '';
43 44
	protected $sTablePrefix = '';
44 45
	protected $sCharset     = '';
45 46
	protected $connected    = false;
......
59 60
	public static function getInstance($sIdentifier = 'core') {
60 61
		if( !isset(self::$_oInstances[$sIdentifier])) {
61 62
            $c = __CLASS__;
62
            self::$_oInstances[$sIdentifier] = new $c;
63
			$oInstance = new $c;
64
			$oInstance->_sInstanceIdentifier = $sIdentifier;
65
            self::$_oInstances[$sIdentifier] = $oInstance;
63 66
		}
64 67
		return self::$_oInstances[$sIdentifier];
65 68
	}
......
83 86
 * Example for SQL-Url:  'mysql://user:password@demo.de[:3306]/datenbank'
84 87
 */
85 88
	public function doConnect($url = '') {
89
		if($this->connected) { return $this->connected; } // prevent from reconnecting
86 90
		$this->connected = false;
87 91
		if($url != '') {
88 92
			$aIni = parse_url($url);
......
137 141

  
138 142
	// Disconnect from the database
139 143
	public function disconnect() {
140
		if($this->connected==true) {
144
		if($this->connected == true && $oInstance->_sInstanceIdentifier != 'core' ) {
141 145
			mysql_close($this->_db_handle);
146
			$this->connected = false;
142 147
			return true;
143
		} else {
144
			return false;
145 148
		}
149
		return false;
146 150
	}
147 151

  
148 152
	// Run a query
......
227 231
			case 'getTablePrefix':
228 232
				$retval = $this->sTablePrefix;			
229 233
				break;
234
			case 'QueryCount':
230 235
			case 'getQueryCount':
231 236
				$retval = $this->iQueryCount;
232 237
				break;

Also available in: Unified diff