Skip to content

Commit

Permalink
lib-sql: Fix wrong sql_query_finished_event() success parameter use
Browse files Browse the repository at this point in the history
  • Loading branch information
mrannanj committed Sep 13, 2018
1 parent c7f5ae6 commit c335e4b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/lib-sql/driver-cassandra.c
Expand Up @@ -939,7 +939,8 @@ static void driver_cassandra_log_result(struct cassandra_result *result,

struct event_passthrough *e =
sql_query_finished_event(&db->api, result->api.event,
result->query, FALSE, NULL);
result->query, result->error == NULL,
NULL);
if (result->error != NULL)
e->add_str("error", result->error);

Expand Down
4 changes: 2 additions & 2 deletions src/lib-sql/driver-sqlite.c
Expand Up @@ -141,11 +141,11 @@ driver_sqlite_escape_string(struct sql_db *_db ATTR_UNUSED,
static void driver_sqlite_result_log(const struct sql_result *result, const char *query)
{
struct sqlite_db *db = (struct sqlite_db *)result->db;
bool failed = !db->connected || (db->rc == SQLITE_OK);
bool success = db->connected && db->rc == SQLITE_OK;
int duration;
const char *suffix = "";
struct event_passthrough *e =
sql_query_finished_event(&db->api, result->event, query, failed,
sql_query_finished_event(&db->api, result->event, query, success,
&duration);
io_loop_time_refresh();

Expand Down
2 changes: 1 addition & 1 deletion src/lib-sql/driver-sqlpool.c
Expand Up @@ -622,7 +622,7 @@ static void driver_sqlpool_timeout(struct sqlpool_db *db)

if (request->query != NULL) {
e_error(sql_query_finished_event(&db->api, request->event,
request->query, TRUE,
request->query, FALSE,
&duration)->
add_str("error", "Query timed out")->
event(),
Expand Down

0 comments on commit c335e4b

Please sign in to comment.