TYPO3 CMS  TYPO3_6-2
PdoHelper.php
Go to the documentation of this file.
1 <?php
3 
22 class PdoHelper {
23 
37  static public function importSql(\PDO $databaseHandle, $pdoDriver, $pathAndFilename) {
38  $sql = file($pathAndFilename, FILE_IGNORE_NEW_LINES & FILE_SKIP_EMPTY_LINES);
39  // Remove MySQL style key length delimiters (yuck!) if we are not setting up a MySQL db
40  if (substr($pdoDriver, 0, 5) !== 'mysql') {
41  $sql = preg_replace('/"\\([0-9]+\\)/', '"', $sql);
42  }
43  $statement = '';
44  foreach ($sql as $line) {
45  $statement .= ' ' . trim($line);
46  if (substr($statement, -1) === ';') {
47  $databaseHandle->exec($statement);
48  $statement = '';
49  }
50  }
51  }
52 
53 }
$sql
Definition: server.php:82
static importSql(\PDO $databaseHandle, $pdoDriver, $pathAndFilename)
Definition: PdoHelper.php:37