summaryrefslogtreecommitdiffstats
path: root/plugins/omoracle
diff options
context:
space:
mode:
authorLuis Fernando Muñoz Mejías <Luis.Fernando.Munoz.Mejias@cern.ch>2009-04-15 16:53:20 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-04-16 15:27:11 +0200
commitca28204f7ba5c5c520b52180e26471e12af83560 (patch)
tree420fcb42a71cba40f868ad5f8c36cba80703a591 /plugins/omoracle
parent9a897329ec6f80c99ca039f12388961417e0a422 (diff)
downloadrsyslog-ca28204f7ba5c5c520b52180e26471e12af83560.tar.gz
rsyslog-ca28204f7ba5c5c520b52180e26471e12af83560.tar.xz
rsyslog-ca28204f7ba5c5c520b52180e26471e12af83560.zip
Add the callback for OCIBindDynamic.
Let's hope it works.
Diffstat (limited to 'plugins/omoracle')
-rw-r--r--plugins/omoracle/omoracle.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c
index 7199f3e1..48b97b27 100644
--- a/plugins/omoracle/omoracle.c
+++ b/plugins/omoracle/omoracle.c
@@ -179,6 +179,34 @@ static int oci_errors(void* handle, ub4 htype, sword status)
return OCI_ERROR;
}
+/** Callback for OCIBindDynamic.
+ *
+ * OCI doesn't insert an array of char* by itself (although it can
+ * handle arrays of int), so we must either run in batches of size one
+ * (no way) or bind all parameters with OCI_DATA_AT_EXEC instead of
+ * OCI_DEFAULT, and then give this function as an argument to
+ * OCIBindDynamic so that it is able to handle all strings in a single
+ * server trip.
+ *
+ * See the documentation of OCIBindDynamic
+ * (http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28395/oci16rel003.htm#i444015)
+ * for more details.
+ */
+static int __attribute__((unused))
+bind_dynamic (char** in, OCIBind __attribute__((unused))* bind,
+ int iter, int __attribute__((unused)) idx,
+ char** out, int* buflen, char* piece,
+ void** bd)
+{
+ dbgprintf ("Bound line: %s\n", in[iter]);
+ *out = in[iter];
+ *buflen = sizeof (OCILobLocator*);
+ *piece = OCI_ONE_PIECE;
+ *bd = NULL;
+ return OCI_CONTINUE;
+}
+
+
/** Returns the number of bind parameters for the statement given as
* an argument. It counts the number of appearances of ':', as in
*