From 56ab48677e9636e309e45794f7b516e3744731ac Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Sun, 15 Jan 2012 13:16:01 +0100 Subject: Support stored mysql procedures besides stored functions 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. Signed-off-by: Jozsef Kadlecsik --- util/db.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util') 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); -- cgit v1.2.3