当前位置: 首页>>代码示例>>PHP>>正文


PHP SapphireTest::kill_temp_db方法代码示例

本文整理汇总了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";
 }
开发者ID:helpfulrobot,项目名称:lekoala-silverstripe-devtoolkit,代码行数:33,代码来源:FixTablesCase.php

示例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;
 }
开发者ID:oddnoc,项目名称:silverstripe-artefactcleaner,代码行数:32,代码来源:ArtefactCleanTask.php

示例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;
 }
开发者ID:alapini,项目名称:silverstripe-dbplumber,代码行数:30,代码来源:DBP_Database.php

示例4: tearDown

 function tearDown()
 {
     SapphireTest::kill_temp_db();
     DB::set_alternative_database_name(null);
 }
开发者ID:Raiser,项目名称:Praktikum,代码行数:5,代码来源:TestRunner.php

示例5: tearDown

 public function tearDown()
 {
     SapphireTest::kill_temp_db();
 }
开发者ID:javabrett,项目名称:silverstripe-framework,代码行数:4,代码来源:TestRunner.php


注:本文中的SapphireTest::kill_temp_db方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。