Browse Source

Merge pull request #6880 from neheb/pyobdc

pyodbc: Update to 4.0.24
lilik-openwrt-22.03
Hannu Nyman 6 years ago
committed by GitHub
parent
commit
27a43ec205
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 62 deletions
  1. +3
    -3
      lang/python/pyodbc/Makefile
  2. +0
    -59
      lang/python/pyodbc/patches/100-connection-assume-SQL_C_WCHAR-is-native-endian.patch

+ 3
- 3
lang/python/pyodbc/Makefile View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=pyodbc
PKG_VERSION:=4.0.21
PKG_VERSION:=4.0.24
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://pypi.python.org/packages/0f/04/c5638a4636fb8117fdc45685f489864459d193b1d892b61dce785ddf58f9
PKG_HASH:=9655f84ca9e5cb2dfffff705601017420c840d55271ba62dd44f05383eff0329
PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/p/pyodbc
PKG_HASH:=4326abb737dec36156998d52324921673d30f575e1e0998f0c5edd7de20e61d4
PKG_BUILD_DEPENDS:=python python3 unixodbc
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.txt


+ 0
- 59
lang/python/pyodbc/patches/100-connection-assume-SQL_C_WCHAR-is-native-endian.patch View File

@ -1,59 +0,0 @@
--- a/src/connection.cpp
+++ b/src/connection.cpp
@@ -18,6 +18,14 @@
#include "cnxninfo.h"
#include "sqlwchar.h"
+#ifdef WORDS_BIGENDIAN
+# define OPTENC_UTF16NE OPTENC_UTF16BE
+# define ENCSTR_UTF16NE "utf-16be"
+#else
+# define OPTENC_UTF16NE OPTENC_UTF16LE
+# define ENCSTR_UTF16NE "utf-16le"
+#endif
+
#if PY_MAJOR_VERSION < 3
static bool IsStringType(PyObject* t) { return (void*)t == (void*)&PyString_Type; }
static bool IsUnicodeType(PyObject* t) { return (void*)t == (void*)&PyUnicode_Type; }
@@ -90,7 +98,7 @@ static bool Connect(PyObject* pConnectSt
// indication that we can handle Unicode. We are going to use the same unicode ending
// as we do for binding parameters.
- SQLWChar wchar(pConnectString, SQL_C_WCHAR, encoding, "utf-16le");
+ SQLWChar wchar(pConnectString, SQL_C_WCHAR, encoding, ENCSTR_UTF16NE);
if (!wchar)
return false;
@@ -216,24 +224,24 @@ PyObject* Connection_New(PyObject* pConn
// single-byte text we don't actually know what the encoding is. For example, with SQL
// Server the encoding is based on the database's collation. We ask the driver / DB to
// convert to SQL_C_WCHAR and use the ODBC default of UTF-16LE.
- cnxn->sqlchar_enc.optenc = OPTENC_UTF16LE;
- cnxn->sqlchar_enc.name = _strdup("utf-16le");
+ cnxn->sqlchar_enc.optenc = OPTENC_UTF16NE;
+ cnxn->sqlchar_enc.name = _strdup(ENCSTR_UTF16NE);
cnxn->sqlchar_enc.ctype = SQL_C_WCHAR;
- cnxn->sqlwchar_enc.optenc = OPTENC_UTF16LE;
- cnxn->sqlwchar_enc.name = _strdup("utf-16le");
+ cnxn->sqlwchar_enc.optenc = OPTENC_UTF16NE;
+ cnxn->sqlwchar_enc.name = _strdup(ENCSTR_UTF16NE);
cnxn->sqlwchar_enc.ctype = SQL_C_WCHAR;
- cnxn->metadata_enc.optenc = OPTENC_UTF16LE;
- cnxn->metadata_enc.name = _strdup("utf-16le");
+ cnxn->metadata_enc.optenc = OPTENC_UTF16NE;
+ cnxn->metadata_enc.name = _strdup(ENCSTR_UTF16NE);
cnxn->metadata_enc.ctype = SQL_C_WCHAR;
// Note: I attempted to use UTF-8 here too since it can hold any type, but SQL Server fails
// with a data truncation error if we send something encoded in 2 bytes to a column with 1
// character. I don't know if this is a bug in SQL Server's driver or if I'm missing
// something, so we'll stay with the default ODBC conversions.
- cnxn->unicode_enc.optenc = OPTENC_UTF16LE;
- cnxn->unicode_enc.name = _strdup("utf-16le");
+ cnxn->unicode_enc.optenc = OPTENC_UTF16NE;
+ cnxn->unicode_enc.name = _strdup(ENCSTR_UTF16NE);
cnxn->unicode_enc.ctype = SQL_C_WCHAR;
#if PY_MAJOR_VERSION < 3

Loading…
Cancel
Save