--- convert.c.orig Thu Aug 4 21:26:57 2005 +++ convert.c Thu Sep 1 04:38:45 2005 @@ -762,7 +762,7 @@ { BOOL lf_conv = conn->connInfo.lf_conversion; - if (fCType == SQL_C_WCHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_WCHAR)) { len = utf8_to_ucs2_lf(neut_str, -1, lf_conv, NULL, 0); len *= WCLEN; @@ -778,7 +778,7 @@ } else #ifdef WIN32 - if (fCType == SQL_C_CHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_CHAR)) { wstrlen = utf8_to_ucs2_lf(neut_str, -1, lf_conv, NULL, 0); allocbuf = (SQLWCHAR *) malloc(WCLEN * (wstrlen + 1)); @@ -810,7 +810,7 @@ pgdc->ttlbuflen = len + 1; } - if (fCType == SQL_C_WCHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_WCHAR)) { utf8_to_ucs2_lf(neut_str, -1, lf_conv, (SQLWCHAR *) pgdc->ttlbuf, len / WCLEN); } @@ -824,7 +824,7 @@ } else #ifdef WIN32 - if (fCType == SQL_C_CHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_CHAR)) { len = WideCharToMultiByte(CP_ACP, 0, allocbuf, wstrlen, pgdc->ttlbuf, pgdc->ttlbuflen, NULL, NULL); free(allocbuf); @@ -871,7 +871,7 @@ copy_len = (len >= cbValueMax) ? cbValueMax - 1 : len; - if (fCType == SQL_C_WCHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_WCHAR)) { copy_len /= WCLEN; copy_len *= WCLEN; @@ -911,7 +911,7 @@ memcpy(rgbValueBindRow, ptr, copy_len); /* Add null terminator */ - if (fCType == SQL_C_WCHAR) + if ((conn->unicode && conn->report_wide_types) && (fCType == SQL_C_WCHAR)) memset(rgbValueBindRow + copy_len, 0, WCLEN); else @@ -942,7 +942,7 @@ break; } - if (SQL_C_WCHAR == fCType && ! wchanged) + if ((conn->unicode && conn->report_wide_types) && (SQL_C_WCHAR == fCType && ! wchanged)) { if (cbValueMax > (SDWORD) (WCLEN * (len + 1))) { @@ -2629,6 +2629,8 @@ case SQL_WCHAR: case SQL_WVARCHAR: case SQL_WLONGVARCHAR: + if (conn->unicode && conn->report_wide_types) + { if (SQL_NTS == used) used = strlen(buffer); allocbuf = malloc(WCLEN * (used + 1)); @@ -2637,6 +2639,11 @@ buf = ucs2_to_utf8((SQLWCHAR *) allocbuf, used, (UInt4 *) &used, FALSE); free(allocbuf); allocbuf = buf; + { + else + { + buf = buffer; + } break; default: buf = buffer; @@ -2647,10 +2654,17 @@ break; case SQL_C_WCHAR: + if (conn->unicode && conn->report_wide_types) + { if (SQL_NTS == used) used = WCLEN * wcslen((SQLWCHAR *) buffer); buf = allocbuf = ucs2_to_utf8((SQLWCHAR *) buffer, used / WCLEN, (UInt4 *) &used, FALSE); used *= WCLEN; + } + else + { + buf = buffer; + } break; case SQL_C_DOUBLE: --- psqlodbc_win32.def.orig Thu Sep 1 04:41:37 2005 +++ psqlodbc_win32.def Thu Sep 1 04:42:08 2005 @@ -78,31 +78,3 @@ DllMain @201 ConfigDSN @202 -SQLColAttributeW @101 -SQLColumnPrivilegesW @102 -SQLColumnsW @103 -SQLConnectW @104 -SQLDescribeColW @106 -SQLExecDirectW @107 -SQLForeignKeysW @108 -SQLGetConnectAttrW @109 -SQLGetCursorNameW @110 -SQLGetInfoW @111 -SQLNativeSqlW @112 -SQLPrepareW @113 -SQLPrimaryKeysW @114 -SQLProcedureColumnsW @115 -SQLProceduresW @116 -SQLSetConnectAttrW @117 -SQLSetCursorNameW @118 -SQLSpecialColumnsW @119 -SQLStatisticsW @120 -SQLTablesW @121 -SQLTablePrivilegesW @122 -SQLDriverConnectW @123 -SQLGetDiagRecW @124 -SQLGetStmtAttrW @125 -SQLSetStmtAttrW @126 -SQLSetDescFieldW @127 -SQLGetTypeInfoW @128 -SQLGetDiagFieldW @129