Esempio n. 1
0
 /**
  * Import static SQL data (normally used for ext_tables_static+adt.sql)
  *
  * @param string $rawDefinitions
  * @return void
  */
 public function importStaticSql($rawDefinitions)
 {
     $statements = $this->installToolSqlParser->getStatementarray($rawDefinitions, 1);
     list($statementsPerTable, $insertCount) = $this->installToolSqlParser->getCreateTables($statements, 1);
     $db = $this->getDatabaseConnection();
     // Traverse the tables
     foreach ($statementsPerTable as $table => $query) {
         $db->admin_query('DROP TABLE IF EXISTS ' . $table);
         $db->admin_query($query);
         if ($insertCount[$table]) {
             $insertStatements = $this->installToolSqlParser->getTableInsertStatements($statements, $table);
             foreach ($insertStatements as $statement) {
                 $db->admin_query($statement);
             }
         }
     }
 }