[sr-dev] [kamailio/kamailio] DB Postgres BLOB conversion for presence (#1255)

sergey-safarov notifications at github.com
Mon Oct 8 06:27:28 CEST 2018


I created patch for postgres module and will test soon.
```
diff --git a/src/modules/db_postgres/km_pg_con.c b/src/modules/db_postgres/km_pg_con.c
index 5a7225c..b66a94a 100644
--- a/src/modules/db_postgres/km_pg_con.c
+++ b/src/modules/db_postgres/km_pg_con.c
@@ -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);
 
@@ -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:
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1255#issuecomment-427719271
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181007/af2485fa/attachment-0001.html>


More information about the sr-dev mailing list