本文整理匯總了PHP中SapphireTest::kill_temp_db方法的典型用法代碼示例。如果您正苦於以下問題:PHP SapphireTest::kill_temp_db方法的具體用法?PHP SapphireTest::kill_temp_db怎麽用?PHP SapphireTest::kill_temp_db使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SapphireTest
的用法示例。
在下文中一共展示了SapphireTest::kill_temp_db方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: run
public function run($request)
{
$db = DB::getConn();
if (!$db instanceof MySQLDatabase) {
echo '<h3>This task only appies to MySQL databases. This installation is using a ' . get_class($db) . '</h3>';
return;
}
$oldschema = array();
$newschema = array();
$renamed = 0;
$current = DB::getConn()->currentDatabase();
foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
$oldschema[] = $dbtablename;
}
DB::getConn()->selectDatabase('tmpdb');
$test = new SapphireTest();
$test->create_temp_db();
foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
$newschema[] = $dbtablename;
}
$test->kill_temp_db();
DB::getConn()->selectDatabase($current);
echo "<ul>\n";
foreach ($newschema as $table) {
if (in_array(strtolower($table), $oldschema)) {
echo "<li>renaming {$table}</li>";
$db->renameTable(strtolower($table), $table);
$renamed++;
}
}
echo "</ul>\n";
echo "<p>{$renamed} tables renamed.</p>\n";
}
示例2: artefacts
/**
* @return array
*/
private function artefacts()
{
$oldschema = [];
$newschema = [];
$current = DB::get_conn()->getSelectedDatabase();
foreach (DB::table_list() as $lowercase => $dbtablename) {
$oldschema[$dbtablename] = DB::field_list($dbtablename);
}
$test = new SapphireTest();
$test->create_temp_db();
foreach (DB::table_list() as $lowercase => $dbtablename) {
$newschema[$lowercase] = DB::field_list($dbtablename);
}
$test->kill_temp_db();
DB::get_conn()->selectDatabase($current);
$artefacts = [];
foreach ($oldschema as $table => $fields) {
if (!isset($newschema[strtolower($table)])) {
$artefacts[$table] = $table;
continue;
}
foreach ($fields as $field => $spec) {
if (!isset($newschema[strtolower($table)][$field])) {
$artefacts[$table][$field] = $field;
}
}
}
return $artefacts;
}
示例3: Artefacts
function Artefacts()
{
$oldschema = array();
$newschema = array();
$current = DB::getConn()->currentDatabase();
foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
$oldschema[$dbtablename] = DB::getConn()->fieldList($dbtablename);
}
DB::getConn()->selectDatabase('tmpdb');
$test = new SapphireTest();
$test->create_temp_db();
foreach (DB::getConn()->tableList() as $lowercase => $dbtablename) {
$newschema[$lowercase] = DB::getConn()->fieldList($dbtablename);
}
$test->kill_temp_db();
DB::getConn()->selectDatabase($current);
$artefacts = array();
foreach ($oldschema as $table => $fields) {
if (!isset($newschema[strtolower($table)])) {
$artefacts[$table] = $table;
continue;
}
foreach ($fields as $field => $spec) {
if (!isset($newschema[strtolower($table)][$field])) {
$artefacts[$table][$field] = $field;
}
}
}
return $artefacts;
}
示例4: tearDown
function tearDown()
{
SapphireTest::kill_temp_db();
DB::set_alternative_database_name(null);
}
示例5: tearDown
public function tearDown()
{
SapphireTest::kill_temp_db();
}