I’m using Sqlite with Java using SQLiteJDBC. When querying sqlite, I’ve found out that these two return different things:
String str = result.getDouble("field_name").toString();
String str = result.getString("field_name");
The latter implicitly rounds up the digit of the REAL number in sqlite, and converts it to String. The former doesn’t do the round up thing.
Is this a bug of sqlite JDBC implementation or is this a common sense in SQL queries?
No, its not a bug, definitely. In the former,
toString()method ofDoubleclass is invoked. Whereas, in the latter case, SQLLite implementation is working.