[sr-dev] git:master:feb195b2: db_unixodbc: do not consider SQL_NO_DATA return code as an error

Daniel-Constantin Mierla miconda at gmail.com
Fri Jun 17 16:58:46 CEST 2016


Module: kamailio
Branch: master
Commit: feb195b2d9c801bc3591b1e95de6b70956e76dfe
URL: https://github.com/kamailio/kamailio/commit/feb195b2d9c801bc3591b1e95de6b70956e76dfe

Author: Giovanni Mele <giovanni.mele at nagra.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-06-17T16:57:48+02:00

db_unixodbc: do not consider SQL_NO_DATA return code as an error

---

Modified: modules/db_unixodbc/dbase.c

---

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

---

diff --git a/modules/db_unixodbc/dbase.c b/modules/db_unixodbc/dbase.c
index bef60e2..f322ba3 100644
--- a/modules/db_unixodbc/dbase.c
+++ b/modules/db_unixodbc/dbase.c
@@ -127,7 +127,9 @@ static int db_unixodbc_submit_query(const db1_con_t* _h, const str* _s)
 	}
 
 	ret=SQLExecDirect(CON_RESULT(_h),  (SQLCHAR*)_s->s, _s->len);
-	if (!SQL_SUCCEEDED(ret))
+
+        /* Handle SQL_NO_DATA as a valid return code. DELETE and UPDATE statements may return this return code if nothing was deleted/updated. */
+        if (!SQL_SUCCEEDED(ret) && (ret != SQL_NO_DATA))
 	{
 		SQLCHAR sqlstate[7];
 		LM_ERR("rv=%d. Query= %.*s\n", ret, _s->len, _s->s);




More information about the sr-dev mailing list