sqlite3 使用

sqlite3 usage

1. 以系统联系人为例 介绍如何使用之

[步骤]

1. 进入 <sdk>/tools  我的命令如下:

C:\Documents and Settings\Administrator>e:

E:\>cd anddev

E:\anddev>cd sdk

E:\anddev\sdk>cd android-sdk-windows-1.5_r2

E:\anddev\sdk\android-sdk-windows-1.5_r2>cd tools

E:\anddev\sdk\android-sdk-windows-1.5_r2\tools>adb shell

2. 列出emulator 所以可用application 列表 

# cd data/data
cd data/data
# ls
ls
com.Utility.Contactss.Test
com.android.providers.userdictionary
com.android.term
com.android.providers.telephony
com.android.spare_parts
com.android.soundrecorder
com.android.providers.settings
com.android.settings
com.android.sdksetup
com.android.inputmethod.pinyin
com.android.phone
com.android.packageinstaller
com.android.netspeed
com.android.music
com.android.mms
com.android.providers.media
com.android.launcher
com.android.inputmethod.latin
com.android.htmlviewer
com.android.googlesearch
com.android.fallback
com.android.email
com.android.providers.drm
com.android.providers.downloads
com.android.development
com.android.customlocale
com.android.providers.contacts
com.android.contacts
com.android.camera
com.android.calculator2
com.android.browser
com.android.alarmclock

3. 进入联系人ContentProvider存放数据库

# cd com.android.providers.contacts
cd com.android.providers.contacts
# ls
ls
databases
lib

4. 进入数据库 并列出所有数据库

# cd databases
cd databases
# ls
ls
contacts.db

5. 打开目标数据库 此处为:contacts.db

sqlite3 contacts.db

6. 列出该数据库的所有table

sqlite> .tables
.tables
_deleted_groups         contact_methods         peopleLookup
_deleted_people         extensions              phones
_sync_state             groupmembership         photos
_sync_state_metadata    groups                  settings
android_metadata        organizations           voice_dialer_timestamp
calls                   people
sqlite>

7. 其中 people 是存放联系人通讯录的table  列出其所有内容

sqlite> select * from people;
select * from people;
1||||||1||griffin||0||0|1|||||0|
2||||||1||griffin||0||0|2|||||0|
3||||||1||shijintao|Jiangsu.Huaian|0||0|3|1|1|||0|

8. 而系统联系人名单为:

 sqlite3 使用

相关推荐