summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a8f40c7)
raw | patch | inline | side by side (parent: a8f40c7)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 5 Oct 2014 18:49:19 +0000 (20:49 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 5 Oct 2014 18:49:19 +0000 (20:49 +0200) |
Given that we don't support any schema for attribute values, this sounds like
a better option than assuming that those values never match no matter which
comparison operator is used.
a better option than assuming that those values never match no matter which
comparison operator is used.
src/core/store_lookup.c | patch | blob | history | |
t/unit/core/store_lookup_test.c | patch | blob | history |
index 9176592723265cd2f5607a8f622473783c8a557b..302736754ed8434421596b0801d08cc5ad33f27e 100644 (file)
--- a/src/core/store_lookup.c
+++ b/src/core/store_lookup.c
if (! attr)
status = INT_MAX;
else if (attr->value.type != value.type)
- status = INT_MAX;
+ status = sdb_data_strcmp(&attr->value, &value);
else
status = sdb_data_cmp(&attr->value, &value);
sdb_data_free_datum(&value);
index 13861bbd79d6d7dcabf237095a91fe1857c9381c..a2b159557142b0534fdf3dbf3e523f851e85eac9 100644 (file)
{ "k1", { SDB_TYPE_STRING, { .string = "v1" } }, 0, 1, 1, 1, 0 },
{ "k1", { SDB_TYPE_STRING, { .string = "v2" } }, 1, 1, 0, 0, 0 },
{ "k1", { SDB_TYPE_STRING, { .string = "v0" } }, 0, 0, 0, 1, 1 },
+ { "k1", { SDB_TYPE_STRING, { .string = "0" } }, 0, 0, 0, 1, 1 },
{ "k2", { SDB_TYPE_INTEGER, { .integer = 123 } }, 0, 1, 1, 1, 0 },
{ "k2", { SDB_TYPE_INTEGER, { .integer = 124 } }, 1, 1, 0, 0, 0 },
{ "k2", { SDB_TYPE_INTEGER, { .integer = 122 } }, 0, 0, 0, 1, 1 },
{ "k3", { SDB_TYPE_STRING, { .string = "123" } }, 0, 0, 0, 0, 0 },
{ "k3", { SDB_TYPE_INTEGER, { .integer = 123 } }, 0, 0, 0, 0, 0 },
/* type mismatch */
- { "k1", { SDB_TYPE_INTEGER, { .integer = 0 } }, 0, 0, 0, 0, 0 },
- { "k2", { SDB_TYPE_STRING, { .string = "123" } }, 0, 0, 0, 0, 0 },
+ { "k1", { SDB_TYPE_INTEGER, { .integer = 0 } }, 0, 0, 0, 1, 1 },
+ { "k2", { SDB_TYPE_STRING, { .string = "123" } }, 0, 1, 1, 1, 0 },
};
int status;