[CONPY-91] Parameters in the %(name)s form substituted incorrectly in some cases Created: 2020-08-04  Updated: 2020-10-04  Resolved: 2020-10-04

Status: Closed
Project: MariaDB Connector/Python
Component/s: Generic
Affects Version/s: 1.0.0
Fix Version/s: 1.0.2

Type: Bug Priority: Major
Reporter: Marat Khalili Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None
Environment:

Python 3.7.8 (64-bit) for Windows
mariadb package 1.0.0 installed from pip
Server version 10.3.21-MariaDB on Synology DSM installed from Package Center

$ cat /var/packages/MariaDB10/etc/my.cnf
[mariadb]
character_set_client=utf8mb4
character_set_server=utf8mb4
collation_server=utf8mb4_general_ci
explicit_defaults_for_timestamp=on


Attachments: File test_decimal.py    

 Description   

When I execute the following line, server receives zero in the first parameter instead of one:

cursor.execute(
    'select %(value)s, %(dummy)s',
    dict(value=decimal.Decimal(1), dummy=1),
)

The following parts are important: parameter count (a minimum of 2), parameter type (should be decimal.Decimal, not int), parameter style (should be %(value)s, not %s or ?).

Actual query is not important, works as well with insert etc (inseting incorrect values into database). Type of second parameter is not important (reproduces with both str and int).

Test case is attached.



 Comments   
Comment by Georg Richter [ 2020-10-04 ]

This was already fixed in 1.0.2

Generated at Thu Feb 08 03:30:11 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.