libglom-1.30
1.30.4
|
Typedefs | |
typedef std::vector< std::shared_ptr< Field > > | type_vec_fields |
typedef std::vector< Glib::ustring > | type_vec_strings |
typedef std::map< Glib::ustring, Gnome::Gda::Value > | type_map_fields |
Functions | |
bool | create_database (Document* document, const Glib::ustring& database_name, const Glib::ustring& title, const std::function< void()>& progress) |
This also saves the connection port in the document if self-hosting. More... | |
bool | recreate_database_from_document (Document* document, const std::function< void()>& progress) |
Create the database on an already-connected server. More... | |
SystemPrefs | get_database_preferences (const Document* document) |
This creates the standard tables if necessary, filling them with some information from the document. More... | |
void | set_database_preferences (Document* document, const SystemPrefs& prefs) |
This also saves the preferences in the document. More... | |
bool | add_standard_tables (const Document* document) |
bool | add_standard_groups (Document* document) |
This also saves the groups in the document. More... | |
bool | add_groups_from_document (const Document* document) |
bool | set_table_privileges_groups_from_document (const Document* document) |
type_vec_fields | get_fields_for_table_from_database (const Glib::ustring& table_name, bool including_system_fields=false) |
bool | get_field_exists_in_database (const Glib::ustring& table_name, const Glib::ustring& field_name) |
type_vec_fields | get_fields_for_table (const Document* document, const Glib::ustring& table_name, bool including_system_fields=false) |
Get all the fields for a table, including any from the database that are not yet known in the document. More... | |
std::shared_ptr< Field > | get_fields_for_table_one_field (const Document* document, const Glib::ustring& table_name, const Glib::ustring& field_name) |
Get a single field definition for a table, even if the field is in the datasbase but not yet known in the document. More... | |
type_vec_strings | get_table_names_from_database (bool ignore_system_tables=false) |
Get the table names from the database server. More... | |
bool | get_table_exists_in_database (const Glib::ustring& table_name) |
bool | create_table (Document::HostingMode hosting_mode, const std::shared_ptr< const TableInfo >& table_info, const Document::type_vec_fields& fields) |
bool | create_table_with_default_fields (Document* document, const Glib::ustring& table_name) |
Also saves the table information in the document: More... | |
bool | create_table_add_missing_fields (const std::shared_ptr< const TableInfo >& table_info, const Document::type_vec_fields& fields) |
bool | add_column (const Glib::ustring& table_name, const std::shared_ptr< const Field >& field, Gtk::Window* parent_window) |
bool | drop_column (const Glib::ustring& table_name, const Glib::ustring& field_name) |
bool | insert_example_data (const Document* document, const Glib::ustring& table_name) |
Insert example data, from the document, into the table on the database server. More... | |
Glib::RefPtr< Gnome::Gda::DataModel > | query_execute_select (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& builder, bool use_cursor=false) |
Execute a SQL Select command, returning the result. More... | |
bool | query_execute_string (const Glib::ustring& strQuery, const Glib::RefPtr< Gnome::Gda::Set >& params=Glib::RefPtr< Gnome::Gda::Set >(0)) |
Execute a SQL non-select command, returning true if it succeeded. More... | |
bool | query_execute (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& builder) |
Execute a SQL non-select command, returning true if it succeeded. More... | |
Gnome::Gda::Value | auto_increment_insert_first_if_necessary (const Glib::ustring& table_name, const Glib::ustring& field_name) |
Insert the auto-increment row in the database preferences table, if necessary, returning the next value. More... | |
Gnome::Gda::Value | get_next_auto_increment_value (const Glib::ustring& table_name, const Glib::ustring& field_name) |
Get the next auto-increment value for this primary key, from the glom system table. More... | |
void | remove_auto_increment (const Glib::ustring& table_name, const Glib::ustring& field_name) |
Use this, for instance, when deleting a table. More... | |
void | layout_item_fill_field_details (const Document* document, const Glib::ustring& parent_table_name, std::shared_ptr< LayoutItem_Field >& layout_item) |
bool | layout_field_should_have_navigation (const Glib::ustring& table_name, const std::shared_ptr< const LayoutItem_Field >& layout_item, const Document* document, std::shared_ptr< Relationship >& field_used_in_relationship_to_one) |
Decides whether a field should have an Open button next to it, allowing the user to navigate to a related record. More... | |
Glib::ustring | get_unused_database_name (const Glib::ustring& base_name) |
Discover a database name that is not yet used. More... | |
int | count_rows_returned_by (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& sql_query) |
Discover how many rows a SQL query would return if it was run. More... | |
bool | rename_table (const Glib::ustring& table_name, const Glib::ustring& new_table_name) |
Rename a table in the database. More... | |
bool | drop_table (const Glib::ustring& table_name) |
Glib::ustring | escape_sql_id (const Glib::ustring& id) |
Escape, and quote, SQL identifiers such as table names. More... | |
Glib::ustring | gda_cnc_string_encode (const Glib::ustring& str) |
Just a wrapper around gda_rfc1738_encode(), for use when building libgda connection strings or authentication strings. More... | |
Glib::ustring | build_query_create_group (const Glib::ustring& group, bool superuser=false) |
Glib::ustring | build_query_add_user_to_group (const Glib::ustring& group, const Glib::ustring& user) |
bool | add_user (const Document* document, const Glib::ustring& user, const Glib::ustring& password, const Glib::ustring& group) |
Add a user to the database, with the specified password, in the specified group. More... | |
bool | remove_user (const Glib::ustring& user) |
Remove the user from the database. More... | |
bool | add_group (const Document* document, const Glib::ustring& group, bool superuser=false) |
Add a group to the database. More... | |
bool | remove_user_from_group (const Glib::ustring& user, const Glib::ustring& group) |
Gnome::Gda::Value | get_lookup_value (const Document* document, const Glib::ustring& table_name, const std::shared_ptr< const Relationship >& relationship, const std::shared_ptr< const Field >& source_field, const Gnome::Gda::Value& key_value) |
Get the value of the source_field from the relationship, using the key_value. More... | |
type_map_fields | get_record_field_values (const Document* document, const Glib::ustring& table_name, const std::shared_ptr< const Field >& primary_key, const Gnome::Gda::Value& primary_key_value) |
void | set_fake_connection () |
Allow a fake connection, so sqlbuilder_get_full_query() can work. More... | |
typedef std::map<Glib::ustring, Gnome::Gda::Value> Glom::DbUtils::type_map_fields |
bool Glom::DbUtils::add_column | ( | const Glib::ustring & | table_name, |
const std::shared_ptr< const Field >& | field, | ||
Gtk::Window * | parent_window | ||
) |
bool Glom::DbUtils::add_group | ( | const Document* | document, |
const Glib::ustring & | group, | ||
bool | superuser = false |
||
) |
Add a group to the database.
bool Glom::DbUtils::add_groups_from_document | ( | const Document* | document | ) |
bool Glom::DbUtils::add_standard_groups | ( | Document* | document | ) |
This also saves the groups in the document.
bool Glom::DbUtils::add_standard_tables | ( | const Document* | document | ) |
bool Glom::DbUtils::add_user | ( | const Document* | document, |
const Glib::ustring & | user, | ||
const Glib::ustring & | password, | ||
const Glib::ustring & | group | ||
) |
Add a user to the database, with the specified password, in the specified group.
Gnome::Gda::Value Glom::DbUtils::auto_increment_insert_first_if_necessary | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | field_name | ||
) |
Insert the auto-increment row in the database preferences table, if necessary, returning the next value.
Glib::ustring Glom::DbUtils::build_query_add_user_to_group | ( | const Glib::ustring & | group, |
const Glib::ustring & | user | ||
) |
Glib::ustring Glom::DbUtils::build_query_create_group | ( | const Glib::ustring & | group, |
bool | superuser = false |
||
) |
int Glom::DbUtils::count_rows_returned_by | ( | const Glib::RefPtr< const Gnome::Gda::SqlBuilder > & | sql_query | ) |
Discover how many rows a SQL query would return if it was run.
This uses a COUNT * on a the sql_query as a sub-statement. Be careful not to include ORDER BY clauses in the supplied SQL query, because that would make it unnecessarily slow.
A SQL query.
bool Glom::DbUtils::create_database | ( | Document* | document, |
const Glib::ustring & | database_name, | ||
const Glib::ustring & | title, | ||
const std::function< void()> & | progress | ||
) |
This also saves the connection port in the document if self-hosting.
bool Glom::DbUtils::create_table | ( | Document::HostingMode | hosting_mode, |
const std::shared_ptr< const TableInfo >& | table_info, | ||
const Document::type_vec_fields& | fields | ||
) |
bool Glom::DbUtils::create_table_add_missing_fields | ( | const std::shared_ptr< const TableInfo >& | table_info, |
const Document::type_vec_fields& | fields | ||
) |
bool Glom::DbUtils::create_table_with_default_fields | ( | Document* | document, |
const Glib::ustring & | table_name | ||
) |
Also saves the table information in the document:
bool Glom::DbUtils::drop_column | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | field_name | ||
) |
bool Glom::DbUtils::drop_table | ( | const Glib::ustring & | table_name | ) |
Glib::ustring Glom::DbUtils::escape_sql_id | ( | const Glib::ustring & | id | ) |
Escape, and quote, SQL identifiers such as table names.
This requires a current connection.
Glib::ustring Glom::DbUtils::gda_cnc_string_encode | ( | const Glib::ustring & | str | ) |
Just a wrapper around gda_rfc1738_encode(), for use when building libgda connection strings or authentication strings.
SystemPrefs Glom::DbUtils::get_database_preferences | ( | const Document* | document | ) |
This creates the standard tables if necessary, filling them with some information from the document.
bool Glom::DbUtils::get_field_exists_in_database | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | field_name | ||
) |
type_vec_fields Glom::DbUtils::get_fields_for_table | ( | const Document* | document, |
const Glib::ustring & | table_name, | ||
bool | including_system_fields = false |
||
) |
Get all the fields for a table, including any from the database that are not yet known in the document.
table_name | The name of the table whose fields should be listed. |
including_system_fields | Whether extra non-user-visible fields should be included in the list. |
type_vec_fields Glom::DbUtils::get_fields_for_table_from_database | ( | const Glib::ustring & | table_name, |
bool | including_system_fields = false |
||
) |
std::shared_ptr<Field> Glom::DbUtils::get_fields_for_table_one_field | ( | const Document* | document, |
const Glib::ustring & | table_name, | ||
const Glib::ustring & | field_name | ||
) |
Get a single field definition for a table, even if the field is in the datasbase but not yet known in the document.
table_name | The name of the table whose fields should be listed. |
field_name | The name of the field for which to get the definition. |
Gnome::Gda::Value Glom::DbUtils::get_lookup_value | ( | const Document* | document, |
const Glib::ustring & | table_name, | ||
const std::shared_ptr< const Relationship >& | relationship, | ||
const std::shared_ptr< const Field >& | source_field, | ||
const Gnome::Gda::Value & | key_value | ||
) |
Get the value of the source_field from the relationship, using the key_value.
Gnome::Gda::Value Glom::DbUtils::get_next_auto_increment_value | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | field_name | ||
) |
Get the next auto-increment value for this primary key, from the glom system table.
Add a row for this field in the system table if it does not exist already. This increments the next value after obtaining the current next value.
type_map_fields Glom::DbUtils::get_record_field_values | ( | const Document* | document, |
const Glib::ustring & | table_name, | ||
const std::shared_ptr< const Field >& | primary_key, | ||
const Gnome::Gda::Value & | primary_key_value | ||
) |
bool Glom::DbUtils::get_table_exists_in_database | ( | const Glib::ustring & | table_name | ) |
type_vec_strings Glom::DbUtils::get_table_names_from_database | ( | bool | ignore_system_tables = false | ) |
Get the table names from the database server.
This could theoretically be different than the ones listed in the document.
Glib::ustring Glom::DbUtils::get_unused_database_name | ( | const Glib::ustring & | base_name | ) |
Discover a database name that is not yet used.
This assumes that all other connection details are correctly set.
base_name | The wished-for name, to be modified until an unused name is found. |
bool Glom::DbUtils::insert_example_data | ( | const Document* | document, |
const Glib::ustring & | table_name | ||
) |
Insert example data, from the document, into the table on the database server.
bool Glom::DbUtils::layout_field_should_have_navigation | ( | const Glib::ustring & | table_name, |
const std::shared_ptr< const LayoutItem_Field >& | layout_item, | ||
const Document* | document, | ||
std::shared_ptr< Relationship >& | field_used_in_relationship_to_one | ||
) |
Decides whether a field should have an Open button next to it, allowing the user to navigate to a related record.
layout_item | A field on a layout. This must have full field details. |
field_used_in_relationship_to_one | A relationship, if the field identifies a single record, so a Find button would also make sense, to choose the ID, in editing mode. |
void Glom::DbUtils::layout_item_fill_field_details | ( | const Document* | document, |
const Glib::ustring & | parent_table_name, | ||
std::shared_ptr< LayoutItem_Field >& | layout_item | ||
) |
bool Glom::DbUtils::query_execute | ( | const Glib::RefPtr< const Gnome::Gda::SqlBuilder > & | builder | ) |
Execute a SQL non-select command, returning true if it succeeded.
Glib::RefPtr<Gnome::Gda::DataModel> Glom::DbUtils::query_execute_select | ( | const Glib::RefPtr< const Gnome::Gda::SqlBuilder > & | builder, |
bool | use_cursor = false |
||
) |
Execute a SQL Select command, returning the result.
builder | The finished SqlBuilder object. Whether the data model should be cursor-based (not allowing random access). |
bool Glom::DbUtils::query_execute_string | ( | const Glib::ustring & | strQuery, |
const Glib::RefPtr< Gnome::Gda::Set > & | params = Glib::RefPtr< Gnome::Gda::Set >(0) |
||
) |
Execute a SQL non-select command, returning true if it succeeded.
See also query_execute(), which takes a SqlBuilder. This should only be used for SQL commands that are not supported by SqlBuilder, such as ADD GROUP.
bool Glom::DbUtils::recreate_database_from_document | ( | Document* | document, |
const std::function< void()> & | progress | ||
) |
Create the database on an already-connected server.
This also saves some details in the document.
void Glom::DbUtils::remove_auto_increment | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | field_name | ||
) |
Use this, for instance, when deleting a table.
bool Glom::DbUtils::remove_user | ( | const Glib::ustring & | user | ) |
Remove the user from the database.
bool Glom::DbUtils::remove_user_from_group | ( | const Glib::ustring & | user, |
const Glib::ustring & | group | ||
) |
bool Glom::DbUtils::rename_table | ( | const Glib::ustring & | table_name, |
const Glib::ustring & | new_table_name | ||
) |
Rename a table in the database.
void Glom::DbUtils::set_database_preferences | ( | Document* | document, |
const SystemPrefs& | prefs | ||
) |
This also saves the preferences in the document.
void Glom::DbUtils::set_fake_connection | ( | ) |
Allow a fake connection, so sqlbuilder_get_full_query() can work.
bool Glom::DbUtils::set_table_privileges_groups_from_document | ( | const Document* | document | ) |