Android uses the command line to manipulate the database

Source: Internet
Author: User
Tags sqlite sqlite database

All application local files are stored in the/data/data/directory

c:\users\nicole>adb shell5039 * * Daemon started successfully *n555j:/ $ su    ($ Just plain user, su command switches to Super User #) n555j:/# CD data/datan555j:/data/data # ls

View Media Database

n555j:/data/Data # cd Com.android.providers.mediaN555J:/data/data/Com.android.providers.media # Lscache Code_cache databases Files Shared_prefs
n555j:/data/data/com.android.providers.media # cd databasesn555j:/data/data/ com.android.providers.media/Databases # lsexternal.db external.dbinternal. db- Shmexternal.dbinternal. db internal. db-wal

View all tables for a database

n555j:/data/data/com.android.providers.media/Databases # sqlite3 External.dbsqlite version3.19.4  .- ,- -  +: -: AEnter". Help"  forusage Hints.sqlite>. Tablealbum_art audio_genres logalbum_info Audio_genres_map searchalbums            Audio_genres_map_noid Searchhelpertitleandroid_metadata Audio_meta Thumbnailsartist_info     Audio_playlists videoartists Audio_playlists_map Videothumbnailsartists_albums_map Filesaudio Imagessqlite>

View table Structure

Sqlite>pragma table_info (images);p Ragma table_info (images);0|_id| integer|0||01|_data| Text|0||02|_size| integer|0||03|_display_name| Text|0||04|mime_type| Text|0||05|title| Text|0||06|date_added| integer|0||07|date_modified| integer|0||08|description| Text|0||09|picasa_id| Text|0||0Ten|isprivate| integer|0||0 One|latitude| double|0||0 A|longitude| double|0||0 -|datetaken| integer|0||0 -|orientation| integer|0||0 the|mini_thumb_magic| integer|0||0 -|bucket_id| Text|0||0 -|bucket_display_name| Text|0||0 -|width| integer|0||0 +|height| integer|0||0 -|is_favorite| integer|0||0 +|date_favorited| Long|0||0 A|datetaken_favorited| Long|0||0 at|creator_package| Text|0||0

Toggle display Mode

Sqlite>. Mode Linesqlite>pragma table_info (images);p Ragma table_info (images); CID=0name=_id Type=INTEGER Notnull=0Dflt_value=PK=0CID=1name=_data Type=TEXT Notnull=0Dflt_value=PK=0CID=2name=_size Type=INTEGER Notnull=0Dflt_value=PK=0

Querying data in a table

Sqlite>Select* fromimages; _id=1_data=/storage/emulated/0/pictures/screenshots/screenshot_2018- to-Ten-Ten- --Geneva. png _size=1987030_display_name= screenshot_2018- to-Ten-Ten- --Geneva. png Mime_type= image/PNG title= screenshot_2018- to-Ten-Ten- --Geneva. png date_added=1525919227date_modified=1525919227Description=picasa_id=isprivate=Latitude=Longitude=Datetaken=1525919224704Orientation=Mini_thumb_magic=bucket_id=1028075469Bucket_display_name=Screenshots Width= theHeight=2160Is_favorite=0date_favorited=1525919227datetaken_favorited=1525919227098Creator_package=

View the table statement for all tables in the database (there is also a hidden sqlite_master table in each SQLite database)

Sqlite>Select* fromSqlite_master;type=Table name=Android_metadatatbl_name=Android_metadatarootpage=3SQL=CREATE TABLE android_metadata (locale TEXT) type=Table name=Thumbnailstbl_name=Thumbnailsrootpage=6SQL=CREATE TABLE thumbnails (_id INTEGER PRIMARY key,_data text,image_id integer,kind integer,width integer,height intege R) Type=Index name=Image_id_indextbl_name=Thumbnailsrootpage=7SQL=CREATE INDEX image_id_index on thumbnails (image_id) type=Table name=Artiststbl_name=Artistsrootpage=TenSQL= CREATE TABLE Artists (artist_id INTEGER PRIMARY key,artist_key text NOT null unique,artist text NOT NULL)

Android uses the command line to manipulate the database

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.