From: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
To: netfilter-devel@vger.kernel.org
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
marty <martinbarrowcliff@gmail.com>,
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Subject: [PATCH 1/2] Support stored mysql procedures besides stored functions
Date: Sun, 15 Jan 2012 16:04:48 +0100 [thread overview]
Message-ID: <1326639889-28836-2-git-send-email-kadlec@blackhole.kfki.hu> (raw)
In-Reply-To: <1326639889-28836-1-git-send-email-kadlec@blackhole.kfki.hu>
MySQL stored procedures must be invoked by the "CALL" SQL command and
not by "SELECT". Add the convention that if the procedure name starts
with "CALL", then the issued SQL command is "CALL procedurename(args)".
The stored procedure support in MySQL automatically brings transaction
support too.
---
doc/ulogd.sgml | 4 ++++
util/db.c | 2 ++
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/doc/ulogd.sgml b/doc/ulogd.sgml
index 547b56a..0f18611 100644
--- a/doc/ulogd.sgml
+++ b/doc/ulogd.sgml
@@ -471,6 +471,10 @@ If procedure name is:
"table" variable.</item>
<item>start with "INSERT ": Configuration has to specify the start of the INSERT query that will be used. For example,
a typical value is "INSERT INTO ulog2".</item>
+<item>start with "CALL": the named stored procedure is executed with
+the "CALL" MySQL command.</item>
+<item>Otherwise the named stored function is executed with
+the "SELECT" MySQL command.</item>
</itemize>
<tag>db</tag>
Name of the mysql database.
diff --git a/util/db.c b/util/db.c
index 8d812c7..54f8882 100644
--- a/util/db.c
+++ b/util/db.c
@@ -122,6 +122,8 @@ static int sql_createstmt(struct ulogd_pluginstance *upi)
*(mi->stmt_val - 1) = ')';
sprintf(mi->stmt_val, " values (");
+ } else if (strncasecmp(procedure,"CALL", strlen("CALL")) == 0) {
+ sprintf(mi->stmt, "CALL %s(", procedure);
} else {
sprintf(mi->stmt, "SELECT %s(", procedure);
--
1.7.0.4
next prev parent reply other threads:[~2012-01-15 15:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-15 15:04 [PATCH 0/2] ulogd2 patches Jozsef Kadlecsik
2012-01-15 15:04 ` Jozsef Kadlecsik [this message]
2012-01-15 15:04 ` [PATCH 2/2] A simple filter plugin called IP2HBIN added Jozsef Kadlecsik
2012-01-16 12:46 ` [PATCH 0/2] ulogd2 patches Pablo Neira Ayuso
2012-01-16 15:58 ` Jozsef Kadlecsik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326639889-28836-2-git-send-email-kadlec@blackhole.kfki.hu \
--to=kadlec@blackhole.kfki.hu \
--cc=martinbarrowcliff@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).