开发者

Java+sqlite REAL field to String

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 开发者_Go百科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 of Double class is invoked. Whereas, in the latter case, SQLLite implementation is working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜