/** * Creates a new tag list * * @param SiteApplication $app The application using this tag list. The * application must include a * SiteDatabaseModule and can optionally include * SiteMemcacheModule and * SiteMultipleInstanceModule. * @param string $tag_list_string optional. A list of tag strings separated * by '/' characters that are added to this * list when the list is created. Duplicate * tag strings are ignored. * @param boolen $show_private_photos Whether or not to load photos marked * as private. Default is to not show them. */ public function __construct(SiteApplication $app, $tag_list_string = null, $show_private_photos = false) { $this->app = $app; $this->setDatabase($this->app->db); $this->db->loadModule('Datatype', null, true); $this->show_private_photos = $show_private_photos; //SwatDB::setDebug(); //$this->app->memcache->flush(); $this->setTagsByString($tag_list_string); }
public function tableExists($table) { $this->db->loadModule('Manager', null, true); $tables = $this->db->manager->listTables(); if (MDB2::isError($tables)) { //$this->fail('Cannot list tables: '. $tables->getUserInfo()); return false; } return in_array(strtolower($table), array_map('strtolower', $tables)); }
/** * @brief drop a table * @param string $tableName the table to drop */ public static function dropTable($tableName) { self::connectMDB2(); self::$MDB2->loadModule('Manager'); self::$MDB2->dropTable($tableName); }
/** * Quotes a PHP array into a PostgreSQL array * * This is used to quote the list of document types used in the internal * SQL query. * * @param array $array the array to quote. * @param string $type the SQL data type to use. The type is 'integer' by * default. * * @return string the array quoted as an SQL array. */ protected function quoteArray($array, $type = 'integer') { $this->db->loadModule('Datatype'); $return = 'ARRAY['; if (is_array($array)) { $return .= $this->db->datatype->implodeArray($array, $type); } $return .= ']'; return $return; }