Revision 1591
Added by darkviper almost 13 years ago
class.database.php | ||
---|---|---|
286 | 286 |
* Import a standard *.sql dump file |
287 | 287 |
* @param string $sSqlDump link to the sql-dumpfile |
288 | 288 |
* @param string $sTablePrefix |
289 |
* @param bool $bPreserve set to true will ignore all DROP TABLE statements |
|
289 | 290 |
* @param string $sTblEngine |
290 | 291 |
* @param string $sTblCollation |
291 |
* @param bool $bPreserve set to true will ignore all DROP TABLE statements |
|
292 | 292 |
* @return boolean true if import successful |
293 | 293 |
*/ |
294 | 294 |
public function SqlImport($sSqlDump, |
295 | 295 |
$sTablePrefix = '', |
296 |
$bPreserve = true, |
|
296 | 297 |
$sTblEngine = 'ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci', |
297 |
$sTblCollation = ' collate utf8_unicode_ci', |
|
298 |
$bPreserve = true) |
|
298 |
$sTblCollation = ' collate utf8_unicode_ci') |
|
299 | 299 |
{ |
300 | 300 |
$retval = true; |
301 | 301 |
$this->error = ''; |
... | ... | |
305 | 305 |
$aSql = file($sSqlDump); |
306 | 306 |
while ( sizeof($aSql) > 0 ) { |
307 | 307 |
$sSqlLine = trim(array_shift($aSql)); |
308 |
if (preg_match('/^[-\/].+/', $sSqlLine)) {
|
|
308 |
if (!preg_match('/^[-\/]+.*/', $sSqlLine)) {
|
|
309 | 309 |
$sql = $sql.' '.$sql_line; |
310 | 310 |
if ((substr($sql,-1,1) == ';')) { |
311 | 311 |
$sql = trim(str_replace( $aSearch, $aReplace, $sql)); |
Also available in: Unified diff
little Regex-fix in database::SqlImport()