Skip to content

Commit

Permalink
db_postgres: Fixed blob hex encoding (kamailio#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-safarov committed Oct 10, 2018
1 parent 7d19647 commit 72b207d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/modules/db_postgres/km_pg_con.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
int i = 0;
const char *keywords[10], *values[10];
char to[16];
PGresult *res;

LM_DBG("db_id = %p\n", id);

Expand Down Expand Up @@ -141,6 +142,15 @@ struct pg_con *db_postgres_new_connection(struct db_id *id)
}
#endif

res = PQexec(ptr->con, "SET bytea_output=escape");
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
LM_ERR("cannot set blob output escaping format\n");
PQclear(res);
goto err;
}
PQclear(res);

return ptr;

err:
Expand Down

0 comments on commit 72b207d

Please sign in to comment.