Module: kamailio
Branch: 5.6
Commit: ce9c0e6715010c4403463b6d664b6e4a5632c04a
URL:
https://github.com/kamailio/kamailio/commit/ce9c0e6715010c4403463b6d664b6e4…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-03-24T08:55:18Z
carrierroute: check during startup for required DB capabilities (GH #3405)
(cherry picked from commit cf147ab7888c4e2b26db9dd44e494001bb71a61c)
---
Modified: src/modules/carrierroute/cr_db.c
Modified: src/modules/carrierroute/db_carrierroute.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ce9c0e6715010c4403463b6d664b6e4…
Patch:
https://github.com/kamailio/kamailio/commit/ce9c0e6715010c4403463b6d664b6e4…
---
diff --git a/src/modules/carrierroute/cr_db.c b/src/modules/carrierroute/cr_db.c
index 04e3659dfe8..0e59a681e40 100644
--- a/src/modules/carrierroute/cr_db.c
+++ b/src/modules/carrierroute/cr_db.c
@@ -335,6 +335,11 @@ int load_route_data_db(struct route_data_t * rd) {
return -1;
}
+ if (!DB_CAPABILITY(carrierroute_dbf, DB_CAP_RAW_QUERY)) {
+ LM_ERR("Database does not support required raw queries capability\n");
+ return -1;
+ }
+
if (DB_CAPABILITY(carrierroute_dbf, DB_CAP_FETCH)) {
if (carrierroute_dbf.query(carrierroute_dbh, NULL, NULL, NULL, (db_key_t *) columns,
0,
columns_load_num, NULL, NULL) < 0) {
diff --git a/src/modules/carrierroute/db_carrierroute.c
b/src/modules/carrierroute/db_carrierroute.c
index 99636b9c4d3..8d31f53008c 100644
--- a/src/modules/carrierroute/db_carrierroute.c
+++ b/src/modules/carrierroute/db_carrierroute.c
@@ -111,6 +111,10 @@ int carrierroute_db_init(void) {
LM_ERR("can't connect to database.\n");
return -1;
}
+ if (!DB_CAPABILITY(carrierroute_dbf, DB_CAP_RAW_QUERY)) {
+ LM_ERR("database does not support required raw queries capability\n");
+ return -1;
+ }
if (db_check_table_version(&carrierroute_dbf, carrierroute_dbh,
&carrierroute_table, carrierroute_version) < 0) {
DB_TABLE_VERSION_ERROR(carrierroute_table);