From: Eric Leblond Date: Thu, 16 Apr 2009 08:21:49 +0000 (+0200) Subject: DB plugin: add capability to specify complete INSERT command X-Git-Tag: ulogd-2.0.0beta4~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49122eee73d381cb24539e0b81092bf8a4b1870d;p=thirdparty%2Fulogd2.git 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. --- 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++) {