Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4188
Modified Files:
Tag: py3k
odbc.cpp
Log Message:
Bind VARCHAR fields as SQL_C_WCHAR so they can be returned as native unicode
Index: odbc.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/odbc.cpp,v
retrieving revision 1.20.2.6
retrieving revision 1.20.2.7
diff -C2 -d -r1.20.2.6 -r1.20.2.7
*** odbc.cpp 16 Sep 2008 15:14:05 -0000 1.20.2.6
--- odbc.cpp 17 Sep 2008 03:17:42 -0000 1.20.2.7
***************
*** 600,607 ****
}
static PyObject *stringCopy(const void *v, int sz)
{
! return Py_BuildValue("s", v);
}
static PyObject *longCopy(const void *v, int sz)
{
--- 600,613 ----
}
+ static PyObject *wcharCopy(const void *v, int sz)
+ {
+ return PyWinObject_FromWCHAR((WCHAR *)v, sz/sizeof(WCHAR));
+ }
+
static PyObject *stringCopy(const void *v, int sz)
{
! return PyString_FromStringAndSize((char *)v, sz);
}
+
static PyObject *longCopy(const void *v, int sz)
{
***************
*** 1275,1280 ****
typeOf = DbiRaw;
break;
case SQL_LONGVARCHAR:
! bindOutputVar(cur, stringCopy, SQL_C_CHAR, cur->max_width, pos, true);
typeOf = DbiString;
break;
--- 1281,1289 ----
typeOf = DbiRaw;
break;
+ case SQL_VARCHAR:
+ case SQL_WVARCHAR:
case SQL_LONGVARCHAR:
! case SQL_WLONGVARCHAR:
! bindOutputVar(cur, wcharCopy, SQL_C_WCHAR, cur->max_width, pos, true);
typeOf = DbiString;
break;
|