Skip to content

Commit

Permalink
add DBSETUTF16 dblib login option
Browse files Browse the repository at this point in the history
Allows to enable/disable usage of UTF-16 instead of UCS-2 during
characters conversion.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
  • Loading branch information
freddy77 committed May 2, 2016
1 parent e8a87e6 commit 3183068
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/sybdb.h
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/dblib/dblib.c
Expand Up @@ -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:
Expand Down

0 comments on commit 3183068

Please sign in to comment.