[sr-dev] git:4.2:269e4455: db_mysql: print error number when failing to do mysql query

Juha Heinanen jh at tutpro.com
Mon Dec 21 23:51:40 CET 2015


Module: kamailio
Branch: 4.2
Commit: 269e445550ee55b48ff1b92817a46d5084abad5b
URL: https://github.com/kamailio/kamailio/commit/269e445550ee55b48ff1b92817a46d5084abad5b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date: 2015-12-22T00:49:14+02:00

db_mysql: print error number when failing to do mysql query

(cherry picked from commit a1556c0708af959a3816e732a7bd692c5fa5f4dc)
(cherry picked from commit 71ff3942698e33e8f2e79c5a5ac2a35a27b060b8)

---

Modified: modules/db_mysql/km_dbase.c

---

Diff:  https://github.com/kamailio/kamailio/commit/269e445550ee55b48ff1b92817a46d5084abad5b.diff
Patch: https://github.com/kamailio/kamailio/commit/269e445550ee55b48ff1b92817a46d5084abad5b.patch

---

diff --git a/modules/db_mysql/km_dbase.c b/modules/db_mysql/km_dbase.c
index 1ceff0d..9f2b6e0 100644
--- a/modules/db_mysql/km_dbase.c
+++ b/modules/db_mysql/km_dbase.c
@@ -120,7 +120,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