Menu

#165 NEWDECIMAL type in MySQL 5.0

MySQLdb-1.2
closed
MySQLdb (285)
5
2015-01-01
2005-12-16
rhuddleston
No

MySQL 5.0.16 Python 2.2:

MySQLdb doesn't know about the NEWDECIMAL type in
MySQL 5.0 and is returning them as strings. To fix
this issues

constants/FIELD_TYPE.py add:

NEWDECIMAL = 246

converters.py (conversions):

FIELD_TYPE.NEWDECIMAL: float,

Also add to this section:

try:
from decimal import Decimal
conversions[FIELD_TYPE.DECIMAL] = Decimal
conversions[FIELD_TYPE.NEWDECIMAL] = Decimal
except ImportError:
pass

A lot of things come back as decimal type with MySQL
5.0 precision math. For example doing a sum() on a
column returns a NEWDECIMAL type so this needs to be
added for MySQL 5.0 compatibility.

Thanks for your help,

Ryan Huddleston
RightNow Technologies

Discussion

  • salmandr

    salmandr - 2006-02-17

    Logged In: YES
    user_id=1455079

    I ran into this problem also, while using the Django
    framework. Hopefully this fix will make it into a release
    soon , since webhosts are starting to adopt MySQL 5.

     
  • Andy Dustman

    Andy Dustman - 2006-02-27

    Logged In: YES
    user_id=71372

    This has been fixed in the current CVS tree.

     

Log in to post a comment.