summaryrefslogtreecommitdiff
path: root/res/res_config_odbc.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-05-07 17:56:04 +0000
committerMark Michelson <mmichelson@digium.com>2014-05-07 17:56:04 +0000
commit2d572eafb97823db23137406897d0f55c3b2ee6b (patch)
tree3af8228350b0f03d34f8ff1e5f2c08bf537ff174 /res/res_config_odbc.c
parent065bd7d7039a10663fb06be7808e741c3f79e7f6 (diff)
Fix encoding of custom prepare extra data.
Patches: res_config_odbc-take2.patch by John Hardin (License #6512) ........ Merged revisions 413396 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 413397 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 413398 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413399 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_config_odbc.c')
-rw-r--r--res/res_config_odbc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_config_odbc.c b/res/res_config_odbc.c
index 922923c96..585c75147 100644
--- a/res/res_config_odbc.c
+++ b/res/res_config_odbc.c
@@ -135,13 +135,13 @@ static SQLHSTMT custom_prepare(struct odbc_obj *obj, void *data)
}
if (!ast_strlen_zero(cps->extra)) {
- if (strchr(cps->extra, ';') || strchr(cps->extra, '^')) {
- ENCODE_CHUNK(encodebuf, cps->extra);
- SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(encodebuf), 0, (void *)encodebuf, 0, NULL);
+ const char *newval = cps->extra;
+ if (strchr(newval, ';') || strchr(newval, '^')) {
+ ENCODE_CHUNK(encodebuf, newval);
+ ast_string_field_set(cps, encoding[x], encodebuf);
+ newval = cps->encoding[x];
}
- else {
- SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(cps->extra), 0, (void *)cps->extra, 0, NULL);
- }
+ SQLBindParameter(stmt, x++, SQL_PARAM_INPUT, SQL_C_CHAR, SQL_CHAR, strlen(newval), 0, (void *)newval, 0, NULL);
}
return stmt;