My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 295 attachment: sqlwchar.patch (692 bytes)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- /tmp/pyodbc-3.0.6/src/sqlwchar.cpp 2011-11-03 15:12:04.000000000 -0400
+++ pyodbc-3.0.6/src/sqlwchar.cpp 2012-11-02 11:51:16.555604360 -0400
@@ -129,6 +129,23 @@

PyObject* PyUnicode_FromSQLWCHAR(const SQLWCHAR* sz, Py_ssize_t cch)
{
+#if PY_VERSION_HEX >= 0x03030000
+ // use new unicode interface
+
+ if (SQLWCHAR_SIZE == 2)
+ return PyUnicode_FromKindAndData(2, sz, cch);
+ else if (SQLWCHAR_SIZE == 4)
+ return PyUnicode_FromKindAndData(4, sz, cch);
+ else
+ {
+ /* must be a single byte */
+
+ return PyUnicode_FromKindAndData(1, sz, cch);
+ }
+
+#endif
+
+
// Create a Python Unicode object from a zero-terminated SQLWCHAR.

if (SQLWCHAR_SIZE == Py_UNICODE_SIZE)
Powered by Google Project Hosting