summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5756f03)
raw | patch | inline | side by side (parent: 5756f03)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 5 Oct 2014 18:25:32 +0000 (20:25 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 5 Oct 2014 18:25:32 +0000 (20:25 +0200) |
The function determines if a datum pointer or a string or binary datum is
NULL.
NULL.
src/core/data.c | patch | blob | history | |
src/include/core/data.h | patch | blob | history |
diff --git a/src/core/data.c b/src/core/data.c
index a57c8c6affc739a2e95bad3c0bd9dc08442c5088..eeead556899382b1e78270714a3e69eadc349129 100644 (file)
--- a/src/core/data.c
+++ b/src/core/data.c
#undef CMP_NULL
} /* sdb_data_cmp */
+_Bool
+sdb_data_isnull(const sdb_data_t *datum)
+{
+ if (! datum)
+ return 1;
+ if ((datum->type == SDB_TYPE_STRING) && (! datum->data.string))
+ return 1;
+ if ((datum->type == SDB_TYPE_BINARY) && (! datum->data.binary.datum))
+ return 1;
+ return 0;
+} /* sdb_data_isnull */
+
int
sdb_data_expr_eval(int op, const sdb_data_t *d1, const sdb_data_t *d2,
sdb_data_t *res)
index 02f99c5313ebc33ce18a6826cd33740ec364802a..af4ae5abb7e0d6f25c83e2d7856f90b9b17cd9ee 100644 (file)
--- a/src/include/core/data.h
+++ b/src/include/core/data.h
int
sdb_data_cmp(const sdb_data_t *d1, const sdb_data_t *d2);
+/*
+ * sdb_data_isnull:
+ * Determine whether a datum is NULL. A datum is considered to be NULL if
+ * either datum is NULL or if the string or binary datum is NULL.
+ */
+_Bool
+sdb_data_isnull(const sdb_data_t *datum);
+
/*
* Operators supported by sdb_data_eval_expr.
*/