#include <glib.h>
#include <db/jdb-schema.h>
#include <db/jdb-type.h>
Go to the source code of this file.
|
G_END_DECLS G_BEGIN_DECLS JDBSelector * | j_db_selector_new (JDBSchema *schema, JDBSelectorMode mode, GError **error) |
|
JDBSelector * | j_db_selector_ref (JDBSelector *selector) |
|
void | j_db_selector_unref (JDBSelector *selector) |
|
gboolean | j_db_selector_add_field (JDBSelector *selector, gchar const *name, JDBSelectorOperator operator_, gconstpointer value, guint64 length, GError **error) |
|
gboolean | j_db_selector_add_selector (JDBSelector *selector, JDBSelector *sub_selector, GError **error) |
| Add a second selector as sub selector. More...
|
|
gboolean | j_db_selector_add_join (JDBSelector *selector, gchar const *selector_field, JDBSelector *sub_selector, gchar const *sub_selector_field, GError **error) |
|
◆ JDBSelector
◆ JDBSelectorMode
◆ JDBSelectorOperator
◆ JDBSelectorMode
Enumerator |
---|
J_DB_SELECTOR_MODE_AND | |
J_DB_SELECTOR_MODE_OR | |
◆ JDBSelectorOperator
Enumerator |
---|
J_DB_SELECTOR_OPERATOR_LT | |
J_DB_SELECTOR_OPERATOR_LE | |
J_DB_SELECTOR_OPERATOR_GT | |
J_DB_SELECTOR_OPERATOR_GE | |
J_DB_SELECTOR_OPERATOR_EQ | |
J_DB_SELECTOR_OPERATOR_NE | |
◆ j_db_selector_add_field()
gboolean j_db_selector_add_field |
( |
JDBSelector * |
selector, |
|
|
gchar const * |
name, |
|
|
JDBSelectorOperator |
operator_, |
|
|
gconstpointer |
value, |
|
|
guint64 |
length, |
|
|
GError ** |
error |
|
) |
| |
add a search field to the selector.
- Parameters
-
[in] | selector | to add a search field to |
[in] | name | the name of the field to compare |
[in] | operator_ | the operator to use to compare the stored value with the given value |
[in] | value | the value to compare with |
[in] | length | the length of the value. Only used if value is binary |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- selector != NULL
-
name != NULL
-
name must exist in the schema
-
operator must be applyable to the defined type of the variable
-
selector including all previously added sub_selectors must not contain more than 500 search fields after applying this operation
- Postcondition
- the value may be freed or modified by the caller immediately after calling this function
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_selector_add_join()
gboolean j_db_selector_add_join |
( |
JDBSelector * |
selector, |
|
|
gchar const * |
selector_field, |
|
|
JDBSelector * |
sub_selector, |
|
|
gchar const * |
sub_selector_field, |
|
|
GError ** |
error |
|
) |
| |
Add a JOIN to the primary selector using the schema from the sub selector.
This function will join both schemas using the given fields and also copy previous add_join and add_selector data from the secondary selector to the primary selector. The given selectors must represent different primary schemas in the same namepsace.
- Parameters
-
[in] | selector | Primary selector. |
[in] | selector_field | Name of a field in the primary schema of the selector. |
[in] | sub_selector | The second selector to be used in the join. |
[in] | sub_selector_field | Name of a field in the primary schema of the sub_selector. |
- Precondition
- selector != NULL
-
sub_selector != NULL
-
selector != sub_selector
-
selector including all previously added sub_selectors must not contain more than 500 search fields after applying this operation
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_selector_add_selector()
Add a second selector as sub selector.
Using this function it is possible to build nested expressions (e.g. "A and B and (C or D)" where "C or D" is given by a sub selector). The namespace and schema of both selectors must be the same.
- Parameters
-
[in] | selector | primary selector |
[in] | sub_selector | sub selector |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- selector != NULL
-
sub_selector != NULL
-
selector != sub_selector
-
selector including all previously added sub_selectors must not contain more than 500 search fields after applying this operation
- Returns
- TRUE on success, FALSE otherwise
◆ j_db_selector_new()
Allocates a new selector.
- Parameters
-
[in] | schema | The schema defines the structure of the selector |
[in] | mode | the more of the selector |
[out] | error | A GError pointer. Will point to a GError object in case of failure. |
- Precondition
- schema != NULL
-
schema is initialized
- Returns
- the new selector or NULL on failure
◆ j_db_selector_ref()
Increase the ref_count of the given selector.
- Parameters
-
[in] | selector | the selector to increase the ref_count |
- Precondition
- selector != NULL
- Returns
- the selector or NULL on failure
◆ j_db_selector_unref()
Decrease the ref_count of the given selector - and automatically call free if ref_count is 0. This is a noop if selector == NULL.
- Parameters
-
[in] | selector | the selector to decrease the ref_count |