X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Futils%2Fdbi.c;h=261d3b249e5265b089db34f9e4c54e64de34d017;hb=0a3dd5b9b97e25156412a95bcecf25f8d75c72fc;hp=b1fdaf127896aaf35863ec1a8cfd208c62982d6d;hpb=e6fca772f02564a63847bb2103ad754f1a42ffae;p=sysdb.git diff --git a/src/utils/dbi.c b/src/utils/dbi.c index b1fdaf1..261d3b2 100644 --- a/src/utils/dbi.c +++ b/src/utils/dbi.c @@ -194,7 +194,7 @@ sdb_dbi_get_data(sdb_dbi_client_t *client, dbi_result res, sdb_dbi_strerror(client->conn)); return -1; } - types[i] = DBI_TYPE_TO_SC(types[i]); + types[i] = DBI_TYPE_TO_SDB(types[i]); } num_rows = dbi_result_get_numrows(res); @@ -379,8 +379,7 @@ sdb_dbi_client_connect(sdb_dbi_client_t *client) client->conn = dbi_conn_open(driver); if (! client->conn) { - sdb_log(SDB_LOG_ERR, "dbi: failed to open connection " - "object."); + sdb_log(SDB_LOG_ERR, "dbi: failed to open connection object."); return -1; } @@ -497,7 +496,7 @@ sdb_dbi_exec_query(sdb_dbi_client_t *client, const char *query, unsigned int type = va_arg(types, unsigned int); - field_type = DBI_TYPE_TO_SC(field_type); + field_type = DBI_TYPE_TO_SDB(field_type); /* column count starts at 1 */ if ((unsigned int)field_type != type) { @@ -546,7 +545,9 @@ sdb_dbi_client_destroy(sdb_dbi_client_t *client) dbi_conn_close(client->conn); client->conn = NULL; - dbi_shutdown_r(client->inst); + if (client->inst) + dbi_shutdown_r(client->inst); + client->inst = NULL; if (client->options) sdb_dbi_options_destroy(client->options);