libgdamm: Gnome::Gda::MetaStruct Class Reference

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

Inheritance diagram for Gnome::Gda::MetaStruct:
Collaboration diagram for Gnome::Gda::MetaStruct:

Public Member Functions

 MetaStruct (MetaStruct&& src) noexcept
 
MetaStructoperator= (MetaStruct&& src) noexcept
 
virtual ~MetaStruct () noexcept
 
GdaMetaStruct* gobj ()
 Provides access to the underlying C GObject. More...

 
const GdaMetaStruct* gobj () const
 Provides access to the underlying C GObject. More...

 
GdaMetaStruct* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...

 
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. More...

 
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). More...

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

 
bool sort_db_object (MetaSortType sort_type)
 Reorders the list of database objects within mstruct in a way specified by sort_type. More...

 
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. More...

 
GdaMetaTableColumn* get_table_column (GdaMetaTable* table, const Value& col_name)
 
Glib::ustring dump_as_graph (MetaGraphInfo info)
 Creates a new graph (in the GraphViz syntax) representation of mstruct. More...

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

 
GSList* get_all_db_objects ()
 Get a list of all the Gda::MetaDbObject structures representing database objects in mstruct. More...

 
Glib::PropertyProxy_ReadOnly< guint > property_features () const
 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (Object &&src) noexcept
 
void * get_data (const QueryQuark &key)
 
void set_data (const Quark &key, void *data)
 
void set_data (const Quark &key, void *data, DestroyNotify notify)
 
void remove_data (const QueryQuark &quark)
 
void * steal_data (const QueryQuark &quark)
 
Glib::RefPtr< Glib::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
void connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
sigc::connection connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObject * gobj ()
 
const GObject * gobj () const
 
GObject * gobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable ()
 
 trackable (const trackable &src)
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (void *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (void *data) const
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...

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

Protected Member Functions

 MetaStruct (const Glib::RefPtr< MetaStore >& meta_store, MetaStructFeature features)
 
- Protected Member Functions inherited from Glib::Object
 Object ()
 
 Object (const Glib::ConstructParams &construct_params)
 
 Object (GObject *castitem)
 
virtual ~Object () noexcept
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gnome::Gda::MetaStructwrap (GdaMetaStruct* object, bool take_copy=false)
 A Glib::wrap() method for this object. More...

 

Additional Inherited Members

- Public Types inherited from Glib::Object
typedef void(* DestroyNotify) (gpointer data)
 
- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 

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

Gnome::Gda::MetaStruct::MetaStruct ( MetaStruct&&  src)
noexcept
virtual Gnome::Gda::MetaStruct::~MetaStruct ( )
virtualnoexcept
Gnome::Gda::MetaStruct::MetaStruct ( const Glib::RefPtr< MetaStore >&  meta_store,
MetaStructFeature  features 
)
explicitprotected

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 will be used using the following convention:

  • be surrounded by double quotes for a case sensitive search
  • otherwise for case insensitive search

For more information, see the meta data section about SQL identifiers.

Parameters
typeThe type of object to add (which can be GDA_META_DB_UNKNOWN).
catalogThe catalog the object belongs to (as a G_TYPE_STRING GValue), or 0.
schemaThe schema the object belongs to (as a G_TYPE_STRING GValue), or 0.
nameThe 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.

Please refer to complement() form more information.

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 usable using only their short name (that is which do not need to be prefixed by the schema in which they are to be used).

Please refer to complement() form more information.

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

Please refer to complement() form more information.

Parameters
catalogName of a catalog, or 0.
schemaName 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
infoInforms 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 to Gda::MetaDbObject structures which must be destroyed after usage using Glib::slist_free(). The individual Gda::MetaDbObject must not be modified.
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
catalogThe catalog the object belongs to (as a G_TYPE_STRING GValue), or 0.
schemaThe schema the object belongs to (as a G_TYPE_STRING GValue), or 0.
nameThe 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 
)
static GType Gnome::Gda::MetaStruct::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

GdaMetaStruct* Gnome::Gda::MetaStruct::gobj ( )
inline

Provides access to the underlying C GObject.

const GdaMetaStruct* Gnome::Gda::MetaStruct::gobj ( ) const
inline

Provides access to the underlying C GObject.

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.

MetaStruct& Gnome::Gda::MetaStruct::operator= ( MetaStruct&&  src)
noexcept
Glib::PropertyProxy_ReadOnly< guint > Gnome::Gda::MetaStruct::property_features ( ) const
Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, 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_typeThe 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
objectThe C instance.
take_copyFalse 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