#include <glib.h>
#include <julea.h>
#include <db/jdb-schema.h>
#include <db/jdb-selector.h>
Go to the source code of this file.
|
G_END_DECLS G_BEGIN_DECLS JDBEntry * | j_db_entry_new (JDBSchema *schema, GError **error) |
|
JDBEntry * | j_db_entry_ref (JDBEntry *entry) |
|
void | j_db_entry_unref (JDBEntry *entry) |
|
gboolean | j_db_entry_get_id (JDBEntry *entry, gpointer *value, guint64 *length, GError **error) |
|
gboolean | j_db_entry_set_field (JDBEntry *entry, gchar const *name, gconstpointer value, guint64 length, GError **error) |
|
gboolean | j_db_entry_insert (JDBEntry *entry, JBatch *batch, GError **error) |
|
gboolean | j_db_entry_update (JDBEntry *entry, JDBSelector *selector, JBatch *batch, GError **error) |
|
gboolean | j_db_entry_delete (JDBEntry *entry, JDBSelector *selector, JBatch *batch, GError **error) |
|
◆ JDBEntry
◆ j_db_entry_delete()
Delete the entry from the backend.
The entry must not be modified until the batch is executed. The selector must not be modified until the batch is executed.
- Parameters
-
[in] | entry | specifies the schema to use |
[in] | selector | the selector defines what should be deleted |
[in] | batch | the batch to append this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- entry != NULL
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_entry_get_id()
gboolean j_db_entry_get_id |
( |
JDBEntry * |
entry, |
|
|
gpointer * |
value, |
|
|
guint64 * |
length, |
|
|
GError ** |
error |
|
) |
| |
returns the id of the entry, after j_db_entry_insert has been called
- Parameters
-
[in] | entry | A JDBEntry. |
[out] | value | The id of entry . Should be freed using g_free(). |
[out] | length | The length of the id in byte. |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_entry_insert()
gboolean j_db_entry_insert |
( |
JDBEntry * |
entry, |
|
|
JBatch * |
batch, |
|
|
GError ** |
error |
|
) |
| |
Save the entry in the backend. All variables defined in the schema, which are not explicitily set, are initialized to NULL.
The entry must not be modified until the batch is executed.
- Parameters
-
[in] | entry | the entry to save |
[in] | batch | the batch to append this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- entry != NULL
-
entry has a least 1 value set to not NULL
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_entry_new()
G_END_DECLS G_BEGIN_DECLS JDBEntry* j_db_entry_new |
( |
JDBSchema * |
schema, |
|
|
GError ** |
error |
|
) |
| |
Allocates a new entry.
- Parameters
-
[in] | schema | The schema defines the structure of the entity |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
schema is initialized
- Returns
- the new entry or NULL on failure
◆ j_db_entry_ref()
Increase the ref_count of the given entry.
- Parameters
-
[in] | entry | the entry to increase the ref_count |
- Precondition
- entry != NULL
- Returns
- the entry or NULL on failure
◆ j_db_entry_set_field()
gboolean j_db_entry_set_field |
( |
JDBEntry * |
entry, |
|
|
gchar const * |
name, |
|
|
gconstpointer |
value, |
|
|
guint64 |
length, |
|
|
GError ** |
error |
|
) |
| |
Set a field in the given entry
- Parameters
-
[in] | entry | the entry to set a value |
[in] | name | the name to set a value |
[in] | value | the value to set |
[in] | length | the length of the value. Only used if the value-type defined in the Schema is binary. |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- entry != NULL
-
name != NULL
-
value != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_entry_unref()
void j_db_entry_unref |
( |
JDBEntry * |
entry | ) |
|
Decrease the ref_count of the given entry - and automatically call free if ref_count is 0. This is a noop if entry == NULL.
- Parameters
-
[in] | entry | the entry to decrease the ref_count |
◆ j_db_entry_update()
Replayes all entrys attributes with the given entrys attributes in the backend where the selector matches.
The entry must not be modified until the batch is executed. The selector must not be modified until the batch is executed.
- Parameters
-
[in] | entry | the entry defining the final values of all matched entrys |
[in] | selector | the selector defines which entrys should be modifies |
[in] | batch | the batch to append this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- entry != NULL
-
entry has a least 1 value set to not NULL
-
selector != NULL
-
selector matches at least 1 entry
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise