Open GoogleCodeExporter opened 8 years ago
I have looked into this a developed the attached patch which seems to fix this
problem.
A number of the other tests fail but most of theses failures are:
type(bytearray) != type(bytes). This of course is true but the two types are
interoperable so maybe these tests need to be changed. I think most of the
other failures pre-date Python 3.3.
Original comment by davidp.r...@gmail.com
on 2 Nov 2012 at 5:28
Attachments:
Couldnt it just read
#if PY_VERSION_HEX >= 0x03030000
return PyUnicode_FromKindAndData(SQLWCHAR_SIZE, sz, cch);
#endif
?
Original comment by lukas.l...@gmail.com
on 27 Dec 2012 at 11:48
You are correct. For some reason, I wanted to handle the '1' case but, if SQL
wide characters are always wider than 1 byte (which must be true or they
wouldn't be 'wide'), that doesn't count.
Simpler is better.
Original comment by davidp.r...@gmail.com
on 27 Dec 2012 at 5:00
Original comment by mkleehammer
on 29 Mar 2013 at 12:11
Decimal fields don't work with Python 2.7.5 on Linux 64 bit with Pyodbc 3.07 as
well. Do you know if there is any similar patch for Python 2.7.5 or any other
solution available that can solve the problem?
Original comment by netezza...@gmail.com
on 15 Jan 2014 at 2:33
We are facing the same problem while reading the NUMERIC(X,Y) data from Vertica
using pyodbc 3.0.7 with python 2.7.2 on Red Hat Enterprise Linux Server release
5.10 (Tikanga).
The result we see as an output is the first digit of the actual data in the
database cell. If the value in the cell is less than '0' for example "0.59",
then we get the following error:
File "/usr/local/lib/python2.7/decimal.py", line 548, in _new_
"Invalid literal for Decimal: %r" % value)
File "/usr/local/lib/python2.7/decimal.py", line 3844, in _raise_error
raise error(explanation)
And the saddest part is, the same setup works fine with python 2.7.2 and pyodbc
2.1.11. We are not sure what got added or removed from pyodbc 2.1.11 to pyodbc
3.0.7 which is making the conversion of SQL_NUMERIC to decimal.Decimal to fail.
Original comment by rahul.ch...@gmail.com
on 7 Aug 2014 at 10:20
Original issue reported on code.google.com by
davidp.r...@gmail.com
on 31 Oct 2012 at 6:12