jeudi 5 février 2015

sqlite SUM result decimal gone

Test Code :



> String x = "30000000000.222";
> String y = "20000000000.444";
> double x1 = Double.parseDouble(x);
> double y1 = Double.parseDouble(y);
>
> ContentValues vValue51 = new ContentValues();
> vValue51.put(DatabaseStructure.fTmpAttr_X3 , x1 );
> vDatabase.insertData(DatabaseStructure.cTblTemporary3, vValue51);
> ContentValues vValue61 = new ContentValues(); vValue61.put(DatabaseStructure.fTmpAttr_X3 , y1 );
> vDatabase.insertData(DatabaseStructure.cTblTemporary3, vValue61);
> vDatabase.closeDatabase();
>
>
>
> List<Map<String, String>> vListData2 = new
> ArrayList<Map<String,String>>(); String vQuerY32;
>
>
> vQuerY32 = "Select SUM(" + DatabaseStructure.fTmpAttr_X3 + " ) 'jik' " +
> "From " + DatabaseStructure.cTblTemporary3;
>
> vDatabase = new DatabaseHandler(getApplicationContext());
> vListData2 = vDatabase.getListData(vQuerY32);
> vDatabase.closeDatabase();

I tried many data type for column

> vQuery = "create table " + cTblTemporary3 +
> "("+
> fTmpAttr_ID3 + " integer primary key, " +
> fTmpAttr_V3 + " DECIMAL(10,5), " +
> fTmpAttr_W3 + " FLOAT , " +
> fTmpAttr_X3 + " REAL, " +
> fTmpAttr_Y3 + " DOUBLE PRECISION, " +
> fTmpAttr_Z3 + " double " +
> ")"; vSQL.execSQL(vQuery);


i Log the result



Log.d("TEST", vListData2.get(0).get("jik"));



, the result is not 50000000000.666 but 5e+10, How i can get 50000000000.666 for the result? Please help this newbie :(


Aucun commentaire:

Enregistrer un commentaire