Bug #71124 callproc function with bytes parameters
| Submitted: | 10 Dec 2013 15:18 | Modified: | 12 Mar 2014 1:33 |
|---|---|---|---|
| Reporter: | Bulat Gaifullin | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / Python | Severity: | S1 (Critical) |
| Version: | 1.0.12-1 | OS: | Linux (Fedora19) |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | bytes, connector, python | ||
[17 Dec 2013 12:16]
Geert Vanderkelen
Posted by developer: Problem: executing call procedures and getting the result is done by using session variables. These session variables are typeless. Thus, a VARBINARY, we can not handle it correctly and check if it is 'binary' or not.
[17 Dec 2013 12:23]
Geert Vanderkelen
Posted by developer: A not-so-good workaround, but might help when really needed, is to use "use_unicode=False" for connection dealing with VARBINARY and calling stored procedures.
[17 Dec 2013 17:23]
Bulat Gaifullin
It is possible to extract types of variables that will be passed to callproc method and use this knowledge to convert SQL-result back to python variables properly in fetchone method.
[24 Feb 2014 13:00]
Bulat Gaifullin
any updates?
[12 Mar 2014 1:33]
Paul DuBois
Noted in 1.2.1 changelog. Connector/Python now permits the type for stored procedure parameters to be specified. To do this, specify a parameter as a two-item tuple consisting of the parameter value and type. For more information, see http://dev.mysql.com/doc/connector-python/en/connector-python-api-mysqlcursor-callproc.htm...
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.053 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: If stored procedure has VARBINARY(BINARY) input argument callproc method raises exception. Error Traceback (most recent call last): File "/usr/lib/python3.3/site-packages/mysql/connector/conversion.py", line 260, in to_python return getattr(self, func_name)(value, flddsc) File "/usr/lib/python3.3/site-packages/mysql/connector/conversion.py", line 421, in _BLOB_to_python return self._STRING_to_python(v, dsc) File "/usr/lib/python3.3/site-packages/mysql/connector/conversion.py", line 411, in _STRING_to_python return v.decode(self.charset) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 0: invalid start byte During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.3/site-packages/mysql/connector/cursor.py", line 297, in _row_to_python res += (self._connection.converter.to_python(flddsc, v),) File "/usr/lib/python3.3/site-packages/mysql/connector/conversion.py", line 265, in to_python raise ValueError("%s (field %s)" % (e, flddsc[0])) ValueError: 'utf-8' codec can't decode byte 0xfb in position 0: invalid start byte (field @_create_datacenter_arg3) How to repeat: CREATE PROCEDURE `proce_with_binary` (data VARBINARY(512)) BEGIN END; cursor = mysql.connector.connect(test_database).cursor() cursor.callproc('proce_with_binary', (b"\xfb"))