日期:2014-05-16 浏览次数:20638 次
You can find busybox on Benno’s site . If you can find the location of the .db file, you don’t really need busybox. Though i highly recommend it since it has many useful utilities.
C:\android>adb shell # export PATH=/data/busybox:$PATH export PATH=/data/busybox:$PATH # find data -name "*.db" -print find data -name "*.db" -print data/data/com.google.android.providers.contacts/databases/contacts.db data/data/com.google.android.providers.googleapps/databases/accounts.db data/data/com.google.android.providers.im/databases/im.db data/data/com.google.android.providers.media/databases/media.db data/data/com.google.android.providers.telephony/databases/mms.db data/data/com.google.android.providers.telephony/databases/sms.db data/data/com.google.android.providers.telephony/databases/telephony.db data/data/com.google.android.providers.settings/databases/settings.db data/data/com.google.android.maps/databases/maps.db # sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db sqlite3 data/data/com.google.android.providers.contacts/databases/contacts.db SQLite version 3.5.0 Enter ".help" for instructions sqlite>
sqlite> .tables .tables _deleted_people contact_methods peopleLookup calls people phones sqlite> .schema people .schema people CREATE TABLE people (_id INTEGER PRIMARY KEY,_sync_account TEXT,_sync_id TEXT,_sync_time TEXT,_sync_version TEXT,_sync_local_id INTEGER,_sync_dirty INTEGER,_sync_mark INTEGER,name TEXT NOT NULL,notes TEXT,photo TEXT,company TEXT,title TEXT,preferred_phone INTEGER,preferred_email INTEGER); CREATE INDEX peopleSyncIdIndex ON people (_sync_id); CREATE TRIGGER contact_cleanup DELETE ON people BEGIN DELETE FROM peopleLookup WHERE source = old._id;DELETE FROM phones WHERE person = old._id;DELETE FROM contact_methods WHERE person = old._id;UPDATE calls SET person = NULL WHERE person = old._id;END; CREATE TRIGGER contact_to_deleted DELETE ON people WHEN old._sync_id is not null BEGIN INSERT INTO _deleted_people (_sync_id, _sync_account, _sync_version) VALUES (old._sync_id, old._sync_account, old._sync_version);END; CREATE TRIGGER peopleLookup_insert AFTER INSERT ON people BEGIN SELECT _TOKENIZE('peopleLookup', new._id, new.name, ' ');END; CREATE TRIGGER peopleLookup_update UPDATE OF name ON people BEGIN DELETE FROM peopleLookup WHERE source = new._id;SELECT _TOKENIZE('peopleLookup', new._id, new.name, ' ');END; sqlite> .schema phones .schema phones CREATE TABLE phones (_id INTEGER PRIMARY KEY,person INTEGER,type INTEGER,number TEXT,number_key TEXT,label TEXT); CREATE INDEX phonesIndex1 ON phones (person); CREATE INDEX phonesIndex2 ON phones (number_key); CREATE TRIGGER phones_delete DELETE ON phones BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END; CREATE TRIGGER phones_insert INSERT ON phones BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=new.person;END; CREATE TRIGGER phones_update UPDATE ON phones BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END; CREATE TRIGGER preferred_phone_cleanup DELETE ON phones BEGIN UPDATE people SET preferred_phone = NULL WHERE preferred_phone = old._id; END;
sqlite> .header on .header on sqlite> .mode column .mode column sqlite> select * from phones; select * from phones; _id person type number number_key label ---------- ---------- ---------- ------------ ------------ ---------- 1 1 1 +15085551212 21215558051+ 2 1 0 +17815551212 21215551871+ 3 1 2 +16175551212 21215557161+ sqlite> select * from people; select * from people; _id _sync_account _sync_id _sync_time _sync_version _sync_local_id _sync_dirty _sync_mark