[sr-dev] git:4.3:71ff3942: db_mysql: print error number when failing to do mysql query

Daniel-Constantin Mierla miconda at gmail.com
Wed Nov 25 13:06:05 CET 2015


Module: kamailio
Branch: 4.3
Commit: 71ff3942698e33e8f2e79c5a5ac2a35a27b060b8
URL: https://github.com/kamailio/kamailio/commit/71ff3942698e33e8f2e79c5a5ac2a35a27b060b8

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-25T13:05:46+01:00

db_mysql: print error number when failing to do mysql query

(cherry picked from commit a1556c0708af959a3816e732a7bd692c5fa5f4dc)

---

Modified: modules/db_mysql/km_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/71ff3942698e33e8f2e79c5a5ac2a35a27b060b8.diff
Patch: https://github.com/kamailio/kamailio/commit/71ff3942698e33e8f2e79c5a5ac2a35a27b060b8.patch

---

diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index a323be2..b132608 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -118,7 +118,8 @@ static int db_mysql_submit_query(const db1_con_t* _h, const str* _s)
 		}
 		counter_inc(mysql_cnts_h.driver_err);
 	}
-	LM_ERR("driver error on query: %s\n", mysql_error(CON_CONNECTION(_h)));
+	LM_ERR("driver error on query: %s (%d)\n", mysql_error(CON_CONNECTION(_h)),
+			mysql_errno(CON_CONNECTION(_h)));
 	return -2;
 }
 




More information about the sr-dev mailing list