summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0633a31)
raw | patch | inline | side by side (parent: 0633a31)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 19:14:32 +0000 (20:14 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 4 Nov 2014 19:14:32 +0000 (20:14 +0100) |
… but only when parsing a full statement. Otherwise, the analyzer is missing
the context for verification.
the context for verification.
src/frontend/parser.c | patch | blob | history | |
src/frontend/query.c | patch | blob | history |
diff --git a/src/frontend/parser.c b/src/frontend/parser.c
index 785b7e40b59caecc3f34d5e8660f7d04f918e397..f8c82d3e234b856506bb3461b0563ab1f38505fc 100644 (file)
--- a/src/frontend/parser.c
+++ b/src/frontend/parser.c
{
sdb_fe_yyscan_t scanner;
sdb_fe_yyextra_t yyextra;
+ sdb_llist_iter_t *iter;
int yyres;
if (scanner_init(query, len, &scanner, &yyextra))
sdb_llist_destroy(yyextra.parsetree);
return NULL;
}
+
+ iter = sdb_llist_get_iter(yyextra.parsetree);
+ while (sdb_llist_iter_has_next(iter)) {
+ sdb_conn_node_t *node;
+ node = SDB_CONN_NODE(sdb_llist_iter_get_next(iter));
+ if (sdb_fe_analyze(node)) {
+ sdb_llist_iter_destroy(iter);
+ sdb_llist_destroy(yyextra.parsetree);
+ return NULL;
+ }
+ }
+ sdb_llist_iter_destroy(iter);
return yyextra.parsetree;
} /* sdb_fe_parse */
diff --git a/src/frontend/query.c b/src/frontend/query.c
index 7b105e731bf056af321611bc444a2a7287151d6a..e5a1fc43263b925653f71539ca369a5f677646b7 100644 (file)
--- a/src/frontend/query.c
+++ b/src/frontend/query.c
}
if (node) {
- if (sdb_fe_analyze(node)) {
- char query[conn->cmd_len + 1];
- strncpy(query, sdb_strbuf_string(conn->buf), conn->cmd_len);
- query[sizeof(query) - 1] = '\0';
- sdb_log(SDB_LOG_ERR, "frontend: Failed to verify query '%s'",
- query);
- status = -1;
- }
- else
- status = sdb_fe_exec(conn, node);
+ status = sdb_fe_exec(conn, node);
sdb_object_deref(SDB_OBJ(node));
}
node.type = type;
m_node.matcher = m;
+ /* run analyzer separately; parse_matcher is missing
+ * the right context to do so */
if (sdb_fe_analyze(SDB_CONN_NODE(&node))) {
char expr[matcher_len + 1];
strncpy(expr, matcher, sizeof(expr));