Пример #1
0
 public static function run_tests()
 {
     // Delete cache :
     \Glue\Core::clear_cache('db/');
     // Run tests :
     echo "<pre>";
     self::create_test_tables();
     try {
         self::test_introspection();
         self::test_fragments();
         self::test_queries();
     } catch (\Exception $e) {
         self::drop_test_tables();
         throw $e;
     }
     self::drop_test_tables();
 }
Пример #2
0
Файл: db.php Проект: rlm80/Glue
 /**
  * Returns an array with all defined connections, as an array of connection ids indexed
  * by connection id.
  *
  * @return array
  */
 public static function connection_list()
 {
     if (!isset(static::$connection_list)) {
         static::$connection_list = array();
         $dir = \Glue\CLASSPATH_USER . 'db/connection';
         foreach (\Glue\Core::globr($dir, '*.php') as $file) {
             $id = strtolower(substr($file, strlen($dir) + 1, -4));
             static::$connection_list[$id] = $id;
         }
     }
     return static::$connection_list;
 }
Пример #3
0
 /**
  * Loads a table from the disk cache. If it isn't there already, creates
  * a new cache entry for it.
  *
  * @param string $name Table name.
  *
  * @return \Glue\DB\Table
  */
 protected function table_from_cache($name)
 {
     $path = 'db/tables/' . $this->id . '/' . $name . '.tmp';
     if (!($table = \Glue\Core::get_cache_entry($path))) {
         $table = $this->table_from_db($name);
         \Glue\Core::create_cache_entry($path, $table);
     }
     return $table;
 }