libgdamm Reference Documentation

Main Page Namespaces Book

# Gnome::Gda::Dict Class Reference

This object is a "proxy repository" for objects in a database. More...

Inheritance diagram for Gnome::Gda::Dict:

[legend]
List of all members.

## Public Member Functions

std::string | compute_xml_filename (const Glib::ustring& datasource, const Glib::ustring& app_id)
| Get the prefered filename which represents the data dictionary associated to the datasource data source.
void | declare_object_string_id_change (const Glib::RefPtr<Gda::Object>& obj, const Glib::ustring& oldid)
| Internal function, not to be used directly.
GSList* | get_aggregates () const
Glib::RefPtr<const Connection> | get_connection () const
| Fetch a pointer to the GdaConnection used by the GdaDict object.
Glib::RefPtr<Connection> | get_connection ()
| Fetch a pointer to the GdaConnection used by the GdaDict object.
Glib::RefPtr<const DictDatabase> | get_database () const
| Fetch a pointer to the GdaDictDatabase used by the GdaDict object.
Glib::RefPtr<DictDatabase> | get_database ()
| Fetch a pointer to the GdaDictDatabase used by the GdaDict object.
Glib::RefPtr<const DataHandler> | get_default_handler (GType for_type) const
| Obtain a pointer to a Gda::DataHandler which can manage Value values of type for_type.
Glib::RefPtr<DataHandler> | get_default_handler (GType for_type)
| Obtain a pointer to a Gda::DataHandler which can manage Value values of type for_type.
Glib::RefPtr<const DictType> | get_dict_type_by_name (const Glib::ustring& type_name) const
Glib::RefPtr<DictType> | get_dict_type_by_name (const Glib::ustring& type_name)
Glib::RefPtr<const DictType> | get_dict_type_by_xml_id (const Glib::ustring& xml_id) const
Glib::RefPtr<DictType> | get_dict_type_by_xml_id (const Glib::ustring& xml_id)
Glib::SListHandle< Glib::RefPtr< const DictType > > | get_dict_types () const
Glib::SListHandle< Glib::RefPtr< DictType > > | get_dict_types ()
Glib::RefPtr<const DataHandler> | get_handler (GType for_type) const
| Obtain a pointer to a Gda::DataHandler which can convert Value values of type for_type.
Glib::RefPtr<DataHandler> | get_handler (GType for_type)
| Obtain a pointer to a Gda::DataHandler which can convert Value values of type for_type.
Glib::RefPtr<const Gda::Object> | get_object_by_string_id (const Glib::ustring& strid) const
| Fetch a pointer to the Gda::Object which has the strid string ID.
Glib::RefPtr<Gda::Object> | get_object_by_string_id (const Glib::ustring& strid)
| Fetch a pointer to the Gda::Object which has the strid string ID.
std::string | get_xml_filename () const
| Get the filename dict will use when gda_dict_save_xml() and gda_dict_load_xml() are called.
const GdaDict* | gobj () const
| Provides access to the underlying C GObject.
GdaDict* | gobj ()
| Provides access to the underlying C GObject.
GdaDict* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | load ()
| Loads an XML file which respects the Libgda DTD, and creates all the necessary objects that are defined within the XML file.
bool | load_xml_file (const std::string& xmlfile)
| Loads an XML file which respects the Libgda DTD, and creates all the necessary objects that are defined within the XML file.
bool | save ()
| Saves the contents of a GdaDict object to a file which is specified using the set_xml_filename() method.
bool | save_xml_file (const std::string& xmlfile)
| Saves the contents of a GdaDict object to a file which is given as argument.
void | set_connection (const Glib::RefPtr<Connection>& cnc)
| Sets the associated connection to dict.
void | set_xml_filename (const std::string& xmlfile)
| Sets the filename dict will use when gda_dict_save_xml() and gda_dict_load_xml() are called.
void | stop_update_dbms_meta_data ()
| When the dictionary updates its internal lists of DBMS objects, a call to this function will stop that update process.
bool | update_dbms_meta_data ()
| Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.
bool | update_dbms_meta_data (GType limit_to_type)
| Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.
bool | update_dbms_meta_data (GType limit_to_type, const Glib::ustring& limit_obj_name)
| Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.
virtual | ~Dict ()

## Static Public Member Functions

static Glib::RefPtr<Dict> | create ()

## Protected Member Functions

| Dict ()

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gnome::Gda::Dict> | wrap (GdaDict* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

This object is a "proxy repository" for objects in a database.

This is a proxy repository for

- object existing within a database such as data types (see the Gda::DictType object), functions (see the Gda::DictFunction object), aggregates (see the Gda::DictAggregate object), and the database structure (through the Gda::DictDatabase and associated object)
- pre-defined queries as Gda::Query objects
- graphs as Gda::Graph objects

Each Dict object can be saved to an XML file and loaded back in an efficient way. Any Dict object can be assigned a Gda::Connection object which tells it how to use a real connection to a data source.

The Dict object is responsible for the lifetime management of all the objects it handles. See the Gda::Object class for more information.

## Constructor & Destructor Documentation

virtual Gnome::Gda::Dict::~Dict | ( |  | ) | `[virtual]`

Gnome::Gda::Dict::Dict | ( |  | ) | `[protected]`

## Member Function Documentation

std::string Gnome::Gda::Dict::compute_xml_filename | ( | const Glib::ustring & | datasource,
|  | const Glib::ustring & | app_id |
| ) |  |  |

Get the prefered filename which represents the data dictionary associated to the datasource data source.

Using the returned value in conjunction with load_xml_file() and save_xml_file() has the advantage of letting the library handle file naming onventions.

if datasource is `0`, and a Gda::Connection object has been assigned to dict, then the returned string will take into account the data source used by that connection.

The app_id argument allows to give an extra identification to the request, when some special features must be saved but not interfere with the default dictionary.

Parameters:

  | datasource | A data source, or `0`.
  | app_id | An extra identification, or `0`.

Returns:
  A new string.

static Glib::RefPtr<Dict> Gnome::Gda::Dict::create | ( |  | ) | `[static]`

void Gnome::Gda::Dict::declare_object_string_id_change | ( | const Glib::RefPtr<Gda::Object>& | obj,
|  | const Glib::ustring & | oldid |
| ) |  |  |

Internal function, not to be used directly.

GSList* Gnome::Gda::Dict::get_aggregates | ( |  | ) | const

Glib::RefPtr<const Connection> Gnome::Gda::Dict::get_connection | ( |  | ) | const

Fetch a pointer to the GdaConnection used by the GdaDict object.

Returns:
  A pointer to the GdaConnection, if one has been assigned to dict.

Glib::RefPtr<Connection> Gnome::Gda::Dict::get_connection | ( |  | ) |

Fetch a pointer to the GdaConnection used by the GdaDict object.

Returns:
  A pointer to the GdaConnection, if one has been assigned to dict.

Glib::RefPtr<const DictDatabase> Gnome::Gda::Dict::get_database | ( |  | ) | const

Fetch a pointer to the GdaDictDatabase used by the GdaDict object.

Returns:
  A pointer to the GdaDictDatabase.

Glib::RefPtr<DictDatabase> Gnome::Gda::Dict::get_database | ( |  | ) |

Fetch a pointer to the GdaDictDatabase used by the GdaDict object.

Returns:
  A pointer to the GdaDictDatabase.

Glib::RefPtr<const DataHandler> Gnome::Gda::Dict::get_default_handler | ( | GType | for_type | ) | const

Obtain a pointer to a Gda::DataHandler which can manage Value values of type for_type.

The returned pointer is `0` if there is no default data handler available for the for_type data type

Parameters:

  | for_type | A Type type.

Returns:
  A Gda::DataHandler.

Glib::RefPtr<DataHandler> Gnome::Gda::Dict::get_default_handler | ( | GType | for_type | ) |

Obtain a pointer to a Gda::DataHandler which can manage Value values of type for_type.

The returned pointer is `0` if there is no default data handler available for the for_type data type

Parameters:

  | for_type | A Type type.

Returns:
  A Gda::DataHandler.

Glib::RefPtr<const DictType> Gnome::Gda::Dict::get_dict_type_by_name | ( | const Glib::ustring & | type_name | ) | const

Glib::RefPtr<DictType> Gnome::Gda::Dict::get_dict_type_by_name | ( | const Glib::ustring & | type_name | ) |

Glib::RefPtr<const DictType> Gnome::Gda::Dict::get_dict_type_by_xml_id | ( | const Glib::ustring & | xml_id | ) | const

Glib::RefPtr<DictType> Gnome::Gda::Dict::get_dict_type_by_xml_id | ( | const Glib::ustring & | xml_id | ) |

Glib::SListHandle<Glib::RefPtr<const DictType> > Gnome::Gda::Dict::get_dict_types | ( |  | ) | const

Glib::SListHandle<Glib::RefPtr<DictType> > Gnome::Gda::Dict::get_dict_types | ( |  | ) |

Glib::RefPtr<const DataHandler> Gnome::Gda::Dict::get_handler | ( | GType | for_type | ) | const

Obtain a pointer to a Gda::DataHandler which can convert Value values of type for_type.

Unlike the get_default_handler() method, this method asks the provider (for the connection assigned to dict using set_connection()) if there is any.

It fallbacks to the same data handler as get_default_handler() if no connection has been assigned, or if the assigned'd provider offers no data handler for that type.

The returned pointer is `0` if there is no data handler available for the for_type type.

Parameters:

  | for_type | A Type type.

Returns:
  A Gda::DataHandler.

Glib::RefPtr<DataHandler> Gnome::Gda::Dict::get_handler | ( | GType | for_type | ) |

Obtain a pointer to a Gda::DataHandler which can convert Value values of type for_type.

Unlike the get_default_handler() method, this method asks the provider (for the connection assigned to dict using set_connection()) if there is any.

It fallbacks to the same data handler as get_default_handler() if no connection has been assigned, or if the assigned'd provider offers no data handler for that type.

The returned pointer is `0` if there is no data handler available for the for_type type.

Parameters:

  | for_type | A Type type.

Returns:
  A Gda::DataHandler.

Glib::RefPtr<const Gda::Object> Gnome::Gda::Dict::get_object_by_string_id | ( | const Glib::ustring & | strid | ) | const

Fetch a pointer to the Gda::Object which has the strid string ID.

Parameters:

  | strid | A string.

Returns:
  The corresponding Gda::Object, or `0` if none found.

Glib::RefPtr<Gda::Object> Gnome::Gda::Dict::get_object_by_string_id | ( | const Glib::ustring & | strid | ) |

Fetch a pointer to the Gda::Object which has the strid string ID.

Parameters:

  | strid | A string.

Returns:
  The corresponding Gda::Object, or `0` if none found.

std::string Gnome::Gda::Dict::get_xml_filename | ( |  | ) | const

Get the filename dict will use when gda_dict_save_xml() and gda_dict_load_xml() are called.

Returns:
  The filename, or `0` if none have been set.

const GdaDict* Gnome::Gda::Dict::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaDict* Gnome::Gda::Dict::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaDict* Gnome::Gda::Dict::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

bool Gnome::Gda::Dict::load | ( |  | ) |

Loads an XML file which respects the Libgda DTD, and creates all the necessary objects that are defined within the XML file.

During the creation of the other objects, all the normal signals are emitted.

If the GdaDict object already has some contents, then it is first of all destroyed (to return its state as when it was first created).

If an error occurs during loading then the GdaDict object is left as empty as when it is first created.

The file loaded is the one specified using set_xml_filename()

Returns:
  `true` if loading was successfull and `false` otherwise.

bool Gnome::Gda::Dict::load_xml_file | ( | const std::string & | xmlfile | ) |

Loads an XML file which respects the Libgda DTD, and creates all the necessary objects that are defined within the XML file.

During the creation of the other objects, all the normal signals are emitted.

If the GdaDict object already has some contents, then it is first of all destroyed (to return its state as when it was first created).

If an error occurs during loading then the GdaDict object is left as empty as when it is first created.

Parameters:

  | xmlfile | The name of the file to which the XML will be written to.

Returns:
  `true` if loading was successfull and `false` otherwise.

bool Gnome::Gda::Dict::save | ( |  | ) |

Saves the contents of a GdaDict object to a file which is specified using the set_xml_filename() method.

Returns:
  `true` if saving was successfull and `false` otherwise.

bool Gnome::Gda::Dict::save_xml_file | ( | const std::string & | xmlfile | ) |

Saves the contents of a GdaDict object to a file which is given as argument.

Parameters:

  | xmlfile | The name of the file to which the XML will be written to.

Returns:
  `true` if saving was successfull and `false` otherwise.

void Gnome::Gda::Dict::set_connection | ( | const Glib::RefPtr<Connection>& | cnc | ) |

Sets the associated connection to dict.

This connection is then used when the dictionary synchronises itself, and when manipulating data (the get_handler() method).

Parameters:

  | cnc | A Gda::Connection object.

void Gnome::Gda::Dict::set_xml_filename | ( | const std::string & | xmlfile | ) |

Sets the filename dict will use when gda_dict_save_xml() and gda_dict_load_xml() are called.

Parameters:

  | xmlfile | A file name.

void Gnome::Gda::Dict::stop_update_dbms_meta_data | ( |  | ) |

When the dictionary updates its internal lists of DBMS objects, a call to this function will stop that update process.

It has no effect when the dictionary is not updating its DBMS data.

bool Gnome::Gda::Dict::update_dbms_meta_data | ( |  | ) |

Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.

Use set_connection() to set a Gda::Connection for the Dict.

Returns:
  True if there was no error.

bool Gnome::Gda::Dict::update_dbms_meta_data | ( | GType | limit_to_type | ) |

Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.

Use set_connection() to set a Gda::Connection for the Dict.

Parameters:

  | limit_to_type | Limit the DBMS update to this type, or 0 for no limit.

Returns:
  True if there was no error.

bool Gnome::Gda::Dict::update_dbms_meta_data | ( | GType | limit_to_type,
|  | const Glib::ustring & | limit_obj_name |
| ) |  |  |

Updates the list of data types, functions, tables, etc from the database, which means that the dict object uses an opened connection to the DBMS.

Use set_connection() to set a Gda::Connection to dict.

Parameters:

  | limit_to_type | Limit the DBMS update to this type, or 0 for no limit.
  | limit_obj_name | Limit the DBMS update to objects of this name, or `0` for no limit.

Returns:
  `true` if no error.

## Friends And Related Function Documentation

Glib::RefPtr<Gnome::Gda::Dict> wrap | ( | GdaDict * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- dict.h