dabo Commit
Revision 5625
Date: 2010-02-02 05:53:54 -0800 (Tue, 02 Feb 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5625

Changed:
U   trunk/dabo/db/dCursorMixin.py

Log:
Corrects a problem identified by Jacek Ka?\197?\130ucki in which some columns 
that don't have defined data types only get their type corrected the first time 
a query is run.


Diff:
Modified: trunk/dabo/db/dCursorMixin.py
===================================================================
--- trunk/dabo/db/dCursorMixin.py       2010-02-02 01:02:02 UTC (rev 5624)
+++ trunk/dabo/db/dCursorMixin.py       2010-02-02 13:53:54 UTC (rev 5625)
@@ -19,8 +19,9 @@
 class dCursorMixin(dObject):
        """Dabo's cursor class, representing the lowest tier."""
        _call_initProperties = False
-       # Make this a class attribute, so that it is shared among all instances
+       # Make these class attributes, so that they are shared among all 
instances
        _fieldStructure = {}
+       _fieldsToAlwaysCorrectType = []
 
        def __init__(self, sql="", *args, **kwargs):
                self._convertStrToUnicode = True
@@ -198,10 +199,11 @@
                which only knows about a quite limited number of types.
                """
                ret = field_val
-               if _newQuery:
+               if _newQuery or (field_name in self._fieldsToAlwaysCorrectType):
                        pythonType = self._types.get(field_name, 
type(field_val))
                        if pythonType is None or pythonType == type(None):
                                pythonType = self._types[field_name] = 
dabo.db.getDataType(type(field_val))
+                               
self._fieldsToAlwaysCorrectType.append(field_name)
 
                        if pythonType is None or isinstance(field_val, 
pythonType):
                                # No conversion needed.



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to