android - Ormlite RawRowMapper truncated double -


i using rawrowmapper load relevant columns ormlite. rawrowmapper returns data string.

the observation truncates double value.

example: data inserted -> 57.1117146374

data type used store data -> double

data ormlite when directly queried: -> 57.1117146374 (this correct , means ormlite storing data correctly)

data ormlite when using mapper -> 57.1117 (truncated data coming part of string[] resultcolumns

any idea how avoid getting truncated?

edit:

@databasefield(columnname = "lat") private double lat; 

object field:

private double lat; 

the key here string in resultcolumns[], truncated.

data ormlite when using mapper -> 57.1117 (truncated data coming part of string[] resultcolumns

the problem seems getting double value out string truncated android's cursor.getstring(...) method. not sure why if result extracted using cursor.getdouble(columnindex); on same column-index, full precision preserved.

the solution here believe map rows differently. if use dao.queryraw(string, datatype[], ...) method, double field seems extracted appropriately. here's sample test class.

genericrawresults<object[]> results =         dao.queryraw(dao.querybuilder().selectcolumns("lat")             .preparestatementstring(), new datatype[] { datatype.double }); closeableiterator<object[]> iterator = results.closeableiterator(); try {     asserttrue(iterator.hasnext());     object[] objs = iterator.next();     assertequals(foo.doublefield, objs[0]); } {     iterator.close(); } 

you use custom row mapper , dao.queryraw(string, rawrowmapper, ...) method convert , return custom object double field.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -