Android Sqlite Read Data 99999.99 becomes 100000.00, appears scientific counting method

Source: Internet
Author: User

Problem Description:

the 99999.99 is credited to the SQLite database, and the type is decimal (6,3). change to 100000.00 by Cursor.getstring ()

and storage of billions of bits of data: cursor.getstring () will be abnormal, or directly converted to scientific notation

Solution:

1. Read for SQLite data type (even if SQLite is untyped), the decimal type is cursor.getdouble ().

2. Do not set the type to SQLite, all with text. about how to change the structure of the SQLite table, column properties can see my next article

Cause of Error:

I guess the Android API can be optimized for database access! It is said that the SQLite database is stored according to string, it can only be optimized Android API! Specifically, I don't know.

Inspired:

SQLite no type difference, official online said is manifest type, inmanifest typing, the datatype is a property of the value itself, not of the column I n which the value is stored. you so avoid trouble all use text!

The length of the consideration is also superfluous, the official website says it is stored by the length of the stored data, rather than the length of the statement when the table is built:SQLite, in contrast, with the amount of disk space actually needed to stor E The information in a row. If you store a single character in a VARCHAR (+) column, then only a single byte of disk space is consumed.

Android Sqlite Read Data 99999.99 becomes 100000.00, appears scientific counting method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.