public function selectDatabase($name, $create = false, $errorLevel = E_USER_ERROR) { // Substitute schema here as appropriate if (self::model_schema_as_database()) { // Selecting the database itself should be treated as selecting the public schema $schemaName = $this->databaseToSchemaName($name); return $this->setSchema($schemaName, $create, $errorLevel); } // Database selection requires that a new connection is established. // This is not ideal postgres practise if (!$this->schemaManager->databaseExists($name)) { // Check DB creation permisson if (!$create) { if ($errorLevel !== false) { user_error("Attempted to connect to non-existing database \"{$name}\"", $errorLevel); } // Unselect database $this->connector->unloadDatabase(); return false; } $this->schemaManager->createDatabase($name); } // New connection made here, treating the new database name as the new original $this->databaseOriginal = $name; $this->connectDefault(); }
function clearCachedFieldlist($tableName = false) { if ($tableName) { unset(self::$cached_fieldlists[$tableName]); } else { self::$cached_fieldlists = array(); } return true; }