summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f18c305)
raw | patch | inline | side by side (parent: f18c305)
author | Sebastian Harl <sh@tokkee.org> | |
Tue, 30 Mar 2010 19:55:13 +0000 (21:55 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Tue, 30 Mar 2010 19:55:13 +0000 (21:55 +0200) |
The interval is specified when calling udb_query_prepare_result(). A value
less than or equal to zero may be used to let udb use the default
(interval_g).
The dbi, oracle, and postgresql plugins have been updated accordingly.
less than or equal to zero may be used to let udb use the default
(interval_g).
The dbi, oracle, and postgresql plugins have been updated accordingly.
src/dbi.c | patch | blob | history | |
src/oracle.c | patch | blob | history | |
src/postgresql.c | patch | blob | history | |
src/utils_db_query.c | patch | blob | history | |
src/utils_db_query.h | patch | blob | history |
diff --git a/src/dbi.c b/src/dbi.c
index 5dad197cc5f671b3a803bae7ceabdc87c94523cb..77f393f5fc6a606c8151860617f4da4b9f62a0d3 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
udb_query_prepare_result (q, prep_area, hostname_g,
/* plugin = */ "dbi", db->name,
- column_names, column_num);
+ column_names, column_num, /* interval = */ -1);
/* 0 = error; 1 = success; */
status = dbi_result_first_row (res); /* {{{ */
diff --git a/src/oracle.c b/src/oracle.c
index 7ab5a0c16b233243e2feb7d572e3211f605a5c77..3fe21254ab33f08391ec7c45c6c26216ec074816 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
/* }}} End of the ``define'' stuff. */
status = udb_query_prepare_result (q, prep_area, hostname_g,
- /* plugin = */ "oracle", db->name, column_names, column_num);
+ /* plugin = */ "oracle", db->name, column_names, column_num,
+ /* interval = */ -1);
if (status != 0)
{
ERROR ("oracle plugin: o_read_database_query (%s, %s): "
diff --git a/src/postgresql.c b/src/postgresql.c
index 431f8e3bbfb71b351fcb7ff7089a8d284c4d88e7..99e40fecd5328ab8cb9ba94fdfe9cf0ae0042876 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
host = db->host;
status = udb_query_prepare_result (q, prep_area, host, "postgresql",
- db->database, column_names, (size_t) column_num);
+ db->database, column_names, (size_t) column_num, db->interval);
if (0 != status) {
log_err ("udb_query_prepare_result failed with status %i.",
status);
diff --git a/src/utils_db_query.c b/src/utils_db_query.c
index 13cdf9e57871226f69991c90652d457f895cf5f3..7d594d812a4e0bf2f0f1b9c3e936ec762f917e5a 100644 (file)
--- a/src/utils_db_query.c
+++ b/src/utils_db_query.c
char *plugin;
char *db_name;
+ int interval;
+
udb_result_preparation_area_t *result_prep_areas;
}; /* }}} */
return (-1);
}
+ if (q_area->interval > 0)
+ vl.interval = q_area->interval;
+
sstrncpy (vl.host, q_area->host, sizeof (vl.host));
sstrncpy (vl.plugin, q_area->plugin, sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, q_area->db_name, sizeof (vl.type_instance));
}
}
+ if (q_area->interval > 0)
+ vl.interval = q_area->interval;
+
sstrncpy (vl.host, q_area->host, sizeof (vl.host));
sstrncpy (vl.plugin, q_area->plugin, sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, q_area->db_name, sizeof (vl.type_instance));
sfree (prep_area->plugin);
sfree (prep_area->db_name);
+ prep_area->interval = -1;
+
for (r = q->results, r_area = prep_area->result_prep_areas;
r != NULL; r = r->next, r_area = r_area->next)
{
int udb_query_prepare_result (const udb_query_t const *q, /* {{{ */
udb_query_preparation_area_t *prep_area,
const char *host, const char *plugin, const char *db_name,
- char **column_names, size_t column_num)
+ char **column_names, size_t column_num, int interval)
{
udb_result_preparation_area_t *r_area;
udb_result_t *r;
prep_area->plugin = strdup (plugin);
prep_area->db_name = strdup (db_name);
+ prep_area->interval = interval;
+
if ((prep_area->host == NULL) || (prep_area->plugin == NULL)
|| (prep_area->db_name == NULL))
{
diff --git a/src/utils_db_query.h b/src/utils_db_query.h
index da235f798b1f4ee268485b13983d3591d2bfa708..fa2b2885679c435245b836f4cbc4ccb01556c5db 100644 (file)
--- a/src/utils_db_query.h
+++ b/src/utils_db_query.h
int udb_query_prepare_result (const udb_query_t const *q,
udb_query_preparation_area_t *prep_area,
const char *host, const char *plugin, const char *db_name,
- char **column_names, size_t column_num);
+ char **column_names, size_t column_num, int interval);
int udb_query_handle_result (const udb_query_t const *q,
udb_query_preparation_area_t *prep_area, char **column_values);
void udb_query_finish_result (const udb_query_t const *q,