manip = new $class; } /** * Empty a table * * @param string $table */ function truncate($table) { $sql = 'TRUNCATE "' . $table . '"'; $this->query($sql); } /** * Get list of databases for the current connection * * @return array */ function get_dbs() { $sql = <<query($sql); $dbs = $res->fetchAll(PDO::FETCH_ASSOC); return $dbs; } /** * Get the list of tables for the current db * * @return array */ function get_tables() { $sql = <<query($sql); $tables = $res->fetchAll(PDO::FETCH_ASSOC); return $tables; } /** * Get the list of system tables * * @return array */ function get_system_tables() { $sql = <<query($sql); $tables = $res->fetchAll(PDO::FETCH_ASSOC); return $tables; } /** * Get a list of schemas, either for the current connection, or * for the current datbase, if specified. * * @param string $database="" * @return array */ function get_schemas($database="") { if($database === "") { $sql = <<query($sql); $schemas = $res->fetchAll(PDO::FETCH_ASSOC); return $schemas; } /** * Get a list of views for the current db * * @return array */ function get_views() { $sql = <<query($sql); $views = $res->fetchAll(PDO::FETCH_ASSOC); return $views; } /** * Return the number of rows returned for a SELECT query * * @return int */ function num_rows() { return (isset($this->statement)) ? $this->statement->rowCount : FALSE; } } //End of pgsql.php