From 37481774b129f16e603a413b6a1a64f94e88074c Mon Sep 17 00:00:00 2001 From: adustman Date: Sat, 13 Dec 2003 04:58:25 +0000 Subject: [PATCH] https://sourceforge.net/tracker/?func=detail&aid=850174&group_id=22307&atid=374932 Use more precision for floats; str() doesn't return full precision. --- MySQLdb/MySQLdb/converters.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MySQLdb/MySQLdb/converters.py b/MySQLdb/MySQLdb/converters.py index 4da2603..9451aea 100644 --- a/MySQLdb/MySQLdb/converters.py +++ b/MySQLdb/MySQLdb/converters.py @@ -54,6 +54,9 @@ if str(0L)[-1]=='L': else: Long2Int = Thing2Str +def Float2Str(o, d): + return '%.15g' % o + def None2NULL(o, d): """Convert None to NULL.""" return NULL # duh @@ -105,7 +108,7 @@ def array2Str(o, d): conversions = { types.IntType: Thing2Str, types.LongType: Long2Int, - types.FloatType: Thing2Str, + types.FloatType: Float2Str, types.NoneType: None2NULL, types.TupleType: escape_sequence, types.ListType: escape_sequence,