Midgard2 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy |
#include <midgard/midgard.h> MidgardStorage; MidgardStorageClass; gboolean midgard_storage_create_base_storage (MidgardConnection *mgd
); gboolean midgard_storage_create (MidgardConnection *mgd
,const gchar *name
); gboolean midgard_storage_update (MidgardConnection *mgd
,const gchar *name
); gboolean midgard_storage_exists (MidgardConnection *mgd
,const gchar *name
); gboolean midgard_storage_delete (MidgardConnection *mgd
,const gchar *name
);
MidgardStorage is reponsible for creating underlying storage. It creates storage for every MidgardDBObjectClass derived one. For example, normal database tables are created for MidgardObjectClass derived classes, and database views for MidgardViewClass derived ones.
It is very important to understand that MidgardStorage doesn't have specific implementation which creates storage tables. Instead, it invokes private routines of MidgardDBObjectClass derived classes.
gboolean midgard_storage_create_base_storage (MidgardConnection *mgd
);
Creates storage for base Midgard classes. Tables created by this method: repligard, midgard_user and midgard_person.
|
MidgardConnection instance |
Returns : |
TRUE if tables has been created, FALSE otherwise. |
Since 9.09
gboolean midgard_storage_create (MidgardConnection *mgd
,const gchar *name
);
Creates underlying storage (e.g. table in database) for class which is identified by given name
.
It may be class which represents any underlying storage type (database table or view, for example).
If underlying storage already exists, this method silently ignore creation
and returns TRUE
. Such case is not considered an error.
This method also creates metadata storage if given class uses such.
Indexes are created if:
property is a link type
property is linked to another property
property is either parent or up
property holds guid value
Auto increment (and primary key ) field is created if property is defined as primaryproperty, and it's integer ( or unsigned one ) type
|
MidgardConnection instance |
|
name of MidgardDBObject derived class |
Returns : |
TRUE on success, FALSE otherwise |
Since 10.05
gboolean midgard_storage_update (MidgardConnection *mgd
,const gchar *name
);
Update underlying storage.
This method doesn't create storage. It creates new columns if are defined for class properties and do not exist in storage yet.
See midgard_storage_create()
if you need more info about indexes.
|
MidgardConnection instance |
|
Name of MidgardDBObjectClass derived class. |
Returns : |
TRUE on success, FALSE otherwise |
Since 10.05
gboolean midgard_storage_exists (MidgardConnection *mgd
,const gchar *name
);
Checks whether storage for given class exists.
|
MidgardConnection instance |
|
Name of MidgardDBObjectClass derived class |
Returns : |
TRUE if storage exists, FALSE otherwise |
Since 10.05
gboolean midgard_storage_delete (MidgardConnection *mgd
,const gchar *name
);
Delete storage for given class.
|
MidgardConnection instance |
|
name of MidgardDBObjectClass derived class. |
Returns : |
TRUE on success, FALSE otherwise |
Since 10.05