# Gnome::Gda::MetaStruct Class Reference

In-memory representation of some database objects. More...

Inherits Glib::Object.

Collaboration diagram for Gnome::Gda::MetaStruct:

[legend]

List of all members.

## Public Member Functions

virtual | ~MetaStruct ()
GdaMetaStruct* | gobj ()
| Provides access to the underlying C GObject.
const GdaMetaStruct* | gobj () const
| Provides access to the underlying C GObject.
GdaMetaStruct* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
GdaMetaDbObject* | complement (MetaDbObjectType type, const Value& catalog, const Value& schema, const Value& name)
| Creates a new Gda::MetaDbObject structure in mstruct to represent the database object (of type type) which can be uniquely identified as catalog.
bool | complement_schema (const Value& catalog, const Value& schema)
| This method is similar to complement() but creates Gda::MetaDbObject for all the database object which are in the schema schema (and in the catalog catalog).
bool | complement_default ()
| This method is similar to complement() and complement_all() but creates Gda::MetaDbObject for all the database object which are useable using only their short name (that is which do not need to be prefixed by the schema in which they are to be used).
bool | sort_db_object (MetaSortType sort_type)
| Reorders the list of database objects within mstruct in a way specified by sort_type.
GdaMetaDbObject* | get_db_object (const Value& catalog, const Value& schema, const Value& name)
| Tries to locate the Gda::MetaDbObject structure representing the database object named after catalog, schema and name.
GdaMetaTableColumn* | get_table_column (GdaMetaTable* table, const Value& col_name)
| Tries to find the Gda::MetaTableColumn representing the column named col_name in table.
Glib::ustring | dump_as_graph (MetaGraphInfo info)
| Creates a new graph (in the GraphViz syntax) representation of mstruct.
bool | complement_all ()
| This method is similar to complement() and complement_default() but creates Gda::MetaDbObject for all the database object.
GSList* | get_all_db_objects ()
| Get a list of all the Gda::MetaDbObject structures representing database objects in mstruct.
Glib::PropertyProxy_ReadOnly < guint > | property_features () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.

## Static Public Member Functions

static Glib::RefPtr< MetaStruct > | create (const Glib::RefPtr< MetaStore >& store, MetaStructFeature features=META_STRUCT_FEATURE_ALL)

## Protected Member Functions

| MetaStruct (const Glib::RefPtr< MetaStore >& meta_store, MetaStructFeature features)

## Related Functions

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

## Detailed Description

In-memory representation of some database objects.

The Gda::MetaStruct object reads data from a Gda::MetaStore object and creates an easy to use in memory representation for some database objects. For example one can easily analyse the columns of a table (or its foreign keys) using a Gda::MetaStruct.

When created, the new Gda::MetaStruct object is empty (it does not have any information about any database object). Information about database objects is computed upon request using the gda_meta_struct_complement() method. Information about individual database objects is represented by GdaMetaDbObject structures, which can be obtained using get_db_object() or get_all_db_objects().

Note that the Gda::MetaDbObject structures may change or may be removed or replaced by others, so it not advised to keep pointers to these structures: pointers to these structures should be considered valid as long as complement() and other similar functions have not been called.

## Constructor& Destructor Documentation

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

Gnome::Gda::MetaStruct::MetaStruct | ( | const Glib::RefPtr< MetaStore >& | meta_store,
|  | MetaStructFeature | features |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

GdaMetaDbObject* Gnome::Gda::MetaStruct::complement | ( | MetaDbObjectType | type,
|  | const Value& | catalog,
|  | const Value& | schema,
|  | const Value& | name |
| ) |  |  |

Creates a new Gda::MetaDbObject structure in mstruct to represent the database object (of type type) which can be uniquely identified as catalog.

schema. name.

If catalog is not `0`, then schema should not be `0`.

If both catalog and schema are `0`, then the database object will be the one which is "visible" by default (that is which can be accessed only by its short name name).

If catalog is `0` and schema is not `0`, then the database object will be the one which can be accessed by its schema. name name.

Important note: catalog, schema and name must respect the following convention: <itemizedlist> <listitem>be surrounded by double quotes for a case sensitive search</listitem> <listitem>otherwise they will be converted to lower case for search</listitem> </itemizedlist>

Parameters:

  | type | The type of object to add (which can be GDA_META_DB_UNKNOWN).
  | catalog | The catalog the object belongs to (as a G_TYPE_STRING GValue), or `0`.
  | schema | The schema the object belongs to (as a G_TYPE_STRING GValue), or `0`.
  | name | The object's name (as a G_TYPE_STRING GValue), not `0`.

Returns:
  The Gda::MetaDbObject corresponding to the database object if no error occurred, or `0`.

bool Gnome::Gda::MetaStruct::complement_all | ( |  | ) |

This method is similar to complement() and complement_default() but creates Gda::MetaDbObject for all the database object.

Returns:
  `true` if no error occurred.

bool Gnome::Gda::MetaStruct::complement_default | ( |  | ) |

This method is similar to complement() and complement_all() but creates Gda::MetaDbObject for all the database object which are useable using only their short name (that is which do not need to be prefixed by the schema in which they are to be used).

Returns:
  `true` if no error occurred.

bool Gnome::Gda::MetaStruct::complement_schema | ( | const Value& | catalog,
|  | const Value& | schema |
| ) |  |  |

This method is similar to complement() but creates Gda::MetaDbObject for all the database object which are in the schema schema (and in the catalog catalog).

If catalog is `0`, then any catalog will be used, and if schema is `0` then any schema will be used (if schema is `0` then catalog must also be `0`).

Parameters:

  | catalog | Name of a catalog, or `0`.
  | schema | Name of a schema, or `0`.

Returns:
  `true` if no error occurred.

static Glib::RefPtr<MetaStruct> Gnome::Gda::MetaStruct::create | ( | const Glib::RefPtr< MetaStore >& | store,
|  | MetaStructFeature | features = `META_STRUCT_FEATURE_ALL` |
| ) |  |  | `[static]`

Glib::ustring Gnome::Gda::MetaStruct::dump_as_graph | ( | MetaGraphInfo | info | ) |

Creates a new graph (in the GraphViz syntax) representation of mstruct.

Parameters:

  | info | Informs what kind of information to show in the resulting graph.

Returns:
  A new string, or `0` if an error occurred.

GSList* Gnome::Gda::MetaStruct::get_all_db_objects | ( |  | ) |

Get a list of all the Gda::MetaDbObject structures representing database objects in mstruct.

Note that no Gda::MetaDbObject structure must not be modified.

Returns:
  A new SList list of pointers which must be destroyed after usage using Glib::slist_free().

GdaMetaDbObject* Gnome::Gda::MetaStruct::get_db_object | ( | const Value& | catalog,
|  | const Value& | schema,
|  | const Value& | name |
| ) |  |  |

Tries to locate the Gda::MetaDbObject structure representing the database object named after catalog, schema and name.

If one or both of catalog and schema are `0`, and more than one database object matches the name, then the return value is also `0`.

Parameters:

  | catalog | The catalog the object belongs to (as a G_TYPE_STRING GValue), or `0`.
  | schema | The schema the object belongs to (as a G_TYPE_STRING GValue), or `0`.
  | name | The object's name (as a G_TYPE_STRING GValue), not `0`.

Returns:
  The Gda::MetaDbObject or `0` if not found.

GdaMetaTableColumn* Gnome::Gda::MetaStruct::get_table_column | ( | GdaMetaTable * | table,
|  | const Value& | col_name |
| ) |  |  |

Tries to find the Gda::MetaTableColumn representing the column named col_name in table.

Parameters:

  | table | The Gda::MetaTable structure to find the column for.
  | col_name | The name of the column to find (as a G_TYPE_STRING GValue).

Returns:
  The Gda::MetaTableColumn or `0` if not found.

const GdaMetaStruct* Gnome::Gda::MetaStruct::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaMetaStruct* Gnome::Gda::MetaStruct::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GdaMetaStruct* Gnome::Gda::MetaStruct::gobj_copy | ( |  | ) |

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

Glib::PropertyProxy_ReadOnly<guint> Gnome::Gda::MetaStruct::property_features | ( |  | ) | const

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

bool Gnome::Gda::MetaStruct::sort_db_object | ( | MetaSortType | sort_type | ) |

Reorders the list of database objects within mstruct in a way specified by sort_type.

Parameters:

  | sort_type | The kind of sorting requested.

Returns:
  `true` if no error occurred.

## Friends And Related Function Documentation

Glib::RefPtr< Gnome::Gda::MetaStruct > wrap | ( | GdaMetaStruct * | 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:

- libgdamm/metastruct.h