예제 #1
0
 public static function deleteRowsFromAllTablesExceptLog()
 {
     assert('RedBeanDatabase::isSetup()');
     $tableNames = DatabaseCompatibilityUtil::getAllTableNames();
     foreach ($tableNames as $tableName) {
         if ($tableName != 'log') {
             R::exec("delete from {$tableName}");
         }
     }
 }
예제 #2
0
 protected static function deleteAllTablesOrRowsExceptLog($deleteTables)
 {
     assert('RedBeanDatabase::isSetup()');
     $tableNames = DatabaseCompatibilityUtil::getAllTableNames();
     if (($logTableNameKey = array_search('log', $tableNames)) !== false) {
         unset($tableNames[$logTableNameKey]);
     }
     foreach ($tableNames as $tableName) {
         if ($deleteTables) {
             ZurmoRedBean::$writer->dropTableByTableName($tableName);
         } else {
             ZurmoRedBean::$writer->wipe($tableName);
         }
     }
 }
 public function testGetAllTableNames()
 {
     R::exec("create table temptable (temptable_id int(11) unsigned not null)");
     $tables = DatabaseCompatibilityUtil::getAllTableNames();
     $this->assertTrue(in_array('temptable', $tables));
 }