On 5/17/12 12:22 PM, Ed Leafe wrote:
> On May 17, 2012, at 2:00 PM, Paul McNett wrote:
>
>> Because I guess sqlite's adapter returned the field as an int even though it 
>> can
>> contain decimal places. Adding the AttributeError fixes.
>
>       So the pythonType is Decimal, but the value is an int? That's strange.
>
>       Perhaps a better solution would be to check for int and set scale=0 for 
> those.

No, because other rows may have decimal values. I think this is what's 
happening:

CREATE TABLE test (..., amount decimal (8,2),...)

biz DataStructure set but no explicit scale set (because I always assumed it 
would 
default to 2).

requery happens and correcting the field types happens for these values as the 
arrive 
from sqlite:

int(8)
float("8.55")

If we don't put any decimal places in row 0, it won't be consistent with row 1. 
At 
least defaulting to a scale of 2 matches old behavior.

I think the real answer is to put in scale-finding code into our database 
adapters 
and use that scale regardless of the field val.

I will be going through my DataStructures and explicitly stating the scale for 
all my 
decimal columns.

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]

Reply via email to