From 19beb9ae7e445d50e1b6e9cc64b0ef077bd48627 Mon Sep 17 00:00:00 2001 From: Keith Erskine Date: Tue, 10 Oct 2023 22:31:38 -0500 Subject: [PATCH] handle bytes in attrs_before It looks like the code to handle byte values in the attrs_before parameter was lost in the v5 upgrade. Adding it back in. --- src/connection.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/connection.cpp b/src/connection.cpp index c87d2f30..c3da298a 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -124,6 +124,11 @@ static bool ApplyPreconnAttrs(HDBC hdbc, SQLINTEGER ikey, PyObject *value, char ivalue = (SQLPOINTER)PyByteArray_AsString(value); vallen = SQL_IS_POINTER; } + else if (PyBytes_Check(value)) + { + ivalue = PyBytes_AsString(value); + vallen = SQL_IS_POINTER; + } else if (PyUnicode_Check(value)) { sqlchar.set(value, strencoding ? strencoding : "utf-16le");