Inherits Glom::ConnectionPoolBackends::Backend.
Inherited by Glom::ConnectionPoolBackends::PostgresCentralHosted, and Glom::ConnectionPoolBackends::PostgresSelfHosted.
Public Member Functions | |
Postgres () | |
float | get_postgres_server_version () const |
Return the version number of the connected postgres server. | |
virtual bool | save_backup (const SlotProgress& slot_progress, const Glib::ustring& username, const Glib::ustring& password, const Glib::ustring& database_name) |
Save a backup file, using the same directory layout as used by self-hosting. | |
virtual bool | convert_backup (const SlotProgress& slot_progress, const std::string& base_directory, const Glib::ustring& username, const Glib::ustring& password, const Glib::ustring& database_name) |
Use a backup of the database in a tarball to create the tables and data in an existing empty database. | |
Static Public Member Functions | |
static bool | check_postgres_gda_client_is_available () |
Check whether the libgda postgres provider is really available, so we can connect to postgres servers, in case the distro package has incorrect dependencies. | |
static std::string | get_path_to_postgres_executable (const std::string& program) |
Protected Member Functions | |
bool | attempt_create_database (const Glib::ustring& database_name, const Glib::ustring& host, const Glib::ustring& port, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr< Glib::Error >& error) |
Glib::RefPtr < Gnome::Gda::Connection > | attempt_connect (const Glib::ustring& port, const Glib::ustring& database, const Glib::ustring& username, const Glib::ustring& password, std::auto_ptr< ExceptionConnection >& error) throw () |
Attempt to connect to the database with the specified criteria. | |
std::string | get_self_hosting_path (bool create=false, const std::string& child_directory=std::string()) |
std::string | get_self_hosting_config_path (bool create=false) |
Get the path to the config sub-directory, optionally creating it. | |
std::string | get_self_hosting_data_path (bool create=false) |
Get the path to the data sub-directory, optionally creating it. | |
std::string | get_self_hosting_backup_path (const std::string& base_directory=std::string(), bool create_parent_dir=false) |
Get the path to the backup file, regardless of whether it exists. | |
bool | create_directory_filepath (const std::string& filepath) |
bool | file_exists_filepath (const std::string& filepath) |
bool | file_exists_uri (const std::string& uri) const |
bool | save_password_to_pgpass (const Glib::ustring username, const Glib::ustring& password, std::string& filepath_previous, std::string& filepath_original) |
Static Protected Member Functions | |
static bool | create_text_file (const std::string& file_uri, const std::string& contents, bool current_user_only=false) |
static Glib::ustring | port_as_string (int port_num) |
Protected Attributes | |
Glib::ustring | m_host |
int | m_port |
Glom::ConnectionPoolBackends::Postgres::Postgres | ( | ) |
Glib::RefPtr< Gnome::Gda::Connection > Glom::ConnectionPoolBackends::Postgres::attempt_connect | ( | const Glib::ustring & | port, | |
const Glib::ustring & | database, | |||
const Glib::ustring & | username, | |||
const Glib::ustring & | password, | |||
std::auto_ptr< ExceptionConnection >& | error | |||
) | throw () [protected] |
Attempt to connect to the database with the specified criteria.
error | An error if the correction failed. |
bool Glom::ConnectionPoolBackends::Postgres::attempt_create_database | ( | const Glib::ustring & | database_name, | |
const Glib::ustring & | host, | |||
const Glib::ustring & | port, | |||
const Glib::ustring & | username, | |||
const Glib::ustring & | password, | |||
std::auto_ptr< Glib::Error > & | error | |||
) | [protected] |
bool Glom::ConnectionPoolBackends::Postgres::check_postgres_gda_client_is_available | ( | ) | [static] |
Check whether the libgda postgres provider is really available, so we can connect to postgres servers, in case the distro package has incorrect dependencies.
True if everything is OK.
bool Glom::ConnectionPoolBackends::Postgres::convert_backup | ( | const SlotProgress& | slot_progress, | |
const std::string & | base_directory_uri, | |||
const Glib::ustring & | username, | |||
const Glib::ustring & | password, | |||
const Glib::ustring & | database_name | |||
) | [virtual] |
Use a backup of the database in a tarball to create the tables and data in an existing empty database.
The database (server) should already have the necessary groups and users. See save_backup().
Implements Glom::ConnectionPoolBackends::Backend.
bool Glom::ConnectionPoolBackends::Postgres::create_directory_filepath | ( | const std::string & | filepath | ) | [protected] |
bool Glom::ConnectionPoolBackends::Postgres::create_text_file | ( | const std::string & | file_uri, | |
const std::string & | contents, | |||
bool | current_user_only = false | |||
) | [static, protected] |
current_user_only | If true then only the current user will be able to read or write the file. |
bool Glom::ConnectionPoolBackends::Postgres::file_exists_filepath | ( | const std::string & | filepath | ) | [protected] |
bool Glom::ConnectionPoolBackends::Postgres::file_exists_uri | ( | const std::string & | uri | ) | const [protected] |
std::string Glom::ConnectionPoolBackends::Postgres::get_path_to_postgres_executable | ( | const std::string & | program | ) | [static] |
float Glom::ConnectionPoolBackends::Postgres::get_postgres_server_version | ( | ) | const |
Return the version number of the connected postgres server.
This can be used to adapt to different server features.
std::string Glom::ConnectionPoolBackends::Postgres::get_self_hosting_backup_path | ( | const std::string & | base_directory = std::string() , |
|
bool | create_parent_dir = false | |||
) | [protected] |
Get the path to the backup file, regardless of whether it exists.
base_directory | Where to find the backup file, under a normal Glom directory structure. If base_directory is empty then it uses get_database_directory_uri(). |
std::string Glom::ConnectionPoolBackends::Postgres::get_self_hosting_config_path | ( | bool | create = false |
) | [protected] |
Get the path to the config sub-directory, optionally creating it.
std::string Glom::ConnectionPoolBackends::Postgres::get_self_hosting_data_path | ( | bool | create = false |
) | [protected] |
Get the path to the data sub-directory, optionally creating it.
std::string Glom::ConnectionPoolBackends::Postgres::get_self_hosting_path | ( | bool | create = false , |
|
const std::string & | child_directory = std::string() | |||
) | [protected] |
Glib::ustring Glom::ConnectionPoolBackends::Postgres::port_as_string | ( | int | port_num | ) | [static, protected] |
bool Glom::ConnectionPoolBackends::Postgres::save_backup | ( | const SlotProgress& | slot_progress, | |
const Glib::ustring & | username, | |||
const Glib::ustring & | password, | |||
const Glib::ustring & | database_name | |||
) | [virtual] |
Save a backup file, using the same directory layout as used by self-hosting.
Implements Glom::ConnectionPoolBackends::Backend.
bool Glom::ConnectionPoolBackends::Postgres::save_password_to_pgpass | ( | const Glib::ustring | username, | |
const Glib::ustring & | password, | |||
std::string & | filepath_previous, | |||
std::string & | filepath_original | |||
) | [protected] |
filepath_previous | The path to which the previous .pgpass, if any was moved. | |
filepath_original | The path to which filepath_previous should be moved back after the caller has finished. | |
result | whether it succeeded. |
Glib::ustring Glom::ConnectionPoolBackends::Postgres::m_host [protected] |
int Glom::ConnectionPoolBackends::Postgres::m_port [protected] |