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; }
function create() { return DBTable::create("TabellaPipposchi")->addColumn("sale", "int")->setIsPK()->addColumn("pepe", "varchar(5)")->addColumn("caramello", "varchar(5)")->addColumn("sale1", "varchar(5)")->addColumn("pepe1", "varchar(5)")->addColumn("caramello1", "varchar(5)"); }