Here is what I think we should do, if we feel like we have the freedom to break lots of legacy code:
1) Stop doing implicit type conversion for select statements. At all. Whatever the database adapter hands us, use it. 2) Keep the option as it exists now to explicitly define DataStructure for one or more of the fields. If DataStructure is defined for a field, convert if not already the defined type and scale. 3) If DataStructure was defined, and it altered the type or scale of the field, then and only then must we implicitly convert back to the type the adapter expects for insert and update operations. I think most adapters are going to put the field in the correct type these days. After all, the database knows which type the query produced and it is the adapter's job to convert that to something usable in Python. If the adapter isn't doing that properly then it really isn't our job to fix it. Back when we first started there was a mess because there wasn't a decimal.Decimal, and datetime was pretty new, with a couple adapters using mx.DateTime. Things have gotten more consistent since then. There are edge cases, especially with things like BLOBs. Some adapters make them plain buffers, others strings, others CStringIO, etc. Dabo should convert them into something consistent, but perhaps not until getFieldVal() or setFieldVal(), for performance reasons. In fact, all data type conversions IMO should happen in cur.get|setFieldVal() for that reason. Generating the DataStructure is already there: asking for biz.DataStructure when not explicitly set will return the implicit structure. Just repr that and paste it into your bizobj definition, making appropriate tweaks where the implicit setting wasn't correct. Paul _______________________________________________ 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]
