JULEA
Typedefs | Functions
jdb-iterator.h File Reference
#include <glib.h>
#include <db/jdb-schema.h>
#include <db/jdb-selector.h>

Go to the source code of this file.

Typedefs

typedef struct JDBIterator JDBIterator
 

Functions

G_END_DECLS G_BEGIN_DECLS JDBIteratorj_db_iterator_new (JDBSchema *schema, JDBSelector *selector, GError **error)
 
JDBIteratorj_db_iterator_ref (JDBIterator *iterator)
 
void j_db_iterator_unref (JDBIterator *iterator)
 
gboolean j_db_iterator_next (JDBIterator *iterator, GError **error)
 
gboolean j_db_iterator_get_field (JDBIterator *iterator, JDBSchema *schema, gchar const *name, JDBType *type, gpointer *value, guint64 *length, GError **error)
 

Typedef Documentation

◆ JDBIterator

typedef struct JDBIterator JDBIterator

Function Documentation

◆ j_db_iterator_get_field()

gboolean j_db_iterator_get_field ( JDBIterator iterator,
JDBSchema schema,
gchar const *  name,
JDBType type,
gpointer *  value,
guint64 *  length,
GError **  error 
)

Get a single value from the current entry of the iterator.

Parameters
[in]iteratorThe iterator to query.
[in]schemaThe schema the field belongs to. If the field is in the primary schema (especially if no joins are used) NULL may be passed.
[in]nameThe name of the value to retrieve.
[out]typeThe type of the retrieved value.
[out]valueThe retieved value.
[out]lengthThe length of the retrieved value.
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
iterator != NULL
name != NULL
type != NULL
value != NULL
*value should not be initialized
length != NULL
Postcondition
*value points to a new allocated memory region. The caller must free this later using g_free.
*length contains the length of the allocated memory region
Returns
TRUE on success, FALSE otherwise

◆ j_db_iterator_new()

G_END_DECLS G_BEGIN_DECLS JDBIterator* j_db_iterator_new ( JDBSchema schema,
JDBSelector selector,
GError **  error 
)

Allocates a new iterator.

Parameters
[in]schemaThe primary schema of the iterator.
[in]selectorThe selector to use.
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
schema != NULL
selector != NULL
Returns
the new iterator or NULL on failure

◆ j_db_iterator_next()

gboolean j_db_iterator_next ( JDBIterator iterator,
GError **  error 
)

The iterator moves to the next element.

Parameters
[in,out]iteratorto update
[out]errorA GError pointer. Will point to a GError object in case of failure.
Precondition
iterator != NULL
Returns
TRUE on success, FALSE otherwise

◆ j_db_iterator_ref()

JDBIterator* j_db_iterator_ref ( JDBIterator iterator)

Increase the ref_count of the given iterator.

Parameters
[in]iteratorthe iterator to increase the ref_count
Precondition
iterator != NULL
Returns
the iterator or NULL on failure

◆ j_db_iterator_unref()

void j_db_iterator_unref ( JDBIterator iterator)

Decrease the ref_count of the given iterator - and automatically call free if ref_count is 0. This is a noop if iterator == NULL.

Parameters
[in]iteratorthe iterator to decrease the ref_count