Module: kamailio
Branch: master
Commit: ee548d8c5c0e5dc0be09edcacac70a33e205b693
URL:
https://github.com/kamailio/kamailio/commit/ee548d8c5c0e5dc0be09edcacac70a3…
Author: Henning Westerholt <hw(a)kamailio.org>
Committer: Henning Westerholt <hw(a)kamailio.org>
Date: 2018-09-28T15:22:56+02:00
db_mysql: add support for unsigned integers in INT and BIGINT DB1 API
---
Modified: src/modules/db_mysql/km_res.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ee548d8c5c0e5dc0be09edcacac70a3…
Patch:
https://github.com/kamailio/kamailio/commit/ee548d8c5c0e5dc0be09edcacac70a3…
---
diff --git a/src/modules/db_mysql/km_res.c b/src/modules/db_mysql/km_res.c
index 19af450fab..81f24dfc99 100644
--- a/src/modules/db_mysql/km_res.c
+++ b/src/modules/db_mysql/km_res.c
@@ -96,13 +96,23 @@ int db_mysql_get_columns(const db1_con_t* _h, db1_res_t* _r)
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_TIMESTAMP:
- LM_DBG("use DB1_INT result type\n");
- RES_TYPES(_r)[col] = DB1_INT;
+ if (fields[col].flags & UNSIGNED_FLAG) {
+ LM_DBG("use DB1_UINT result type\n");
+ RES_TYPES(_r)[col] = DB1_UINT;
+ } else {
+ LM_DBG("use DB1_INT result type\n");
+ RES_TYPES(_r)[col] = DB1_UINT;
+ }
break;
case MYSQL_TYPE_LONGLONG:
- LM_DBG("use DB1_BIGINT result type\n");
- RES_TYPES(_r)[col] = DB1_BIGINT;
+ if (fields[col].flags & UNSIGNED_FLAG) {
+ LM_DBG("use DB1_UBIGINT result type\n");
+ RES_TYPES(_r)[col] = DB1_UBIGINT;
+ } else {
+ LM_DBG("use DB1_BIGINT result type\n");
+ RES_TYPES(_r)[col] = DB1_BIGINT;
+ }
break;
case MYSQL_TYPE_FLOAT: