Hi,
I am downloading data from a remote MySQL server and then inserting it the SqlLite DB on the Android phone.
On the SqlLite Db's table, I have a column to keep the price. It is defined as Decimal (13,2)
I checked the data and found that the data received from the MySQL server contains the decimal for eg. 250.50 but when I insert the data to the Sqlite table via DbUtils.InsertMaps the decimal part ie .50 is lost and the value stored is 250 instead of 250.50.
The following is the code that I use to insert the data to Sqlite table
I am using DbUtils version 1.20
I modified the column type of my sqlite table from Decimal(13,2) to Text, but the decimal part is still lost. So I assume that the DbUtils.InsertMaps is the culprit.
Any help will be appreciated.
I am downloading data from a remote MySQL server and then inserting it the SqlLite DB on the Android phone.
On the SqlLite Db's table, I have a column to keep the price. It is defined as Decimal (13,2)
B4X:
cSql = $"CREATE TABLE items
( Item_Code INTEGER,
Item_Price DECIMAL(13,2) "$
Sql1.ExecNonQuery(cSql)
I checked the data and found that the data received from the MySQL server contains the decimal for eg. 250.50 but when I insert the data to the Sqlite table via DbUtils.InsertMaps the decimal part ie .50 is lost and the value stored is 250 instead of 250.50.
The following is the code that I use to insert the data to Sqlite table
B4X:
Sub Write_Items(Data As List, Meta As Map)
Dim ListOfMaps As List
ListOfMaps.Initialize
For i=0 To Data.Size-1
Dim cur As Map = Data.Get(i)
ListOfMaps.Add(cur)
Next
' Here it displays the correct value ie 250.50, but lost .50 in the table after writing. It writes as 250
MsgBox(cur.Get("Item_Price"),"Price")
Starter.Sql1.ExecNonQuery("DELETE FROM items")
DBUtils.InsertMaps(Starter.Sql1, "items", ListOfMaps)
End Sub
I am using DbUtils version 1.20
I modified the column type of my sqlite table from Decimal(13,2) to Text, but the decimal part is still lost. So I assume that the DbUtils.InsertMaps is the culprit.
Any help will be appreciated.