if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
WARNING("oracle plugin: The `Database' block "
"needs exactly one string argument.");
if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) {
WARNING("oracle plugin: The `Database' block "
"needs exactly one string argument.");
}
db = calloc(1, sizeof(*db));
if (db == NULL) {
ERROR("oracle plugin: calloc failed.");
}
db = calloc(1, sizeof(*db));
if (db == NULL) {
ERROR("oracle plugin: calloc failed.");
status = cf_util_get_string(child, &db->username);
else if (strcasecmp("Password", child->key) == 0)
status = cf_util_get_string(child, &db->password);
status = cf_util_get_string(child, &db->username);
else if (strcasecmp("Password", child->key) == 0)
status = cf_util_get_string(child, &db->password);
else if (strcasecmp("Query", child->key) == 0)
status = udb_query_pick_from_list(child, queries, queries_num,
&db->queries, &db->queries_num);
else if (strcasecmp("Query", child->key) == 0)
status = udb_query_pick_from_list(child, queries, queries_num,
&db->queries, &db->queries_num);
- DEBUG("oracle plugin: o_config: queries_num = %zu; queries[0] = %p; "
- "udb_query_get_user_data (queries[0]) = %p;",
- queries_num, (void *)queries[0],
- udb_query_get_user_data(queries[0]));
+ DEBUG(
+ "oracle plugin: o_config: queries_num = %" PRIsz "; queries[0] = %p; "
+ "udb_query_get_user_data (queries[0]) = %p;",
+ queries_num, (void *)queries[0], udb_query_get_user_data(queries[0]));
status = OCIEnvCreate(&oci_env,
/* mode = */ OCI_THREADED,
status = OCIEnvCreate(&oci_env,
/* mode = */ OCI_THREADED,
/* user_data_ptr = */ NULL);
if (status != 0) {
ERROR("oracle plugin: OCIEnvCreate failed with status %i.", status);
/* user_data_ptr = */ NULL);
if (status != 0) {
ERROR("oracle plugin: OCIEnvCreate failed with status %i.", status);
}
status = OCIHandleAlloc(oci_env, (void *)&oci_error, OCI_HTYPE_ERROR,
}
status = OCIHandleAlloc(oci_env, (void *)&oci_error, OCI_HTYPE_ERROR,
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIHandleAlloc", oci_error);
oci_statement = NULL;
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIHandleAlloc", oci_error);
oci_statement = NULL;
}
status = OCIStmtPrepare(oci_statement, oci_error, (text *)statement,
}
status = OCIStmtPrepare(oci_statement, oci_error, (text *)statement,
"OCIStmtPrepare", oci_error);
OCIHandleFree(oci_statement, OCI_HTYPE_STMT);
oci_statement = NULL;
"OCIStmtPrepare", oci_error);
OCIHandleFree(oci_statement, OCI_HTYPE_STMT);
oci_statement = NULL;
if (status != OCI_SUCCESS) {
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIStmtExecute", oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIStmtExecute", oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIAttrGet", oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database_query", db->name, udb_query_get_name(q),
"OCIAttrGet", oci_error);
for (size_t i = 1; i < column_num; i++)
column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
for (size_t i = 1; i < column_num; i++)
column_names[i] = column_names[i - 1] + DATA_MAX_NAME_LEN;
ALLOC_OR_FAIL(column_values, column_num * sizeof(char *));
memcpy(column_names[i], column_name, column_name_length);
column_names[i][column_name_length] = 0;
memcpy(column_names[i], column_name, column_name_length);
column_names[i][column_name_length] = 0;
- DEBUG("oracle plugin: o_read_database_query: column_names[%zu] = %s; "
- "column_name_length = %" PRIu32 ";",
+ DEBUG("oracle plugin: o_read_database_query: column_names[%" PRIsz "] = %s;"
+ " column_name_length = %" PRIu32 ";",
i, column_names[i], (uint32_t)column_name_length);
status = OCIDefineByPos(oci_statement, &oci_defines[i], oci_error,
i, column_names[i], (uint32_t)column_name_length);
status = OCIDefineByPos(oci_statement, &oci_defines[i], oci_error,
status = udb_query_prepare_result(
q, prep_area, (db->host != NULL) ? db->host : hostname_g,
status = udb_query_prepare_result(
q, prep_area, (db->host != NULL) ? db->host : hostname_g,
- /* plugin = */ "oracle", db->name, column_names, column_num,
+ /* plugin = */ (db->plugin_name != NULL) ? db->plugin_name : "oracle",
+ db->name, column_names, column_num,
/* interval = */ 0);
if (status != 0) {
ERROR("oracle plugin: o_read_database_query (%s, %s): "
"udb_query_prepare_result failed.",
db->name, udb_query_get_name(q));
FREE_ALL;
/* interval = */ 0);
if (status != 0) {
ERROR("oracle plugin: o_read_database_query (%s, %s): "
"udb_query_prepare_result failed.",
db->name, udb_query_get_name(q));
FREE_ALL;
if (status != OCI_SUCCESS) {
o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
oci_error);
if (status != OCI_SUCCESS) {
o_report_error("o_read_database", db->name, NULL, "OCIAttrGet",
oci_error);
- ssnprintf(errfunc, sizeof(errfunc), "OCILogon(\"%s\")", db->connect_id);
+ snprintf(errfunc, sizeof(errfunc), "OCILogon(\"%s\")", db->connect_id);
o_report_error("o_read_database", db->name, NULL, errfunc, oci_error);
DEBUG("oracle plugin: OCILogon (%s): db->oci_service_context = %p;",
db->connect_id, db->oci_service_context);
db->oci_service_context = NULL;
o_report_error("o_read_database", db->name, NULL, errfunc, oci_error);
DEBUG("oracle plugin: OCILogon (%s): db->oci_service_context = %p;",
db->connect_id, db->oci_service_context);
db->oci_service_context = NULL;
for (size_t i = 0; i < db->queries_num; i++)
o_read_database_query(db, db->queries[i], db->q_prep_areas[i]);
for (size_t i = 0; i < db->queries_num; i++)
o_read_database_query(db, db->queries[i], db->q_prep_areas[i]);