Module: kamailio
Branch: master
Commit: af18ebc1b580c8d236ed6d65ab9e8e8c528adbd2
URL:
https://github.com/kamailio/kamailio/commit/af18ebc1b580c8d236ed6d65ab9e8e8…
Author: Ovidiu Sas <osas(a)voipembedded.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: 2017-03-07T09:42:48-05:00
db_oracle: fix NULL values binding
---
Modified: src/modules/db_oracle/val.c
---
Diff:
https://github.com/kamailio/kamailio/commit/af18ebc1b580c8d236ed6d65ab9e8e8…
Patch:
https://github.com/kamailio/kamailio/commit/af18ebc1b580c8d236ed6d65ab9e8e8…
---
diff --git a/src/modules/db_oracle/val.c b/src/modules/db_oracle/val.c
index f032734..3b41bbc 100644
--- a/src/modules/db_oracle/val.c
+++ b/src/modules/db_oracle/val.c
@@ -58,7 +58,35 @@ int db_oracle_val2bind(bmap_t* _m, const db_val_t* _v, OCIDate* _o)
if (VAL_NULL(_v)) {
_m->addr = NULL;
_m->size = 0;
- _m->type = SQLT_NON;
+ switch (VAL_TYPE(_v)) {
+ case DB1_INT:
+ _m->type = SQLT_INT;
+ break;
+ case DB1_BIGINT:
+ LM_ERR("BIGINT not supported");
+ return -1;
+ case DB1_BITMAP:
+ _m->type = SQLT_UIN;
+ break;
+ case DB1_DOUBLE:
+ _m->type = SQLT_FLT;
+ break;
+ case DB1_STRING:
+ _m->type = SQLT_STR;
+ break;
+ case DB1_STR:
+ _m->type = SQLT_CHR;
+ break;
+ case DB1_DATETIME:
+ _m->type = SQLT_ODT;
+ break;
+ case DB1_BLOB:
+ _m->type = SQLT_CLOB;
+ break;
+ default:
+ LM_ERR("unknown data type\n");
+ return -1;
+ }
return 0;
}
@@ -130,8 +158,8 @@ int db_oracle_val2bind(bmap_t* _m, const db_val_t* _v, OCIDate* _o)
break;
default:
- LM_ERR("unknown data type\n");
- return -1;
+ LM_ERR("unknown data type\n");
+ return -1;
}
return 0;
}