From 1a3192a4f6e592398444a82a0f95ae6111b4e15a Mon Sep 17 00:00:00 2001 From: Luke Weber Date: Thu, 12 May 2016 17:44:34 -0700 Subject: [PATCH 1/2] Parse decimal results in protocol --- lib/mysql/connector/protocol.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/mysql/connector/protocol.py b/lib/mysql/connector/protocol.py index d61bc48..10c297f 100644 --- a/lib/mysql/connector/protocol.py +++ b/lib/mysql/connector/protocol.py @@ -440,6 +440,9 @@ def _parse_binary_values(self, fields, packet): elif field[1] == FieldType.TIME: (packet, value) = self._parse_binary_time(packet, field) values.append(value) + elif field[1] in (FieldType.DECIMAL, FieldType.NEWDECIMAL): + (packet, value) = utils.read_lc_string(packet) + values.append(Decimal(str(val, encoding="utf-8"))) else: (packet, value) = utils.read_lc_string(packet) values.append(value) From 16124bf08dda1a68c8f1d63514ac0f8c6ee94d0e Mon Sep 17 00:00:00 2001 From: Luke Weber Date: Thu, 12 May 2016 21:07:52 -0700 Subject: [PATCH 2/2] Fix typo --- lib/mysql/connector/protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mysql/connector/protocol.py b/lib/mysql/connector/protocol.py index 10c297f..1b48f32 100644 --- a/lib/mysql/connector/protocol.py +++ b/lib/mysql/connector/protocol.py @@ -442,7 +442,7 @@ def _parse_binary_values(self, fields, packet): values.append(value) elif field[1] in (FieldType.DECIMAL, FieldType.NEWDECIMAL): (packet, value) = utils.read_lc_string(packet) - values.append(Decimal(str(val, encoding="utf-8"))) + values.append(Decimal(str(value, encoding="utf-8"))) else: (packet, value) = utils.read_lc_string(packet) values.append(value)