Bug ref: 1276
authorDave Page <dpage@pgadmin.org>
Wed, 27 Apr 2005 10:27:29 +0000 (10:27 +0000)
committerDave Page <dpage@pgadmin.org>
Wed, 27 Apr 2005 10:27:29 +0000 (10:27 +0000)
When I attempt to bind a null-terminated Unicode string parameter using
SQLBindParameter, the database engine receives a string representation of
today's date instead of the data I passed. The same issue does not occur if
I explicitly specify the length of the string instead of using SQL_NTS.
[jeremy <NOSPAM> accessdata.com]

convert.c

index 010cc38218f3d0f609506d532ce5e8b567e6bc57..58c5449e09affa48e3f8c89349ef2a61f2f646ba 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -2639,6 +2639,8 @@ ResolveOneParam(QueryBuild *qb)
            break;
 
        case SQL_C_WCHAR:
+            if (SQL_NTS == used)
+                used = WCLEN * wcslen((SQLWCHAR *) buffer);
            buf = allocbuf = ucs2_to_utf8((SQLWCHAR *) buffer, used / WCLEN, (UInt4 *) &used, FALSE);
            used *= WCLEN;
            break;