summaryrefslogtreecommitdiffstats
path: root/output
diff options
context:
space:
mode:
authorlaforge <laforge>2005-11-20 21:19:50 +0000
committerlaforge <laforge>2005-11-20 21:19:50 +0000
commit72494d5edecd7fc0f360339bdc294dde9b67e4b2 (patch)
tree5d3ed2950b7d043dac8494e23a4632cfd9271a49 /output
parentc2ad18e846a6862791762b512310707738985780 (diff)
finally fix up MYSQL module to build correctly
Diffstat (limited to 'output')
-rw-r--r--output/mysql/ulogd_output_MYSQL.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/output/mysql/ulogd_output_MYSQL.c b/output/mysql/ulogd_output_MYSQL.c
index 602654e..4e75590 100644
--- a/output/mysql/ulogd_output_MYSQL.c
+++ b/output/mysql/ulogd_output_MYSQL.c
@@ -148,14 +148,14 @@ static int interp_mysql(struct ulogd_pluginstance *upi)
mi->stmt_ins = mi->stmt_val;
- for (i = 0; i < upi->input.num; i++) {
- res = upi->input[i].u.source;
+ for (i = 0; i < upi->input.num_keys; i++) {
+ res = upi->input.keys[i].u.source;
if (!res)
ulogd_log(ULOGD_NOTICE, "no result for %s ?!?\n",
- upi->input[i].name);
+ upi->input.keys[i].name);
- if (!res || !IS_VALID(res)) {
+ if (!res || !IS_VALID(*res)) {
/* no result, we have to fake something */
sprintf(mi->stmt_ins, "NULL,");
mi->stmt_ins = mi->stmt + strlen(mi->stmt);
@@ -187,7 +187,7 @@ static int interp_mysql(struct ulogd_pluginstance *upi)
addr.s_addr = ntohl(res->u.value.ui32);
*(mi->stmt_ins++) = '\'';
tmpstr = inet_ntoa(addr);
-#ifdef LD_MYSQL
+#ifdef OLD_MYSQL
mysql_escape_string(mi->stmt_ins, tmpstr,
strlen(tmpstr));
#else
@@ -224,12 +224,12 @@ static int interp_mysql(struct ulogd_pluginstance *upi)
case ULOGD_RET_RAW:
ulogd_log(ULOGD_NOTICE,
"%s: type RAW not supported by MySQL\n",
- upi->input[i].name);
+ upi->input.keys[i].name);
break;
default:
ulogd_log(ULOGD_NOTICE,
"unknown type %d for %s\n",
- res->type, upi->input[i].name);
+ res->type, upi->input.keys[i].name);
break;
}
mi->stmt_ins = mi->stmt + strlen(mi->stmt);
@@ -278,7 +278,7 @@ static int mysql_createstmt(struct ulogd_pluginstance *upi)
for (i = 0; i < upi->input.num_keys; i++) {
/* we need space for the key and a comma, as well as
* enough space for the values */
- size += strlen(upi->input[i].name) + 1 + MYSQL_VALSIZE;
+ size += strlen(upi->input.keys[i].name) + 1 + MYSQL_VALSIZE;
}
ulogd_log(ULOGD_DEBUG, "allocating %u bytes for statement\n", size);
@@ -294,7 +294,7 @@ static int mysql_createstmt(struct ulogd_pluginstance *upi)
mi->stmt_val = mi->stmt + strlen(mi->stmt);
for (i = 0; i < upi->input.num_keys; i++) {
- strncpy(buf, upi->input[i].name, ULOGD_MAX_KEYLEN);
+ strncpy(buf, upi->input.keys[i].name, ULOGD_MAX_KEYLEN);
while ((underscore = strchr(buf, '.')))
*underscore = '_';
sprintf(mi->stmt_val, "%s,", buf);
@@ -334,14 +334,14 @@ static int mysql_get_columns(struct ulogd_pluginstance *upi)
* never free()s the memory we allocate here. FIXME. */
/* Cleanup before reconnect */
- if (upi->input) {
- free(upi->input);
- upi->input = NULL;
+ if (upi->input.keys) {
+ free(upi->input.keys);
+ upi->input.keys = NULL;
}
- upi->input = malloc(sizeof(struct ulogd_key) *
+ upi->input.keys = malloc(sizeof(struct ulogd_key) *
mysql_field_count(mi->dbh));
- if (!upi->input)
+ if (!upi->input.keys)
return -ENOMEM;
i = 0;
@@ -358,7 +358,7 @@ static int mysql_get_columns(struct ulogd_pluginstance *upi)
DEBUGP("field '%s' found: ", buf);
/* add it u list of input keys */
- strncpy(upi->input[i].name, buf, ULOGD_MAX_KEYLEN);
+ strncpy(upi->input.keys[i].name, buf, ULOGD_MAX_KEYLEN);
i++;
}
@@ -503,9 +503,9 @@ static int stop_mysql(struct ulogd_pluginstance *upi)
mysql_close(mi->dbh);
/* try to free our dynamically allocated input key array */
- if (upi->input) {
- free(upi->input);
- upi->input = 0;
+ if (upi->input.keys) {
+ free(upi->input.keys);
+ upi->input.keys = NULL;
}
return 0;
}