summaryrefslogtreecommitdiffstats
path: root/main/kamailio/fix-sql-module-loading-order.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/kamailio/fix-sql-module-loading-order.patch')
-rw-r--r--main/kamailio/fix-sql-module-loading-order.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/main/kamailio/fix-sql-module-loading-order.patch b/main/kamailio/fix-sql-module-loading-order.patch
new file mode 100644
index 000000000..5ba87e328
--- /dev/null
+++ b/main/kamailio/fix-sql-module-loading-order.patch
@@ -0,0 +1,59 @@
+diff --git a/lib/srdb1/db_query.c b/lib/srdb1/db_query.c
+index dbde735..8efc15c 100644
+--- a/lib/srdb1/db_query.c
++++ b/lib/srdb1/db_query.c
+@@ -54,6 +54,10 @@ int db_do_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ if (!_c) {
+ ret = snprintf(sql_buf, sql_buffer_size, "select * from %.*s ", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+@@ -154,6 +158,10 @@ int db_do_insert_cmd(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ if(mode==1)
+ ret = snprintf(sql_buf, sql_buffer_size, "insert delayed into %.*s (",
+@@ -218,6 +226,10 @@ int db_do_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "delete from %.*s", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;
+@@ -261,6 +273,10 @@ int db_do_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "update %.*s set ", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;
+@@ -306,6 +322,10 @@ int db_do_replace(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v,
+ LM_ERR("invalid parameter value\n");
+ return -1;
+ }
++ if (sql_buf == NULL) {
++ if (db_query_init() != 0)
++ return -2;
++ }
+
+ ret = snprintf(sql_buf, sql_buffer_size, "replace %.*s (", CON_TABLE(_h)->len, CON_TABLE(_h)->s);
+ if (ret < 0 || ret >= sql_buffer_size) goto error;