Android SQLite basic Commands

Source: Internet
Author: User

To view the database, you must first find the db file, if copied to the computer, view more methods, on the phone, with commands to view the comparison is direct and convenient.

First to find the location of the database, the general database is stored in the program's private directory, so to get root permissions.

Make sure the development tool is connected to the phone, open the command line, enter the ADB shell

At this point do not get root permissions, input su, hand pop-up prompt, allow to get root permissions

The suffix changes to "#" and the root permission is successfully obtained, so you can enter the application's private directory.

Enter the CD data/data/ package name /databases/, enter the directory of the database

The following are some basic SQLite commands

first Open the database , enter Sqlite3 test_db, open a file named test_db data.

to view the structure of the database, enter the . Schema

View some of the data

It's a little hard to see, to make the data look more beautiful, enter. Head on, display column names, enter. Mode column, display by class

Looks more comfortable.

To see how many tables, enter a. Table

View the structure of a single table,. Schema TableName

The above command to make a simple view of the database, should be sufficient.

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.