Ejemplo n.º 1
0
 public static function createTable(DBTable $table, $dropAndRecreate = false)
 {
     try {
         $created = DDS::executeResults($table->build(), false);
     } catch (PDOException $e) {
         switch ($e->getCode()) {
             case DDL::CREATE_TABLE_ALREADY_EXISTS:
                 $created = false;
                 break;
         }
     }
     if ($created) {
         return DDS::checkTableExists($table->getName());
     } else {
         if ($dropAndRecreate) {
             if (DDS::dropTable($table->getName())) {
                 return DDS::createTable($table, false);
             }
         }
     }
     return false;
 }