From 3183068fcef21d792643f3268cf3f10701ad7819 Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Mon, 2 May 2016 20:56:15 +0100 Subject: [PATCH] add DBSETUTF16 dblib login option Allows to enable/disable usage of UTF-16 instead of UCS-2 during characters conversion. Signed-off-by: Frediano Ziglio --- include/sybdb.h | 6 ++++-- src/dblib/dblib.c | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/sybdb.h b/include/sybdb.h index 3101922d5c..39dc5d1b11 100644 --- a/include/sybdb.h +++ b/include/sybdb.h @@ -672,8 +672,6 @@ int dbtabcount(DBPROCESS * dbprocess); char *dbtabname(DBPROCESS * dbprocess, int tabnum); char *dbtabsource(DBPROCESS * dbprocess, int colnum, int *tabnum); -RETCODE dbsetlshort(LOGINREC * login, int value, int which); - RETCODE dbsendpassthru(DBPROCESS * dbprocess, DBVOIDPTR bufp); RETCODE dbrecvpassthru(DBPROCESS * dbprocess, DBVOIDPTR * bufp); @@ -1238,6 +1236,7 @@ RETCODE dbwritetext(DBPROCESS * dbproc, char *objname, DBBINARY * textptr, DBTIN /* LOGINREC manipulation */ RETCODE dbsetlname(LOGINREC * login, const char *value, int which); RETCODE dbsetlbool(LOGINREC * login, int value, int which); +RETCODE dbsetlshort(LOGINREC * login, int value, int which); RETCODE dbsetllong(LOGINREC * login, long value, int which); RETCODE dbsetlversion (LOGINREC * login, BYTE version); @@ -1282,6 +1281,9 @@ RETCODE dbsetlversion (LOGINREC * login, BYTE version); #define DBSETDBNAME 14 #define DBSETLDBNAME(x,y) dbsetlname((x), (y), DBSETDBNAME) #define DBSETLVERSION(login, version) dbsetlversion((login), (version)) +/* settings from here are purely FreeTDS extensions */ +#define DBSETUTF16 1001 +#define DBSETLUTF16(x,y) dbsetlbool((x), (y), DBSETUTF16) RETCODE bcp_init(DBPROCESS * dbproc, const char *tblname, const char *hfile, const char *errfile, int direction); DBINT bcp_done(DBPROCESS * dbproc); diff --git a/src/dblib/dblib.c b/src/dblib/dblib.c index 0dc263e7d5..2c21daf001 100644 --- a/src/dblib/dblib.c +++ b/src/dblib/dblib.c @@ -914,6 +914,9 @@ dbsetlbool(LOGINREC * login, int value, int which) tds_set_bulk(login->tds_login, (TDS_TINYINT) value); return SUCCEED; break; + case DBSETUTF16: + login->tds_login->use_utf16 = (value != 0); + return SUCCEED; case DBSETENCRYPT: case DBSETLABELED: default: