X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Foracle.c;h=4415b489e6d55c0712840f1313b65be5af11072c;hb=cd35a6a4528cf78383266fbae770b9c7161fda25;hp=1332da273a7db95427b0476131a0d37edbe23e0e;hpb=77460335ec305aa4fbd8218c6e5c1c849fbef9c0;p=collectd.git diff --git a/src/oracle.c b/src/oracle.c index 1332da27..4415b489 100644 --- a/src/oracle.c +++ b/src/oracle.c @@ -91,15 +91,16 @@ static void o_report_error (const char *where, /* {{{ */ char buffer[2048]; sb4 error_code; int status; + unsigned int record_number; /* An operation may cause / return multiple errors. Loop until we have - * handled all errors available. */ - while (42) + * handled all errors available (with a fail-save limit of 16). */ + for (record_number = 1; record_number <= 16; record_number++) { memset (buffer, 0, sizeof (buffer)); error_code = -1; - status = OCIErrorGet (eh, /* record number = */ 1, + status = OCIErrorGet (eh, (ub4) record_number, /* sqlstate = */ NULL, &error_code, (text *) &buffer[0], @@ -121,8 +122,7 @@ static void o_report_error (const char *where, /* {{{ */ buffer[buffer_length] = 0; } - ERROR ("oracle plugin: %s: %s failed: %s", - where, what, buffer); + ERROR ("oracle plugin: %s: %s failed: %s", where, what, buffer); } else { @@ -344,7 +344,7 @@ static int o_config (oconfig_item_t *ci) /* {{{ */ oconfig_item_t *child = ci->children + i; if (strcasecmp ("Query", child->key) == 0) udb_query_create (&queries, &queries_num, child, - /* callback = */ NULL, /* legacy mode = */ 0); + /* callback = */ NULL); else if (strcasecmp ("Database", child->key) == 0) o_config_add_database (child); else @@ -603,7 +603,7 @@ static int o_read_database_query (o_database_t *db, /* {{{ */ status = udb_query_prepare_result (q, prep_area, hostname_g, /* plugin = */ "oracle", db->name, column_names, column_num, - /* interval = */ -1); + /* interval = */ 0); if (status != 0) { ERROR ("oracle plugin: o_read_database_query (%s, %s): " @@ -700,7 +700,7 @@ static int o_read_database (o_database_t *db) /* {{{ */ (OraText *) db->username, (ub4) strlen (db->username), (OraText *) db->password, (ub4) strlen (db->password), (OraText *) db->connect_id, (ub4) strlen (db->connect_id)); - if (status != OCI_SUCCESS) + if ((status != OCI_SUCCESS) && (status != OCI_SUCCESS_WITH_INFO)) { o_report_error ("o_read_database", "OCILogon", oci_error); DEBUG ("oracle plugin: OCILogon (%s): db->oci_service_context = %p;", @@ -708,6 +708,10 @@ static int o_read_database (o_database_t *db) /* {{{ */ db->oci_service_context = NULL; return (-1); } + else if (status == OCI_SUCCESS_WITH_INFO) + { + /* TODO: Print NOTIFY message. */ + } assert (db->oci_service_context != NULL); }