Code

sysdb.git
10 years agofrontend: Let scanner/parser know about object types and field names.
Sebastian Harl [Sun, 26 Oct 2014 09:10:21 +0000 (10:10 +0100)]
frontend: Let scanner/parser know about object types and field names.

This allows to handle all known objects and fields as part of the grammar
rather than manually parsing them and generating custom error messages.

10 years agofrontend/grammar: Access fields by their name rather than '.<name>'.
Sebastian Harl [Sat, 25 Oct 2014 20:45:32 +0000 (22:45 +0200)]
frontend/grammar: Access fields by their name rather than '.<name>'.

There's no more need for a special and somewhat weird syntax.

10 years agofrontend/grammar: Added support for 'ALL <obj> <cmp> <expr>'.
Sebastian Harl [Sat, 25 Oct 2014 20:22:45 +0000 (22:22 +0200)]
frontend/grammar: Added support for 'ALL <obj> <cmp> <expr>'.

This matches, if all of the specified objects match the specified expression.
ALL also matches on empty object lists.

10 years agostore: Removed unused types.
Sebastian Harl [Sat, 25 Oct 2014 20:10:12 +0000 (22:10 +0200)]
store: Removed unused types.

10 years agostore: Added support for ALL matchers.
Sebastian Harl [Sat, 25 Oct 2014 19:43:28 +0000 (21:43 +0200)]
store: Added support for ALL matchers.

Similar to ANY, this matcher iterators over objects. It matches, if *all* of
those objects match another matcher.

10 years agostore: Don't special case negated matchers in the ANY matcher.
Sebastian Harl [Sat, 25 Oct 2014 19:41:16 +0000 (21:41 +0200)]
store: Don't special case negated matchers in the ANY matcher.

The old behavior no longer makes sense when thinking about matching *any*
object.

10 years agofrontend/grammar: Changed '<obj> <cmp> <expr>' to 'ANY <obj> <cmp> <expr>'.
Sebastian Harl [Sat, 25 Oct 2014 12:31:06 +0000 (14:31 +0200)]
frontend/grammar: Changed '<obj> <cmp> <expr>' to 'ANY <obj> <cmp> <expr>'.

… for services, metrics, and attributes. That is, let this involve less magic
but make it clear that this looks at multiple objects and matches if any of
them match.

10 years agostore: Renamed child-matcher to any-matcher.
Sebastian Harl [Sat, 25 Oct 2014 11:58:58 +0000 (13:58 +0200)]
store: Renamed child-matcher to any-matcher.

It matches if any object of an iterable list matches, so this is a more
appropriate name.

10 years agodata_test: Test various unsupported expressions.
Sebastian Harl [Fri, 24 Oct 2014 18:25:17 +0000 (20:25 +0200)]
data_test: Test various unsupported expressions.

10 years agostore: During lookup use strcmp() only for unknown data-types.
Sebastian Harl [Fri, 24 Oct 2014 16:08:14 +0000 (18:08 +0200)]
store: During lookup use strcmp() only for unknown data-types.

Unknown data-types means that we don't know the type of either one expression
before hand. For example, this is true for attributes given that there is no
schema.

10 years agostore: Record the data-type of an expression.
Sebastian Harl [Fri, 24 Oct 2014 15:59:28 +0000 (17:59 +0200)]
store: Record the data-type of an expression.

10 years agodata: Added sdb_data_expr_type().
Sebastian Harl [Fri, 24 Oct 2014 15:51:03 +0000 (17:51 +0200)]
data: Added sdb_data_expr_type().

This function returns the expected type of the result of an arithmetic
expression based on the operator and input types.

10 years agostore: Removed now unused name-matcher and sdb_store_matcher_parse_cmp().
Sebastian Harl [Thu, 23 Oct 2014 20:12:19 +0000 (22:12 +0200)]
store: Removed now unused name-matcher and sdb_store_matcher_parse_cmp().

10 years agot/: Converted name matcher tests to new style matchers.
Sebastian Harl [Thu, 23 Oct 2014 20:11:08 +0000 (22:11 +0200)]
t/: Converted name matcher tests to new style matchers.

10 years agofrontend/grammar: Implement '<obj> <op> <expr>' using new-style matchers.
Sebastian Harl [Thu, 23 Oct 2014 19:30:00 +0000 (21:30 +0200)]
frontend/grammar: Implement '<obj> <op> <expr>' using new-style matchers.

10 years agostore: Added sdb_store_parse_object_type().
Sebastian Harl [Thu, 23 Oct 2014 19:29:16 +0000 (21:29 +0200)]
store: Added sdb_store_parse_object_type().

This function parses an object type name (singular) and returns the type ID.

10 years agostore: Let sdb_store_parse_object_type_plural support attributes.
Sebastian Harl [Thu, 23 Oct 2014 19:28:15 +0000 (21:28 +0200)]
store: Let sdb_store_parse_object_type_plural support attributes.

However, the parser will not accept attributes in LIST commands as before.
Still, an attribute is considered to be a stored object.

10 years agostore: Let child matchers handle negated operators as before.
Sebastian Harl [Thu, 23 Oct 2014 19:20:50 +0000 (21:20 +0200)]
store: Let child matchers handle negated operators as before.

That is, negated matchers have to match *all* children because a condition
like "service != 'foo'" would match only on hosts which do not have a service
called 'foo'.

10 years agostore: Let child matcher actually match the child.
Sebastian Harl [Thu, 23 Oct 2014 19:01:26 +0000 (21:01 +0200)]
store: Let child matcher actually match the child.

10 years agostore: Fixed a typo in the type check of the child matcher.
Sebastian Harl [Thu, 23 Oct 2014 06:08:21 +0000 (08:08 +0200)]
store: Fixed a typo in the type check of the child matcher.

10 years agostore: Removed unused old sdb_store_attr_matcher().
Sebastian Harl [Thu, 23 Oct 2014 05:27:30 +0000 (07:27 +0200)]
store: Removed unused old sdb_store_attr_matcher().

10 years agostore: Renamed sdb_store_cmp_XX to sdb_store_XX_matcher.
Sebastian Harl [Wed, 22 Oct 2014 09:26:45 +0000 (11:26 +0200)]
store: Renamed sdb_store_cmp_XX to sdb_store_XX_matcher.

… now that these names have become available again.

10 years agostore: Removed unused, old conditional matchers.
Sebastian Harl [Wed, 22 Oct 2014 09:16:05 +0000 (11:16 +0200)]
store: Removed unused, old conditional matchers.

10 years agostore: Removed now unused support for attribute matchers in old code.
Sebastian Harl [Wed, 22 Oct 2014 09:09:30 +0000 (11:09 +0200)]
store: Removed now unused support for attribute matchers in old code.

10 years agot/: Use expression-based matchers for attribute comparison tests.
Sebastian Harl [Wed, 22 Oct 2014 09:08:17 +0000 (11:08 +0200)]
t/: Use expression-based matchers for attribute comparison tests.

10 years agostore: Removed sdb_store_matcher_parse_field_cmp() and sdb_store_obj_cond().
Sebastian Harl [Wed, 22 Oct 2014 08:48:13 +0000 (10:48 +0200)]
store: Removed sdb_store_matcher_parse_field_cmp() and sdb_store_obj_cond().

Those functions have been superseded by the new expression-based matchers.

10 years agot/: Use the new expression-based matchers for various tests.
Sebastian Harl [Wed, 22 Oct 2014 08:46:35 +0000 (10:46 +0200)]
t/: Use the new expression-based matchers for various tests.

10 years agodata: Format NULL as NULL and never quote it.
Sebastian Harl [Tue, 21 Oct 2014 08:02:07 +0000 (10:02 +0200)]
data: Format NULL as NULL and never quote it.

The idea, previously, was to make NULL values easily identifiable in all
messages but the focus really is on the JSON output which supports a real null
value.

10 years agostore: Let NULL values never match a regex.
Sebastian Harl [Tue, 21 Oct 2014 07:56:08 +0000 (09:56 +0200)]
store: Let NULL values never match a regex.

10 years agostore: Removed sdb_store_matcher_tostring().
Sebastian Harl [Tue, 21 Oct 2014 07:50:42 +0000 (09:50 +0200)]
store: Removed sdb_store_matcher_tostring().

This function was mainly used for debugging and more verbose error messages
upon test failures. Given that we have more fine-grained tests now, keeping
the tostring() methods up-to-date is rather annoying but for little benefit.

Instead, we should have a real pretty-printer or similar at some point.

10 years agofrontend/grammar: Unified field and attribute value matchers.
Sebastian Harl [Tue, 21 Oct 2014 07:13:47 +0000 (09:13 +0200)]
frontend/grammar: Unified field and attribute value matchers.

Use generic expressions and the new compare matchers instead.

As a side-effect of this change, not-operators (!=, etc.) no longer match on
NULL values (attribute does not exist). This is intended and should have been
like this in the first place (we've got 'IS NULL' for that purpose). For
example, `attribute['foo'] != 123' did previously match if attribute 'foo' did
not exist but now this is no longer the case.

10 years agostore: Let compare matchers fail if any of the operands is NULL.
Sebastian Harl [Tue, 21 Oct 2014 06:17:17 +0000 (08:17 +0200)]
store: Let compare matchers fail if any of the operands is NULL.

10 years agot/: Let tests use '<expr> IN .backend'.
Sebastian Harl [Tue, 21 Oct 2014 05:57:19 +0000 (07:57 +0200)]
t/: Let tests use '<expr> IN .backend'.

10 years agofrontend/grammar: Added support for the IN operator.
Sebastian Harl [Tue, 21 Oct 2014 05:45:31 +0000 (07:45 +0200)]
frontend/grammar: Added support for the IN operator.

This is a matcher checking if a value is included in an array. It's mostly
meant to be used to match backends at the moment.

10 years agostore: Added sdb_store_in_matcher().
Sebastian Harl [Tue, 21 Oct 2014 05:36:41 +0000 (07:36 +0200)]
store: Added sdb_store_in_matcher().

This function creates a matcher which matches if the right value evaluates to
an array value and the left value is included in that array.

10 years agodata: Added sdb_data_inarray().
Sebastian Harl [Tue, 21 Oct 2014 05:25:37 +0000 (07:25 +0200)]
data: Added sdb_data_inarray().

The function determines whether a value is included in an array.

10 years agostore: Added support for querying the BACKEND field.
Sebastian Harl [Mon, 20 Oct 2014 17:17:53 +0000 (19:17 +0200)]
store: Added support for querying the BACKEND field.

… returning an array of strings.

10 years agodata: Added support for comparing integer, decimal, and string arrays.
Sebastian Harl [Mon, 20 Oct 2014 07:44:16 +0000 (09:44 +0200)]
data: Added support for comparing integer, decimal, and string arrays.

Array comparison works element-by-element, returning how the first non-equal
elements compare to each other.

Added tests for array comparison and concatenation.

10 years agodata_test: Use int64_t instead of int for integer array data.
Sebastian Harl [Mon, 20 Oct 2014 07:43:33 +0000 (09:43 +0200)]
data_test: Use int64_t instead of int for integer array data.

10 years agodata: Fixed length of newly allocated array in concat().
Sebastian Harl [Mon, 20 Oct 2014 07:42:35 +0000 (09:42 +0200)]
data: Fixed length of newly allocated array in concat().

10 years agodata: Added basic support for arrays.
Sebastian Harl [Mon, 20 Oct 2014 06:03:13 +0000 (08:03 +0200)]
data: Added basic support for arrays.

An array may contain elements of one type and it's stored in compact raw form
(as in: not an array of union values but an array of the actual values).
'copy', 'free', and 'concat' operations are currently supported but limited to
integer, decimal, or string element types. ENOTSUP is returned for any other
operations.

10 years agodata_test: Removed unnecessary and possibly misleading checks.
Sebastian Harl [Sun, 19 Oct 2014 21:20:49 +0000 (23:20 +0200)]
data_test: Removed unnecessary and possibly misleading checks.

10 years agodata: Use if-statements rather than switch-statements.
Sebastian Harl [Sun, 19 Oct 2014 20:52:44 +0000 (22:52 +0200)]
data: Use if-statements rather than switch-statements.

10 years agodata: Added sdb_data_sizeof().
Sebastian Harl [Sun, 19 Oct 2014 20:21:45 +0000 (22:21 +0200)]
data: Added sdb_data_sizeof().

This function returns the size of the data-type for a given type.

10 years agostore: Clarify behavior of expr_attrvalue if the attribute does not exist.
Sebastian Harl [Sun, 19 Oct 2014 15:58:46 +0000 (17:58 +0200)]
store: Clarify behavior of expr_attrvalue if the attribute does not exist.

10 years agofrontend/grammar: Fixed parsing of 'attribute[<string>]'.
Sebastian Harl [Sun, 19 Oct 2014 15:24:50 +0000 (17:24 +0200)]
frontend/grammar: Fixed parsing of 'attribute[<string>]'.

That is, don't accept anything besides the string "attribute". Previously,
<anything>[<string>] was accepted as an attribute value.

10 years agofrontend/grammar: Make IS NULL operators available to any expression.
Sebastian Harl [Sun, 19 Oct 2014 14:57:34 +0000 (16:57 +0200)]
frontend/grammar: Make IS NULL operators available to any expression.

10 years agostore: Return NULL if an attribute was not found.
Sebastian Harl [Sun, 19 Oct 2014 12:58:45 +0000 (14:58 +0200)]
store: Return NULL if an attribute was not found.

10 years agodata: Added explicit NULL values.
Sebastian Harl [Sun, 19 Oct 2014 12:56:38 +0000 (14:56 +0200)]
data: Added explicit NULL values.

… and let all expressions involving NULL values to return NULL.

10 years agodata: Let CONCAT return NULL if any of its operands is NULL.
Sebastian Harl [Sun, 19 Oct 2014 12:00:41 +0000 (14:00 +0200)]
data: Let CONCAT return NULL if any of its operands is NULL.

This mimics behavior in SQL and also allows for missing values to be reported
as NULL and propagate that information.

10 years agofrontend/grammar: Use strings to access attribute value: attribute['name'].
Sebastian Harl [Fri, 17 Oct 2014 22:42:43 +0000 (00:42 +0200)]
frontend/grammar: Use strings to access attribute value: attribute['name'].

10 years agostore, frontend: Make IS (NOT) NULL an unary operator on expressions.
Sebastian Harl [Fri, 17 Oct 2014 17:50:34 +0000 (19:50 +0200)]
store, frontend: Make IS (NOT) NULL an unary operator on expressions.

This is more flexible and in-line with all other operators being migrated to
expression-based constructs.

10 years agoparser_test: Added various arithmetic expressions to the expr parser test.
Sebastian Harl [Fri, 17 Oct 2014 08:52:45 +0000 (10:52 +0200)]
parser_test: Added various arithmetic expressions to the expr parser test.

10 years agoAdded tests for sdb_fe_parse_expr() and fixed the implementation.
Sebastian Harl [Fri, 17 Oct 2014 08:43:45 +0000 (10:43 +0200)]
Added tests for sdb_fe_parse_expr() and fixed the implementation.

That is, fixed a typo preventing the parsed expression from being returned and
fixed memory leaks in the matcher and expression parsers.

10 years agofrontend/parser: Made clear that parser modes are flags.
Sebastian Harl [Fri, 17 Oct 2014 08:35:07 +0000 (10:35 +0200)]
frontend/parser: Made clear that parser modes are flags.

It doesn't make a difference so far, but will avoid problems in the future.

10 years agofrontend/grammar: Added a destructor for data objects.
Sebastian Harl [Fri, 17 Oct 2014 08:34:20 +0000 (10:34 +0200)]
frontend/grammar: Added a destructor for data objects.

10 years agofrontend/parser: Don't override fields of unknown types.
Sebastian Harl [Fri, 17 Oct 2014 08:33:46 +0000 (10:33 +0200)]
frontend/parser: Don't override fields of unknown types.

10 years agofrontend: Added sdb_fe_parse_expr().
Sebastian Harl [Fri, 17 Oct 2014 07:12:08 +0000 (09:12 +0200)]
frontend: Added sdb_fe_parse_expr().

This function enables a special new parser mode in which it only accepts
simple expressions.

10 years agofrontend: Renamed CONNECTION_EXPR to CONNECTION_MATCHER.
Sebastian Harl [Fri, 17 Oct 2014 07:10:03 +0000 (09:10 +0200)]
frontend: Renamed CONNECTION_EXPR to CONNECTION_MATCHER.

That's more specific.

10 years agostore: Added sdb_store_parse_matcher_op().
Sebastian Harl [Fri, 17 Oct 2014 06:36:42 +0000 (08:36 +0200)]
store: Added sdb_store_parse_matcher_op().

This function parses the string representation of an operator and returns a
constructor for the respective matcher.

10 years agodata: Don't free memory before using it for the last time.
Sebastian Harl [Fri, 17 Oct 2014 06:30:16 +0000 (08:30 +0200)]
data: Don't free memory before using it for the last time.

10 years agostore: Added not-equal and not-regex matchers.
Sebastian Harl [Wed, 15 Oct 2014 13:57:24 +0000 (15:57 +0200)]
store: Added not-equal and not-regex matchers.

10 years agostore: Added support for regex matchers.
Sebastian Harl [Wed, 15 Oct 2014 13:36:29 +0000 (15:36 +0200)]
store: Added support for regex matchers.

A regex matcher matches the string value an expression evaluates to against a
regular expression. Dynamic regular expressions are supported as well through
expressions evaluating to a string which is then dynamically compiled into a
regular expression when executing the matcher.

10 years agodata: Let sdb_data_parse() support inline casts from string to other types.
Sebastian Harl [Wed, 15 Oct 2014 13:15:25 +0000 (15:15 +0200)]
data: Let sdb_data_parse() support inline casts from string to other types.

10 years agostore: Added child matchers.
Sebastian Harl [Tue, 14 Oct 2014 21:44:19 +0000 (23:44 +0200)]
store: Added child matchers.

A child matcher matches an object's children of a certain type. It applies
another matcher to all children and matches if any of the children matches.

10 years agostore: Added matchers comparing two expressions.
Sebastian Harl [Tue, 14 Oct 2014 21:07:43 +0000 (23:07 +0200)]
store: Added matchers comparing two expressions.

This is much more powerful than the old conditional matchers and will replace
those once all code has been migrated to the new compare matchers.

10 years agostore: Apply filters when evaluating attribute values or expressions.
Sebastian Harl [Tue, 14 Oct 2014 20:45:07 +0000 (22:45 +0200)]
store: Apply filters when evaluating attribute values or expressions.

10 years agofrontend/grammar: Added (limited) support for attribute values in expressions.
Sebastian Harl [Tue, 14 Oct 2014 07:16:09 +0000 (09:16 +0200)]
frontend/grammar: Added (limited) support for attribute values in expressions.

This is not fully supported yet as expressions may not be used in all places
yet.

10 years agostore: Added sdb_store_expr_attrvalue().
Sebastian Harl [Tue, 14 Oct 2014 07:13:11 +0000 (09:13 +0200)]
store: Added sdb_store_expr_attrvalue().

This function allows to use attribute values in an expression.

10 years agostore: Added sdb_store_get_attr().
Sebastian Harl [Mon, 13 Oct 2014 07:18:41 +0000 (09:18 +0200)]
store: Added sdb_store_get_attr().

10 years agostore: sdb_store_get_field: Make result parameter optional.
Sebastian Harl [Mon, 13 Oct 2014 07:07:37 +0000 (09:07 +0200)]
store: sdb_store_get_field: Make result parameter optional.

10 years agot/cibuild.sh: Use 'make -j10' to run tests in parallel.
Sebastian Harl [Fri, 10 Oct 2014 11:12:07 +0000 (13:12 +0200)]
t/cibuild.sh: Use 'make -j10' to run tests in parallel.

10 years agointegration tests: Split simple_query into query, matching, and filter.
Sebastian Harl [Fri, 10 Oct 2014 11:02:57 +0000 (13:02 +0200)]
integration tests: Split simple_query into query, matching, and filter.

10 years agointegration tests: Make sure test_lib always knows about the socket file.
Sebastian Harl [Fri, 10 Oct 2014 10:21:22 +0000 (12:21 +0200)]
integration tests: Make sure test_lib always knows about the socket file.

10 years agofrontend/parser: Added support for string concatenation.
Sebastian Harl [Thu, 9 Oct 2014 06:57:07 +0000 (08:57 +0200)]
frontend/parser: Added support for string concatenation.

10 years agofrontend/grammary.y: Renamed 'op' to 'cmp'.
Sebastian Harl [Wed, 8 Oct 2014 20:29:57 +0000 (22:29 +0200)]
frontend/grammary.y: Renamed 'op' to 'cmp'.

That's a better name ;-)

10 years agodata: Added sdb_data_parse_op().
Sebastian Harl [Wed, 8 Oct 2014 10:24:51 +0000 (12:24 +0200)]
data: Added sdb_data_parse_op().

This function parses the string representation of an operator.

10 years agostore: Added quaryable field ‘name’.
Sebastian Harl [Tue, 7 Oct 2014 21:28:33 +0000 (23:28 +0200)]
store: Added quaryable field ‘name’.

10 years agodata: Document that regexes are extended, case-insensitive POSIX regexes.
Sebastian Harl [Tue, 7 Oct 2014 19:45:13 +0000 (21:45 +0200)]
data: Document that regexes are extended, case-insensitive POSIX regexes.

10 years agodata: Added support for a "regex" data-type.
Sebastian Harl [Tue, 7 Oct 2014 19:41:54 +0000 (21:41 +0200)]
data: Added support for a "regex" data-type.

This type may be used to store the raw and compiled regex in a datum and use
regexes in all places in which a generic value may be used. It does not
support any arithmetic or concatenation operations.

10 years agodata_test: Fixed name/order of the cmp() and strcmp() tests.
Sebastian Harl [Tue, 7 Oct 2014 19:30:32 +0000 (21:30 +0200)]
data_test: Fixed name/order of the cmp() and strcmp() tests.

;-)

10 years agodata_test: Fixed a typo.
Sebastian Harl [Tue, 7 Oct 2014 19:11:34 +0000 (21:11 +0200)]
data_test: Fixed a typo.

10 years agodata: Fixed copying of NULL data.
Sebastian Harl [Tue, 7 Oct 2014 17:43:24 +0000 (19:43 +0200)]
data: Fixed copying of NULL data.

10 years agoversion-gen.sh: Added .git suffix to default version again.
Sebastian Harl [Mon, 6 Oct 2014 19:51:49 +0000 (21:51 +0200)]
version-gen.sh: Added .git suffix to default version again.

10 years agoRelease SysDB 0.5.0. sysdb-0.5.0
Sebastian Harl [Mon, 6 Oct 2014 19:44:37 +0000 (21:44 +0200)]
Release SysDB 0.5.0.

10 years agoReleaseNotes: Added entry for the 0.5.0 release.
Sebastian Harl [Mon, 6 Oct 2014 19:44:03 +0000 (21:44 +0200)]
ReleaseNotes: Added entry for the 0.5.0 release.

10 years agot/valgrind.suppress: Use a pattern for the full name of gcov_exit.
Sebastian Harl [Mon, 6 Oct 2014 18:34:51 +0000 (20:34 +0200)]
t/valgrind.suppress: Use a pattern for the full name of gcov_exit.

For example, I've seen gcov_exit.part.5.

10 years agosysdbql(7): Fixed an incomplete sentence.
Sebastian Harl [Mon, 6 Oct 2014 18:24:17 +0000 (20:24 +0200)]
sysdbql(7): Fixed an incomplete sentence.

10 years agosysdbql(7): Updated documentation for attribute and field access.
Sebastian Harl [Mon, 6 Oct 2014 06:29:32 +0000 (08:29 +0200)]
sysdbql(7): Updated documentation for attribute and field access.

10 years agofrontend/grammar: Use '.' instead of ':' to access queryable object fields.
Sebastian Harl [Mon, 6 Oct 2014 06:24:13 +0000 (08:24 +0200)]
frontend/grammar: Use '.' instead of ':' to access queryable object fields.

10 years agofrontend/grammar: Access attribute values using attributes[<name>].
Sebastian Harl [Mon, 6 Oct 2014 06:18:10 +0000 (08:18 +0200)]
frontend/grammar: Access attribute values using attributes[<name>].

… instead of attribute.<name>. We'll use <obj>.<field> for all directly
accessible object fields instead.

10 years agostore_lookup: Compare attribute string values on type mismatch.
Sebastian Harl [Sun, 5 Oct 2014 18:49:19 +0000 (20:49 +0200)]
store_lookup: Compare attribute string values on type mismatch.

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.

10 years agodata: Added sdb_data_strcmp().
Sebastian Harl [Sun, 5 Oct 2014 18:43:24 +0000 (20:43 +0200)]
data: Added sdb_data_strcmp().

This function compares the string values of two data points.

10 years agodata: Use %g format when formatting decimal numbers.
Sebastian Harl [Sun, 5 Oct 2014 18:39:33 +0000 (20:39 +0200)]
data: Use %g format when formatting decimal numbers.

This is much better human-readable and we don't need an exact representation.
In fact, given that a datum's string value is used when comparing attribute
values, the human readable format is much better suited given that chances are
higher that users will enter numbers in the same format (but it's still just a
best guess kind of thing).

10 years agodata: Added sdb_data_isnull().
Sebastian Harl [Sun, 5 Oct 2014 18:25:32 +0000 (20:25 +0200)]
data: Added sdb_data_isnull().

The function determines if a datum pointer or a string or binary datum is
NULL.

10 years agodata: Format NULL values as "<NULL>".
Sebastian Harl [Sun, 5 Oct 2014 18:23:26 +0000 (20:23 +0200)]
data: Format NULL values as "<NULL>".

10 years agostore_lookup: Fixed lookup by back-end name.
Sebastian Harl [Sun, 5 Oct 2014 17:50:20 +0000 (19:50 +0200)]
store_lookup: Fixed lookup by back-end name.

Added an integration test which reproduces the problem -- previously, all
compare operations reported a mismatch.

10 years agodata: Ensure a stable ordering in cmp() in case of type-mismatches.
Sebastian Harl [Sun, 5 Oct 2014 17:19:49 +0000 (19:19 +0200)]
data: Ensure a stable ordering in cmp() in case of type-mismatches.

So far, this doesn't make a difference but it's better style anyway.

10 years agostore_lookup: Fixed parsing of invalid compare expressions.
Sebastian Harl [Sun, 5 Oct 2014 16:19:39 +0000 (18:19 +0200)]
store_lookup: Fixed parsing of invalid compare expressions.

Previously, expressions like 'host.foo != 123' would be silently accepted by
the parser.

Added test cases to reproduce and catch the problem.

10 years agoutils dbi: Guard against multiple calls to dbi_shutdown_r().
Sebastian Harl [Sun, 5 Oct 2014 16:10:09 +0000 (18:10 +0200)]
utils dbi: Guard against multiple calls to dbi_shutdown_r().

This should not happen anyway but better be safe than sorry.