summaryrefslogtreecommitdiffstats
path: root/src/query.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-01-24 01:28:18 +0000
committerDavid Robillard <d@drobilla.net>2008-01-24 01:28:18 +0000
commit6c3ab050cfbbbd80dd795643dcf65e6c5915dec4 (patch)
tree30ce97e6b1baf94b24f3b1334b1a1b64ed3ec7f3 /src/query.c
parentffe407b7047e85fab66f334f1f879aa27d2a11bd (diff)
downloadlilv-6c3ab050cfbbbd80dd795643dcf65e6c5915dec4.tar.gz
lilv-6c3ab050cfbbbd80dd795643dcf65e6c5915dec4.tar.bz2
lilv-6c3ab050cfbbbd80dd795643dcf65e6c5915dec4.zip
Kludge around string<->number issues in locales with a ',' decimal point, and locale bugs in librdf.
git-svn-id: http://svn.drobilla.net/lad/slv2@1110 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/query.c')
-rw-r--r--src/query.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/query.c b/src/query.c
index 54dcda4..988e117 100644
--- a/src/query.c
+++ b/src/query.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <assert.h>
#include <librdf.h>
+#include <locale.h>
#include <limits.h>
#include <slv2/plugin.h>
#include <slv2/util.h>
@@ -52,7 +53,11 @@ slv2_query_get_variable_bindings(SLV2World world,
librdf_node* node =
librdf_query_results_get_binding_value(results, variable);
- assert(node);
+ if (!node) {
+ fprintf(stderr, "SLV2 ERROR: Variable %d bound to NULL.\n", variable);
+ librdf_query_results_next(results);
+ continue;
+ }
librdf_uri* datatype_uri = NULL;
SLV2ValueType type = SLV2_VALUE_STRING;
@@ -138,7 +143,14 @@ slv2_plugin_query(SLV2Plugin plugin,
return NULL;
}
+ // FIXME: locale kludges to work around librdf bug
+ char* locale = strdup(setlocale(LC_NUMERIC, NULL));
+
+ setlocale(LC_NUMERIC, "POSIX");
librdf_query_results* results = librdf_query_execute(query, plugin->rdf);
+ setlocale(LC_NUMERIC, locale);
+
+ free(locale);
librdf_free_query(query);
free(query_str);