#include <glib.h>
#include <julea.h>
#include <db/jdb-type.h>
Go to the source code of this file.
|
G_END_DECLS G_BEGIN_DECLS JDBSchema * | j_db_schema_new (gchar const *namespace_, gchar const *name, GError **error) |
|
JDBSchema * | j_db_schema_ref (JDBSchema *schema) |
|
void | j_db_schema_unref (JDBSchema *schema) |
|
gboolean | j_db_schema_add_field (JDBSchema *schema, gchar const *name, JDBType type, GError **error) |
|
gboolean | j_db_schema_get_field (JDBSchema *schema, gchar const *name, JDBType *type, GError **error) |
|
guint32 | j_db_schema_get_all_fields (JDBSchema *schema, gchar ***names, JDBType **types, GError **error) |
|
gboolean | j_db_schema_add_index (JDBSchema *schema, gchar const **names, GError **error) |
|
gboolean | j_db_schema_create (JDBSchema *schema, JBatch *batch, GError **error) |
|
gboolean | j_db_schema_get (JDBSchema *schema, JBatch *batch, GError **error) |
|
gboolean | j_db_schema_delete (JDBSchema *schema, JBatch *batch, GError **error) |
|
gboolean | j_db_schema_equals (JDBSchema *schema1, JDBSchema *schema2, gboolean *equal, GError **error) |
|
◆ JDBSchema
◆ JDBSchemaIndex
◆ j_db_schema_add_field()
gboolean j_db_schema_add_field |
( |
JDBSchema * |
schema, |
|
|
gchar const * |
name, |
|
|
JDBType |
type, |
|
|
GError ** |
error |
|
) |
| |
Add a field to the schema.
- Parameters
-
[in] | schema | the schema to add a field to |
[in] | name | the name of the variable to add |
[in] | type | the type of the variable to add |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
name != NULL
-
schema does not contain a variable with the given name
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_add_index()
gboolean j_db_schema_add_index |
( |
JDBSchema * |
schema, |
|
|
gchar const ** |
names, |
|
|
GError ** |
error |
|
) |
| |
adds an index to the given schema.
- Parameters
-
[in] | schema | the schema to add a index to |
[in] | names | the names of the variables to put into an index group |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
names != NULL
-
names is a zero-terminated array of char
-
each **names is an previously defined variable-name
- Postcondition
- *names could be freed - or modified imediately by the caller
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_create()
gboolean j_db_schema_create |
( |
JDBSchema * |
schema, |
|
|
JBatch * |
batch, |
|
|
GError ** |
error |
|
) |
| |
stores a schema in the backend.
- Parameters
-
[in] | schema | the schema to store |
[in] | batch | the batch to add this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
schema contains at least 1 variable
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_delete()
gboolean j_db_schema_delete |
( |
JDBSchema * |
schema, |
|
|
JBatch * |
batch, |
|
|
GError ** |
error |
|
) |
| |
deletes a schema structure from the backend.
- Parameters
-
[in] | schema | the schema to delete |
[in] | batch | the batch to add this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
schema exists in the backend
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_equals()
gboolean j_db_schema_equals |
( |
JDBSchema * |
schema1, |
|
|
JDBSchema * |
schema2, |
|
|
gboolean * |
equal, |
|
|
GError ** |
error |
|
) |
| |
compares two schema with each other.
- Parameters
-
[in] | schema1 | |
[in] | schema2 | the schema to compare with each other |
[out] | equal | TRUE if schema1 and schema2 equals |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema1 != NULL
-
schema2 != NULL
-
equal != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_get()
gboolean j_db_schema_get |
( |
JDBSchema * |
schema, |
|
|
JBatch * |
batch, |
|
|
GError ** |
error |
|
) |
| |
querys a schema structure from the backend.
- Parameters
-
[in] | schema | the schema to query |
[in] | batch | the batch to add this operation to |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
schema exists in the backend
-
batch != NULL
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_get_all_fields()
guint32 j_db_schema_get_all_fields |
( |
JDBSchema * |
schema, |
|
|
gchar *** |
names, |
|
|
JDBType ** |
types, |
|
|
GError ** |
error |
|
) |
| |
query all variables from the schema.
- Parameters
-
[in] | schema | the schema to query |
[out] | names | the names of all variables in the schema |
[out] | types | the types of all variables in the schema |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
names != NULL
-
*names is not initialized
-
types != NULL
-
*types is not initialized
- Postcondition
- names is an initialized array of char. The array must be freed by the caller.
-
*types is an initialized array of JDBType. The array has the same length as *names.
- Returns
- Number of variables on success, 0 otherwise
◆ j_db_schema_get_field()
gboolean j_db_schema_get_field |
( |
JDBSchema * |
schema, |
|
|
gchar const * |
name, |
|
|
JDBType * |
type, |
|
|
GError ** |
error |
|
) |
| |
query a variable from the schema.
- Parameters
-
[in] | schema | the schema to query |
[in] | name | the name of the variable to query |
[out] | type | the type of the queried variable |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
name != NULL
-
type != NULL
-
schema contains a variable of the given type
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_schema_new()
G_END_DECLS G_BEGIN_DECLS JDBSchema* j_db_schema_new |
( |
gchar const * |
namespace_, |
|
|
gchar const * |
name, |
|
|
GError ** |
error |
|
) |
| |
Allocates a new schema.
- Parameters
-
[in] | namespace_ | the namespace of the schema |
[in] | name | the name of the schema |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- namespace != NULL
-
name != NULL
- Returns
- the new schema or NULL on failure
- Todo:
- since schema->bson is used as the out_param in j_db_internal_schema_get, the schema passed to the backend's schema_get is initialized if and only if the backend runs on the client
◆ j_db_schema_ref()
Increase the ref_count of the given schema.
- Parameters
-
[in] | schema | the schema to increase the ref_count |
- Precondition
- schema != NULL
- Returns
- the schema or NULL on failure
◆ j_db_schema_unref()
Decrease the ref_count of the given schema - and automatically call free if ref_count is 0. This is a noop if schema == NULL.
- Parameters
-
[in] | schema | the schema to decrease the ref_count |