Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
0.9.55
-
None
Description
In current implemenation of MariaDB Connector/C MYSQL_TYPE_NEWDECIMAL is converted into a string in both text and binary protocol.
For compatibility reasons it should be converted to (non native) Decimal type, which will require an additional import of the decimal module.
How to repeat:
MariaDB [testp] CREATE TEMPORARY TABLE t1 (a decimal 10,2); |
MariaDB [testp] INSERT INTO t1 VALUES(27); |
|
Python:
conn= mariadb.connect(user="georg") |
cursor=conn.cusor() |
cursor.execute("SELECT a FROM t1") |
cursor.fetchone()
|
Output:
MariaDB Connector/Python: '27.00'
|
other PEP-249 modules: Decimal('27.00')
|
|
The example above only shows Decimal usage in result set, it needs to be supported also in parameters for execute() and executemany()