summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Leblond <eric@inl.fr>2009-04-16 10:21:49 +0200
committerEric Leblond <eric@inl.fr>2009-04-17 07:38:59 +0200
commit49122eee73d381cb24539e0b81092bf8a4b1870d (patch)
tree25e40cd477506e51b773154c00260320d0a289f9
parenta03ac74abde5fb2236d9d9aa57a3ba10f8e7bdc4 (diff)
DB plugin: add capability to specify complete INSERT command
This patch modifies the procedure name parsing to be able to specify a complete INSERT command.
-rw-r--r--util/db.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/util/db.c b/util/db.c
index fee91b2..c2b674e 100644
--- a/util/db.c
+++ b/util/db.c
@@ -91,14 +91,19 @@ static int sql_createstmt(struct ulogd_pluginstance *upi)
return -ENOMEM;
}
- if (strcasecmp(procedure,"INSERT") == 0) {
- char buf[ULOGD_MAX_KEYLEN];
- char *underscore;
+ if (strncasecmp(procedure, "INSERT INTO", strlen("INSERT INTO")) == 0)
+ sprintf(mi->stmt, "%s (", procedure);
+ if (strcasecmp(procedure,"INSERT") == 0) {
if (mi->schema)
sprintf(mi->stmt, "insert into %s.%s (", mi->schema, table);
else
sprintf(mi->stmt, "insert into %s (", table);
+ }
+
+ if (strncasecmp(procedure,"INSERT", strlen("INSERT")) == 0) {
+ char buf[ULOGD_MAX_KEYLEN];
+ char *underscore;
mi->stmt_val = mi->stmt + strlen(mi->stmt);
for (i = 0; i < upi->input.num_keys; i++) {