예제 #1
0
 private function test_drop_test_tables()
 {
     try {
         gluedb::db()->exec("drop table glusers");
     } catch (Exception $e) {
     }
     try {
         gluedb::db()->exec("drop table glprofiles");
     } catch (Exception $e) {
     }
     try {
         gluedb::db()->exec("drop table glposts");
     } catch (Exception $e) {
     }
 }
예제 #2
0
 /**
  * Returns compiled SQL string according to given database SQL dialect.
  *
  * @param GlueDB_Database $db Database that defines what SQL dialect must be used to compile the fragment.
  * @param integer $style 
  *
  * @return string
  */
 public function sql(GlueDB_Database $db = null, $style = self::STYLE_DEFAULT)
 {
     // No database given ? Means default database :
     if (!isset($db)) {
         $db = gluedb::db(GlueDB_Database::DEFAULTDB);
     }
     // Get name of given database instance :
     $dbname = $db->name();
     // Retrieve SQL from cache, or create it and add it to cache if it isn't there yet :
     if (!isset($this->sql[$dbname][$style])) {
         $this->sql[$dbname][$style] = $this->compile($db, $style);
     }
     // Return SQL :
     return $this->sql[$dbname][$style];
 }
예제 #3
0
 /**
  * Returns the database object this virtual table is stored into.
  *
  * @return GlueDB_Database
  */
 public function db()
 {
     return gluedb::db($this->dbname);
 }