I am trying to migrate my old db written in sqlite to greendao ORM , I need to set the column to DECIMAL(10,2) for storing the price of the item. What is the equivalent data type that I can use. DO I need to use a custom data type for that?
Asked
Active
Viewed 57 times
1 Answers
0
There are a couple of options, use a long value representing the smaller unit.
Then if you had a long price
property, you could get the big unit using price / 100
and the small unit via price % 100
. Like this you can still use price
for regular integer calculation.
For formatting, don't forget an extra '0' for the small unit if it is single digit.

Markus Junginger
- 6,950
- 31
- 52