| Midgard2 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <midgard/midgard.h> MidgardObject * midgard_object_create_attachment (MidgardObject *self,const gchar *name,const gchar *title,const gchar *mimetype); MidgardObject ** midgard_object_list_attachments (MidgardObject *self,guint *n_objects); MidgardObject ** midgard_object_find_attachments (MidgardObject *self,guint n_params,const GParameter *parameters); gboolean midgard_object_has_attachments (MidgardObject *self); gboolean midgard_object_delete_attachments (MidgardObject *self,guint n_params,const GParameter *parameters); gboolean midgard_object_purge_attachments (MidgardObject *self,gboolean delete_blob,guint n_params,const GParameter *parameters);
MidgardObject * midgard_object_create_attachment (MidgardObject *self,const gchar *name,const gchar *title,const gchar *mimetype);
Creates object's attachment using given properties. Any property may be explicitly set to NULL.
|
MidgardObject instance |
|
name for attachment |
|
its title |
|
and mimetype |
Returns : |
newly created MidgardObject of midgard_attachment class or NULL on failure. [transfer full]
|
MidgardObject ** midgard_object_list_attachments (MidgardObject *self,guint *n_objects);
Returned objects are midgard_attachment class. Attachments objects are fetched from database unconditionally. That is, only those which parent guid property matches object's guid.
Returned array should be freed when no longer needed.
|
a MidgardObject self instance |
|
pointer to store number of returned objects. [out] |
Returns : |
Newly allocated and NULL terminated array of midgard_attachment objects. [array length=n_objects][transfer full] |
MidgardObject ** midgard_object_find_attachments (MidgardObject *self,guint n_params,const GParameter *parameters);
Find object's attachment(s) with matching given properties.
parameters argument is optional. All object's attachments are
returned ( if exist ) if parameters is explicitly set to NULL.
|
MidgardObject instance |
|
number of properties |
|
properties list |
Returns : |
newly created, NULL terminated array of MidgardObject ( midgard_attachment class ) or NULL on failure. [transfer full]
|
gboolean midgard_object_has_attachments (MidgardObject *self);
|
MidgardObject instance |
Returns : |
TRUE if object has attachments, FALSE otherwise. |
gboolean midgard_object_delete_attachments (MidgardObject *self,guint n_params,const GParameter *parameters);
Delete object's attachments(s) which match given properties' values.
Properties list in parameters is optional. All object's attachments are
deleted ( if exist ) if parameters is explicitly set to NULL.
|
MidgardObject instance |
|
number of properties |
|
properties list. [allow-none] |
Returns : |
TRUE on success, FALSE if at least one of the attachment could not be deleted |
gboolean midgard_object_purge_attachments (MidgardObject *self,gboolean delete_blob,guint n_params,const GParameter *parameters);
Purge object's attachments(s) which match given properties' values.
Properties list in parameters is optional. All object's attachments are
purged ( if exist ) if parameters is explicitly set to NULL.
delete_blob should be set to TRUE if midgard_attachment holds a reference
to blob located on filesystem ( it should be set to TRUE by default ).
However, if midgard_attachment is created for blobs sharing and file should not
be deleted, delete_blob should be set to FALSE.
There's no way to determine if midgard_attachment is sharing blob, so aplication itelf is responsible to create such own logic.
|
MidgardObject instance |
|
whether blob should be deleted as well |
|
number of properties |
|
properties list. [allow-none] |
Returns : |
TRUE on success, FALSE if at least one of the attachment could not be purged |