# Glom::DbUtils Namespace Reference

## Typedefs

typedef std::vector< sharedptr < Field > > | type_vec_fields
typedef std::vector < Glib::ustring > | type_vec_strings

## Functions

bool | create_database (Document* document, const Glib::ustring& database_name, const Glib::ustring& title, const sigc::slot< void >& progress)
bool | recreate_database_from_document (Document* document, const sigc::slot< void >& progress)
SystemPrefs | get_database_preferences (Document* document)
| This creates the standard tables if necessary, filling them with some information from the document.
void | set_database_preferences (Document* document, const SystemPrefs& prefs)
bool | add_standard_tables (Document* document)
bool | add_standard_groups (Document* document)
bool | add_groups_from_document (Document* document)
bool | set_table_privileges_groups_from_document (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_strings | get_table_names_from_database (bool ignore_system_tables=false)
bool | get_table_exists_in_database (const Glib::ustring& table_name)
bool | create_table (const sharedptr< 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:
bool | create_table_add_missing_fields (const sharedptr< const TableInfo >& table_info, const Document::type_vec_fields& fields)
bool | add_column (const Glib::ustring& table_name, const sharedptr< const Field >& field, Gtk::Window* parent_window)
bool | drop_column (const Glib::ustring& table_name, const Glib::ustring& field_name)
bool | insert_example_data (Document* document, const Glib::ustring& table_name)
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.
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.
bool | query_execute (const Glib::RefPtr< const Gnome::Gda::SqlBuilder >& builder)
| Execute a SQL non-select command, returning true if it succeeded.
Gnome::Gda::Value | auto_increment_insert_first_if_necessary (const Glib::ustring& table_name, const Glib::ustring& field_name)
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.

## Typedef Documentation

typedef std::vector< sharedptr<Field> > Glom::DbUtils::type_vec_fields

typedef std::vector<Glib::ustring> Glom::DbUtils::type_vec_strings

## Function Documentation

bool Glom::DbUtils::add_column | ( | const Glib::ustring & | table_name,
|  | const sharedptr< const Field > & | field,
|  | Gtk::Window * | parent_window |
| ) |  |  |

bool Glom::DbUtils::add_groups_from_document | ( | Document * | document | ) |

bool Glom::DbUtils::add_standard_groups | ( | Document * | document | ) |

bool Glom::DbUtils::add_standard_tables | ( | Document * | document | ) |

Gnome::Gda::Value Glom::DbUtils::auto_increment_insert_first_if_necessary | ( | const Glib::ustring & | table_name,
|  | const Glib::ustring & | field_name |
| ) |  |  |

bool Glom::DbUtils::create_database | ( | Document * | document,
|  | const Glib::ustring & | database_name,
|  | const Glib::ustring & | title,
|  | const sigc::slot< void > & | progress |
| ) |  |  |

bool Glom::DbUtils::create_table | ( | const sharedptr< const TableInfo > & | table_info,
|  | const Document::type_vec_fields & | fields |
| ) |  |  |

bool Glom::DbUtils::create_table_add_missing_fields | ( | const sharedptr< 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 |
| ) |  |  |

SystemPrefs Glom::DbUtils::get_database_preferences | ( | 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_from_database | ( | const Glib::ustring & | table_name,
|  | bool | including_system_fields = `false` |
| ) |  |  |

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.

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` | ) |

bool Glom::DbUtils::insert_example_data | ( | Document * | document,
|  | const Glib::ustring & | table_name |
| ) |  |  |

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.

Parameters:

  | 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 sigc::slot< void > & | progress |
| ) |  |  |

void Glom::DbUtils::set_database_preferences | ( | Document * | document,
|  | const SystemPrefs & | prefs |
| ) |  |  |

bool Glom::DbUtils::set_table_privileges_groups_from_document | ( | Document * | document | ) |