Project

General

Profile

« Previous | Next » 

Revision 1887

Added by Dietmar over 11 years ago

  1. bugfix Notice: Constant messages during new WB installation
    ! update WbDatabase SqlImport parameter,

View differences:

WbDatabase.php
114 114
			throw new WbDatabaseException('Missing parameter: unable to connect database');
115 115
		}
116 116
		$this->_db_handle = @mysql_connect($hostname.$hostport,
117
		                                  $username,
118
		                                  $password);
117
		                                   $username,
118
		                                   $password);
119 119
		if(!$this->_db_handle) {
120 120
			throw new WbDatabaseException('unable to connect \''.$scheme.'://'.
121 121
			                           $hostname.$hostport.'\'');
......
400 400
 * Import a standard *.sql dump file
401 401
 * @param string $sSqlDump link to the sql-dumpfile
402 402
 * @param string $sTablePrefix
403
 * @param bool $bPreserve set to true will ignore all DROP TABLE statements
404
 * @param string $sTblEngine
405
 * @param string $sTblCollation
403
 * @param bool     $bPreserve   set to true will ignore all DROP TABLE statements
404
 * @param string   $sEngine     can be 'MyISAM' or 'InnoDB'
405
 * @param string   $sCollation  one of the list of available collations
406 406
 * @return boolean true if import successful
407 407
 */
408 408
	public function SqlImport($sSqlDump,
409 409
	                          $sTablePrefix = '',
410
	                          $bPreserve = true,
411
	                          $sTblEngine = 'ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci',
412
	                          $sTblCollation = ' collate utf8_unicode_ci')
410
	                          $bPreserve    = true,
411
	                          $sEngine      = 'MyISAM',
412
	                          $sCollation   = 'utf8_unicode_ci')
413 413
	{
414
		$sCollation = ($sCollation != '' ? $sCollation : 'utf8_unicode_ci');
415
		$aCharset = preg_split('/_/', $sCollation, null, PREG_SPLIT_NO_EMPTY);
416
		$sEngine = 'ENGINE='.$sEngine.' DEFAULT CHARSET='.$aCharset[0].' COLLATE='.$sCollation;
417
		$sCollation = ' collate '.$sCollation;
414 418
		$retval = true;
415 419
		$this->error = '';
416 420
		$aSearch  = array('{TABLE_PREFIX}','{TABLE_ENGINE}', '{TABLE_COLLATION}');
417
		$aReplace = array($sTablePrefix, $sTblEngine, $sTblCollation);
421
		$aReplace = array($this->sTablePrefix, $sEngine, $sCollation);
418 422
		$sql = '';
419 423
		$aSql = file($sSqlDump);
420 424
		while ( sizeof($aSql) > 0 ) {

Also available in: Unified diff