本文整理汇总了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();
}