include <midgard/midgard.h>
Midgard Object MgdObject is an user defined type and object. Description of an object , its properties and database abstraction layer is made in xml files.
MgdObject is represented by MIDGARD_TYPE_OBJECT type and is not associated with some particular class or type name. It's database and user defined types ( classes ) abstraction layer.
MgdObject provides transparent , not client accessible "methods" for internal midgard core's data like connection handler, sitegroup and MidgardSchema (MgdSchema) data.
|
|
MidgardObjectAction defines current state of an object if object is instatiated only by guid without type name information.
enum
{
MGD_OBJECT_ACTION_NONE = 0,
MGD_OBJECT_ACTION_CREATE,
MGD_OBJECT_ACTION_UPDATE,
MGD_OBJECT_ACTION_DELETE,
MGD_OBJECT_ACTION_PURGE
}MidgardObjectAction;
|
|
||||||||||||
|
Returns new object instance for the given guid identifier.
Cases to return NULL:
Definition at line 2654 of file types.c. References MidgardConnection::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OBJECT_DELETED, MGD_ERR_OBJECT_PURGED, MGD_ERR_OK, MIDGARD_ERRNO_SET, and midgard_object_new(). Referenced by midgard_import_object(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Import Midgard Object from xml.
Cases to return FALSE:
Import method determines whether create or update method should be invoked for imported object, so all error cases for create and update method are valid for import one. Definition at line 2865 of file types.c. References _MidgardTypePrivate::guid, _MgdObject::metadata, MidgardConnection::mgd, MGD_ERR_OBJECT_IMPORTED, MIDGARD_ERRNO_SET, midgard_get_object_by_guid(), midgard_object_create(), midgard_query_builder_add_constraint(), midgard_query_builder_execute(), midgard_query_builder_include_deleted(), midgard_query_builder_new(), and _MgdObject::private. Here is the call graph for this function: ![]() |
|
|
Creates new database record(s) for object.
Internally such properties are being set (overwritten):
Midgard error set by this method:
Since Midgard 1.8 , Midgard Administrator (Sitegroup 0) is able to specify sitegroup of created object. Definition at line 1121 of file types.c. Referenced by midgard_import_object(), and midgard_object_set_parameter(). |
|
|
Export given object to xml.
Cases to return NULL:
Definition at line 2801 of file types.c. References _midgard::_mgd, MidgardConnection::err, MidgardConnection::errstr, _MgdObject::mgd, MGD_ERR_INVALID_PROPERTY_VALUE, MGD_ERR_OK, MIDGARD_ERRNO_SET, and midgard_set_error(). Here is the call graph for this function: ![]() |
|
||||||||||||
|
Find object(s) record(s) in database for the properties being set for object instance.
Definition at line 1247 of file types.c. References _MgdObject::cname, _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_query_builder_add_constraint(), and midgard_query_builder_new(). Here is the call graph for this function: ![]() |
|
|
Fetch object's record(s) from database using 'guid' property.
MgdObject object instance must be created with midgard_object_new function. When midgard connection handler is not associated with object instance, application is terminated with 'assertion fails' error message being logged. Object instance created with this function should be freed using g_object_unref. Definition at line 1664 of file types.c. References _MgdObject::cname, _MgdObject::data, _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_query_builder_add_constraint(), midgard_query_builder_execute(), and midgard_query_builder_new(). Referenced by midgard_object_new_by_id(). Here is the call graph for this function: ![]() |
|
|
Fetch object's record(s) from database using 'id' property.
This is common practice to use 'id' property with integer type when table's id column stores unique value which identifies object and its record(s). However primary property with integer type is freely defined by user. MgdObject object instance must be created with midgard_object_new function. When midgard connection handler is not associated with object instance, application is terminated with 'assertion fails' error message being logged. Object instance created with this function should be freed using g_object_unref. Definition at line 1178 of file types.c. References _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_query_builder_add_constraint(), midgard_query_builder_execute(), and midgard_query_builder_new(). Referenced by midgard_object_get_by_path(), midgard_object_get_parent(), and midgard_object_new_by_id(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Returns object by path Definition at line 2334 of file types.c. References _MgdObject::data, _MgdObject::mgd, MGD_ERR_NOT_EXISTS, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_object_get_by_id(), midgard_object_new(), parent, _MgdSchemaTypeAttr::parent, _MgdSchemaTypeAttr::primary, _MgdSchemaTypeAttr::query, and _MgdSchemaTypeQuery::table. Here is the call graph for this function: ![]() |
|
||||||||||||
|
Returns midgard_language objects for the given Midgard Object instance.
Definition at line 2559 of file types.c. References _midgard::_mgd, MidgardConnection::err, _MgdObject::mgd, MGD_ERR_INVALID_PROPERTY_VALUE, MGD_ERR_USER_DATA, midgard_collector_add_constraint(), midgard_collector_execute(), midgard_collector_list_keys(), midgard_collector_new(), midgard_collector_set_key_property(), midgard_object_new_by_id(), and midgard_set_error(). Here is the call graph for this function: ![]() |
|
|
Fetch parent object.
Definition at line 1556 of file types.c. References _MgdObject::cname, _MidgardObjectClass::data, _MgdObject::data, _MgdObject::klass, _MgdObject::mgd, midgard_object_get_by_id(), midgard_object_new(), and _MgdSchemaTypeAttr::parent. Here is the call graph for this function: ![]() |
|
|
Returns Midgard Object type. Registers the type as a fundamental GType unless already registered. Definition at line 1414 of file types.c. References _MgdSchemaTypeAttr::base_index, _MgdSchemaTypeAttr::num_properties, and _MgdSchemaTypeAttr::params. |
|
||||||||||||||||
|
Checks whether object exists in parent's type tree.
Parent type in midgard tree is a type which can be "container" with object nodes of different types. Definition at line 444 of file tree_core.c. References _MidgardObjectClass::data, _MgdObject::mgd, midgard_object_new(), midgard_object_parent(), parent, _MgdSchemaTypeAttr::query, and _MgdSchemaTypeQuery::upfield. Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Checks whether object exists in tree ( of the same type ).
This function checks only objects of the same type. Definition at line 482 of file tree_core.c. References _MidgardObjectClass::data, _MgdObject::mgd, _MgdSchemaTypeAttr::query, and _MgdSchemaTypeQuery::upfield. |
|
||||||||||||
|
Return objects which up property is equal with object primary property
Definition at line 2203 of file types.c. References _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_query_builder_add_constraint(), midgard_query_builder_execute(), and midgard_query_builder_new(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Return child objects
Definition at line 2255 of file types.c. References _MgdSchemaTypeAttr::childs, _MgdObject::cname, _MgdObject::data, _MgdObject::klass, _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_object_new(), midgard_query_builder_add_constraint(), midgard_query_builder_execute(), midgard_query_builder_new(), and _MgdSchemaTypeAttr::primary. Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Creates new MgdObject object instance.
Sitegroup value is returned from midgard connection handler and may be overwritten only by SG0 Midgard Administrator only when object is created. Setting this property is forbidden when object is already fetched from database. Object's contructor tries to determine third optional parameter value. If it's of G_TYPE_STRING type , then midgard_is_guid is called to check weather passed string is a guid , in any other case id property is used with G_TYPE_UINT type. Any object instance created with this function should be freed using g_object_unref function. Definition at line 1455 of file types.c. References midgard_is_guid(), midgard_query_builder_add_constraint(), midgard_query_builder_execute(), and midgard_query_builder_new(). Referenced by midgard_get_object_by_guid(), midgard_object_get_by_path(), midgard_object_get_parent(), midgard_object_is_in_parent_tree(), midgard_object_list_children(), midgard_object_new_by_id(), midgard_object_set_parameter(), and midgard_query_builder_join(). Here is the call graph for this function: ![]() |
|
||||||||||||||||
|
Creates new Midgard object instance and fetch record(s) from database using object's primary property.
Third prameter's value must be always type casted to gchar ( even if it's integer type ). Internally check for primary property and its type is made and midgard_object_get_by_id or midgard_object_get_by_guid is called to return correct object's instance. NULL is returned when object can not be queried from database. Definition at line 1522 of file types.c. References _MgdObject::data, midgard_object_get_by_guid(), midgard_object_get_by_id(), midgard_object_new(), and _MgdSchemaTypeAttr::primary. Referenced by midgard_object_get_languages(). Here is the call graph for this function: ![]() |
|
|
Returns type name of parent object ( in content tree ). Definition at line 2644 of file types.c. References _MgdObject::data, and _MgdSchemaTypeAttr::parent. Referenced by midgard_object_is_in_parent_tree(). |
|
|
Purge object's record(s) from database.
FALSE is returned in such cases:
Definition at line 1948 of file types.c. References _MgdObject::cname, _MgdObject::data, _MidgardTypePrivate::guid, _MgdObject::mgd, MGD_ERR_INTERNAL, MGD_ERR_INVALID_PROPERTY_VALUE, MGD_ERR_NOT_EXISTS, MGD_ERR_OBJECT_NO_STORAGE, MGD_ERR_OK, MIDGARD_ERRNO_SET, midgard_quota_remove(), _midgard::msql, _midgard_mysql::mysql, and _MgdObject::private. Here is the call graph for this function: ![]() |
|
||||||||||||
|
Undelete object
Definition at line 2720 of file types.c. References MidgardConnection::err, MidgardConnection::mgd, MGD_ERR_INTERNAL, MGD_ERR_NOT_EXISTS, MGD_ERR_OBJECT_PURGED, MGD_ERR_OK, MGD_ERR_USER_DATA, MIDGARD_ERRNO_SET, and midgard_set_error(). Here is the call graph for this function: ![]() |
|
|
Update object's record(s).
Internally such properties are being set (overwritten):
FALSE is returned in such cases:
Midgard error set by this method:
Definition at line 924 of file types.c. Referenced by midgard_object_set_parameter(). |
|
|
MidgardObjectAction defines current state of an object if object is instatiated only by guid without type name information.
enum
{
MGD_OBJECT_ACTION_NONE = 0,
MGD_OBJECT_ACTION_CREATE,
MGD_OBJECT_ACTION_UPDATE,
MGD_OBJECT_ACTION_DELETE,
MGD_OBJECT_ACTION_PURGE
}MidgardObjectAction;
|
1.4.6