Project

General

Profile

« Previous | Next » 

Revision 2085

Added by darkviper almost 11 years ago

! build DSN extended for PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES xx'

View differences:

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

  
14
16 Jan-2014 Build 2085 Manuela v.d.Decken(DarkViper)
15
! build DSN extended for PDO::MYSQL_ATTR_INIT_COMMAND = 'SET NAMES xx'
14 16
16 Jan-2014 Build 2084 Manuela v.d.Decken(DarkViper)
15 17
# modules/wysiwyg/upgrade copy-past mistake corrected
16 18
15 Jan-2014 Build 2083 Manuela v.d.Decken(DarkViper)
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.4');
54
if(!defined('REVISION')) define('REVISION', '2084');
54
if(!defined('REVISION')) define('REVISION', '2085');
55 55
if(!defined('SP')) define('SP', '');
branches/2.8.x/wb/framework/initialize.php
183 183
		$db['name'] = isset($db['name']) ? $db['name'] : 'dummy';
184 184
		$db['charset'] = isset($db['charset']) ? trim($db['charset']) : 'utf8';
185 185
		$db['table_prefix'] = (isset($db['table_prefix']) ? $db['table_prefix'] : '');
186
        if (isset($db['options']) && is_array($db['options'])) {
187
            foreach ($db['options'] as $key=>$value) {
188
                $aRetval['options'][constant($key)] = $value;
189
            }
190
        }
186 191
		if(!defined('TABLE_PREFIX')) { define('TABLE_PREFIX', $db['table_prefix']); }
187 192
		if($sDbConnectType == 'dsn') {
188 193
		// build dsn to connect
189
			$aRetval[0] = $db['type'].':dbname='.$db['name'].';host='.$db['host'].';'
190
						. ($db['port'] != '' ? 'port='.(int)$db['port'].';' : '');
191
			$aRetval[1] = array('CHARSET' => $db['charset'], 'TABLE_PREFIX' => $db['table_prefix']);
192
			$aRetval[2] = array( 'user' => $db['user'], 'pass' => $db['pass']);
194
            $aRetval['dsn']      = $db['type'].':dbname='.$db['name'].';host='.$db['host']
195
						         . ($db['port'] != '' ? ';port='.(int)$db['port'] : '');
196
            if ($db['charset'] == 'utf8') {
197
                $aRetval['dsn'] .= ';charset=UTF8';
198
                $aRetval['options'][constant('PDO::MYSQL_ATTR_INIT_COMMAND')]  = 'SET NAMES \'UTF8\'';
199
            }
200
            $aRetval['options']  = '';
201
            $aRetval['user']     = $db['user'];
202
            $aRetval['password'] = $db['pass'];
203
            $aRetval['addons']   = array('CHARSET' => $db['charset'], 'TABLE_PREFIX' => $db['table_prefix']);
193 204
		}else { 
194 205
		// build url to connect
195
			$aRetval[0] = $db['type'].'://'.$db['user'].':'.$db['pass'].'@'
196
						. $db['host'].($db['port'] != '' ? ':'.$db['port'] : '').'/'.$db['name']
197
						. '?Charset='.$db['charset'].'&TablePrefix='.$db['table_prefix'];
206
            $aRetval['url'] = $db['type'].'://'.$db['user'].':'.$db['pass'].'@'
207
						    . $db['host'].($db['port'] != '' ? ':'.$db['port'] : '').'/'.$db['name']
208
						    . '?Charset='.$db['charset'].'&TablePrefix='.$db['table_prefix'];
198 209
		}
199 210
		return $aRetval;
200 211
	}
......
256 267
// Create global database instance ---
257 268
	$oDb = $database = WbDatabase::getInstance();
258 269
	if($sDbConnectType == 'dsn') {
259
		$bTmp = $oDb->doConnect($aSqlData[0], $aSqlData[1]['user'], $aSqlData[1]['pass'], $aSqlData[2]);
270
		$bTmp = $oDb->doConnect($aSqlData['dsn'], $aSqlData['user'], $aSqlData['password'], null, $aSqlData['addons']);
260 271
	}else {
261
		$bTmp = $oDb->doConnect($aSqlData[0]);
272
		$bTmp = $oDb->doConnect($aSqlData['url']);
262 273
	}
263 274
// remove critical data from memory
264 275
	unset($aSqlData, $aCfg);

Also available in: Unified diff