From 49122eee73d381cb24539e0b81092bf8a4b1870d Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Thu, 16 Apr 2009 10:21:49 +0200 Subject: 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. --- util/db.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'util') 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++) { -- cgit v1.2.3