Commit 1c8b3af0 authored by Mikael Ottela's avatar Mikael Ottela

More proper handling of NULLs in aggregates

svn path=/trunk/; revision=2999
parent ee7583bb
2009-03-02 Mikael Ottela <mikael.ottela@ixonos.com>
* src/libtracker-db/tracker-db-interface-sqlite.c
* src/libtracker-db/tracker-db-manager.c: More proper handling of
NULLs in aggregates.
2009-03-02 Mikael Ottela <mikael.ottela@ixonos.com>
* src/trackerd/tracker-search.c
......
......@@ -404,6 +404,10 @@ internal_sqlite3_aggregate_step (sqlite3_context *context,
break;
}
case SQLITE_NULL: {
/* Ignore NULLs and let the function handle missing values */
break;
}
default:
g_critical ("Unknown sqlite3 database value type:%d",
sqlite3_value_type (argv[i]));
......@@ -417,7 +421,10 @@ internal_sqlite3_aggregate_step (sqlite3_context *context,
/* Now free all this mess */
for (i = 0; i < argc; i++) {
g_value_unset (&values[i]);
/* Don't free NULLs */
if (G_VALUE_TYPE (&values[i]) != G_TYPE_INVALID) {
g_value_unset (&values[i]);
}
}
g_free (values);
......
......@@ -1344,8 +1344,10 @@ function_group_concat_step (TrackerDBInterface *interface,
} else {
p->string = g_string_append (p->string, "|");
}
p->string = g_string_append (p->string, g_value_get_string (&values[0]));
if (G_VALUE_HOLDS_STRING (&values[0])) {
p->string = g_string_append (p->string, g_value_get_string (&values[0]));
}
}
static GValue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment