`
zengyan2012
  • 浏览: 414211 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

android 通讯录数据表

 
阅读更多

 

Pragma foreign_keys=false;

Begin Transaction;

CREATE TABLE android_metadata (locale TEXT);

Insert  Into [android_metadata] ([locale]) Values("en_US");

CREATE TABLE calls (    --通话记录

_id INTEGER PRIMARY KEY AUTOINCREMENT,

number TEXT,

date INTEGER,

duration INTEGER,

type INTEGER,

new INTEGER,

name TEXT,

numbertype INTEGER,

numberlabel TEXT

);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("1","15555212225","1103588015","7","2","1",NULL,"0",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("2","12222","1103678243","506","2","1",NULL,"0",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("3","15555214556","1104838023","8","2","1",NULL,"0",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("4","147","1104881010","69","2","1","Erhh","2",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("5","122555","1246080846","1","2","1","Ety","2",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("6","5554","1265327046","0","1","1",NULL,"0",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("7","075512345678","1265370030","0","3","1","Erhh","1",NULL);

Insert  Into [calls] ([_id],[number],[date],[duration],[type],[new],[name],[numbertype],[numberlabel]) Values("8","13873870772","1265394655","50","1","1","Erhh","3",NULL);

CREATE TABLE groups (     --组

_id INTEGER PRIMARY KEY AUTOINCREMENT,

_sync_account TEXT,

_sync_id TEXT,

_sync_time TEXT,

_sync_version TEXT,

_sync_local_id INTEGER,

_sync_dirty INTEGER NOT NULL DEFAULT 0,

_sync_mark INTEGER,

name TEXT NOT NULL,

notes TEXT,

should_sync INTEGER NOT NULL DEFAULT 0,

system_id TEXT,

UNIQUE(name,system_id,_sync_account)

);

Insert  Into [groups] ([_id],[_sync_account],[_sync_id],[_sync_time],[_sync_version],[_sync_local_id],[_sync_dirty],[_sync_mark],[name],[notes],[should_sync],[system_id]) Values("1",NULL,NULL,NULL,NULL,NULL,"0",NULL,"Contacts",NULL,"0","Contacts");

CREATE TABLE settings (_id INTEGER PRIMARY KEY,_sync_account TEXT,key STRING NOT NULL,value STRING );

CREATE TABLE voice_dialer_timestamp (_id INTEGER PRIMARY KEY,timestamp INTEGER);

Insert  Into [voice_dialer_timestamp] ([_id],[timestamp]) Values("1","1311230526");

CREATE TABLE _deleted_groups (_sync_version TEXT,_sync_id TEXT,_sync_account TEXT,_sync_mark INTEGER);

CREATE TABLE _deleted_people (_sync_version TEXT,_sync_id TEXT,_sync_account TEXT,_sync_mark INTEGER);

CREATE TABLE _sync_state (_id INTEGER PRIMARY KEY,_sync_account TEXT,data TEXT,UNIQUE(_sync_account));

CREATE TABLE _sync_state_metadata (version INTEGER);

Insert  Into [_sync_state_metadata] ([version]) Values("2");

CREATE TABLE contact_methods (

_id INTEGER PRIMARY KEY AUTOINCREMENT,

person INTEGER REFERENCES people(_id),

kind INTEGER NOT NULL,

data TEXT,aux_data TEXT,

type INTEGER NOT NULL,

label TEXT,

isprimary INTEGER NOT NULL DEFAULT 0

);

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("1","1","1","work@email.cm ",NULL,"2",NULL,"1");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("2","1","1","other1@email.com",NULL,"3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("3","1","1","home@email.com",NULL,"1",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("4","1","1","other@email.com",NULL,"3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("5","1","3","google chat address","pre:5","3",NULL,"1");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("6","1","3","aim chat address","pre:0","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("7","1","3","windows chart address","pre:1","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("8","1","3","yahoo chart address","pre:2","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("9","1","3","jabber chart address","pre:7","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("10","1","3","jabber2 chart address","pre:7","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("11","1","3","jabber3 chart address","pre:7","3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("12","1","2","Home Postal",NULL,"1",NULL,"1");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("13","1","2","Work Postal",NULL,"2",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("14","1","2","Other Postal",NULL,"3",NULL,"0");

Insert  Into [contact_methods] ([_id],[person],[kind],[data],[aux_data],[type],[label],[isprimary]) Values("15","1","2","Other Postal",NULL,"3",NULL,"0");

CREATE TABLE extensions (_id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT NOT NULL,value TEXT NOT NULL,person INTEGER REFERENCES people(_id),UNIQUE(person, name));

CREATE TABLE groupmembership (

_id INTEGER PRIMARY KEY,

person INTEGER REFERENCES people(_id),

group_id INTEGER REFERENCES groups(_id),

group_sync_account STRING,

group_sync_id STRING

);

Insert  Into [groupmembership] ([_id],[person],[group_id],[group_sync_account],[group_sync_id]) Values("1","1","1",NULL,NULL);

Insert  Into [groupmembership] ([_id],[person],[group_id],[group_sync_account],[group_sync_id]) Values("2","2","1",NULL,NULL);

CREATE TABLE organizations (

_id INTEGER PRIMARY KEY AUTOINCREMENT,

company TEXT,

title TEXT,

isprimary INTEGER NOT NULL DEFAULT 0,

type INTEGER NOT NULL,label TEXT,

person INTEGER REFERENCES people(_id)

);

Insert  Into [organizations] ([_id],[company],[title],[isprimary],[type],[label],[person]) Values("1","Organizations Work Compny",NULL,"1","1",NULL,"1");

Insert  Into [organizations] ([_id],[company],[title],[isprimary],[type],[label],[person]) Values("2","Organizations Other Company",NULL,"0","2",NULL,"1");

CREATE TABLE people (

_id INTEGER PRIMARY KEY AUTOINCREMENT,

_sync_account TEXT,

_sync_id TEXT,

_sync_time TEXT,

_sync_version TEXT,

_sync_local_id INTEGER,

_sync_dirty INTEGER NOT NULL DEFAULT 0,

_sync_mark INTEGER,

name TEXT COLLATE LOCALIZED,

notes TEXT COLLATE LOCALIZED,

times_contacted INTEGER NOT NULL DEFAULT 0,

last_time_contacted INTEGER,

starred INTEGER NOT NULL DEFAULT 0,

primary_phone INTEGER REFERENCES phones(_id),

primary_organization INTEGER REFERENCES organizations(_id),

primary_email INTEGER REFERENCES contact_methods(_id),

photo_version TEXT,

custom_ringtone TEXT,

send_to_voicemail INTEGER,

phonetic_name TEXT COLLATE LOCALIZED);

Insert  Into [people] ([_id],[_sync_account],[_sync_id],[_sync_time],[_sync_version],[_sync_local_id],[_sync_dirty],[_sync_mark],[name],[notes],[times_contacted],[last_time_contacted],[starred],[primary_phone],[primary_organization],[primary_email],[photo_version],[custom_ringtone],[send_to_voicemail],[phonetic_name]) Values("1",NULL,NULL,NULL,NULL,NULL,"1",NULL,"Erhh","Notes2","2","1265455570","0","3","1","1",NULL,NULL,"0",NULL);

Insert  Into [people] ([_id],[_sync_account],[_sync_id],[_sync_time],[_sync_version],[_sync_local_id],[_sync_dirty],[_sync_mark],[name],[notes],[times_contacted],[last_time_contacted],[starred],[primary_phone],[primary_organization],[primary_email],[photo_version],[custom_ringtone],[send_to_voicemail],[phonetic_name]) Values("2",NULL,NULL,NULL,NULL,NULL,"1",NULL,"Ety",NULL,"0",NULL,"0","2",NULL,NULL,NULL,NULL,"0",NULL);

CREATE TABLE peopleLookup (

token TEXT,

source INTEGER REFERENCES people(_id),

token_index INTEGER);

Insert  Into [peopleLookup] ([token],[source],[token_index]) Values("314b3737","1","0");

Insert  Into [peopleLookup] ([token],[source],[token_index]) Values("314f59","2","0");

CREATE TABLE peopleLookupWithPhoneticName (

token TEXT,

source INTEGER REFERENCES people(_id),

token_index INTEGER);

Insert  Into [peopleLookupWithPhoneticName] ([token],[source],[token_index]) Values("314b3737","1","0");

Insert  Into [peopleLookupWithPhoneticName] ([token],[source],[token_index]) Values("314f59","2","0");

CREATE TABLE phones (

_id INTEGER PRIMARY KEY AUTOINCREMENT,

person INTEGER REFERENCES people(_id),

type INTEGER NOT NULL,

number TEXT,

number_key TEXT,

label TEXT,

isprimary INTEGER NOT NULL DEFAULT 0);

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) 

         Values("2","2","2","122555","555221",NULL,"1");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) 

         Values("3","1","1","075-512-345678","876543215570",NULL,"1");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) Values("4","1","3","1-387-387-0772","27707837831",NULL,"0");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) Values("5","1","2","1-397-387-0772","27707837931",NULL,"0");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) Values("6","1","7","1-401-234-56","654321041",NULL,"0");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) Values("7","1","7","1-411-234-5678","87654321141",NULL,"0");

Insert  Into [phones] ([_id],[person],[type],[number],[number_key],[label],[isprimary]) Values("8","1","7","1-421-234-567","7654321241",NULL,"0");

CREATE TABLE photos       --图片照片

(

_id INTEGER PRIMARY KEY AUTOINCREMENT,

exists_on_server INTEGER NOT NULL DEFAULT 0,

person INTEGER REFERENCES people(_id), 

local_version TEXT,

data BLOB,sync_error TEXT,

_sync_account TEXT,

_sync_id TEXT,_sync_time TEXT,

_sync_version TEXT,

_sync_local_id INTEGER,

_sync_dirty INTEGER NOT NULL DEFAULT 0,

_sync_mark INTEGER,UNIQUE(person) 

);

Insert  Into [photos] ([_id],[exists_on_server],[person],[local_version],[data],[sync_error],[_sync_account],[_sync_id],[_sync_time],[_sync_version],[_sync_local_id],[_sync_dirty],[_sync_mark]) 

           Values("1","0","1",NULL,X'F53F3F00104A46494600010100000100010000F53F004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432F53F0043010909090C0B0C180D0D1832211C213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232F53F0011080060006003012200021101031101F53F001F0000010501010101010100000000000000000102030405060708090A0BF53F003F0002010303020403050504040000017D0102030004110512213141061351610722711432BC3F2342F715526F243362723F0A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A0E97729B00439FDEBAE5A6160624399779DD9A4CA892E3C9BF2D7ACFB4811D9F6EB1BC8C3F3F001F0100030101010101010101010000000000000102030405060708090A0BF53F003F00020102040403040705040400010277000102031104052131061241510761711322323F1442BDF7092333523F62723F1624343F3F18191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A11603691C3427CD9C47245972B119200AF2DC55044ECA4C969D5DDCFB4811D5DDD8A2CEBF53F000C03010002110311003F0033493FA150173F30075C3FFECE0C063F3D69081C122972187068765D46C3411B3F243C11AF3F6534292E4C2E0E1F5A4DA04D3102115C41727A42FB28781A727D076011B1158714F63F3F68663F3F51B50416253F514D018968963C533FF44372DE4243562C3F5305316744ACDE482B67302C925857234DF63F53F375013E093F391C7AAE3F05CF673F3F425F1B3F60243F154B3F096D2952F7A0533F3F1F3F76ECF50005173F72554378D45C2C413F287B9A224C26AE263C113F3F979F594B1B583BB6F00F9F3F785BAB730DEF5253AC0083753764084D6E30F1156B3F0064571F79013F34E20F7A3E3F6A0E243459676D1F7D4D7551DF7BF449885637CB9177CE1B545585393F9A3FB5504B533D6EBC2A3F20553FBD56AA3F1B947A56F500964B1E3F0536DC7935451C854655533F3D766567C03FEF71F500C66F3F3F2F03734CF50091947B3878DC2F8B232B7C467DB83F5B67733FA80C76766B416699085038F13E1D2CDB4347853C3FC10A3A3323551F997E3F5506463D69E4F5003F74824C3F293F1E5F133F6E45184E53271C3D539D4673781E3F40F500908804B3787A0535CA81E07C1C4F671B35A640FC3F143F3E64780E4209723BCC02395F7A10737D1EDC7EBAA11F1B3F35533F5667075E542D52D8EAF53F696E3C0F788F6B7B403F3F3F84F5003F3F1965E0626B0A151D0F5B0DC02829396A79853A641075F3F50086653F9DC73F4F3F49F50009557A3FBCC668943F35063F7F0E783A5D347D16000E80B9439A693004AD19684F29603F3FD43D174FB5B710A3FA7C3B30723F5F6A601678383FBA3F3F083F5A5FED3FDE1C3A74733A5464A33FAC2E3F003F3F3F023F326D4E27C4181EF500B93F3F786BC57E607D6B3FDE395B5F3F430F18ED062E4EC8573F000C353F5C476CCA5F0B3F0069AEEC543F3F2E3F6E0818260A3F6E612D3A687869731044253D4939D77B56C18D0C1CCF3F7A4AA2945F15513E58096A683F254CD8E73F7A1997E86D3F5D3E131715083F4B3FDE3B31A0A94D3F447C4E5BDE5C94C0EC22430F7F3A7D82423F2B3F7F27C5690F0179787A511FF7CEC869B5290D3A3FAF23C11FA3210E3C163F16957BAD5371573C1F0249A86FF0FC3373AF2DA83FF5420C715D1422A634AC7D716ADA48703F0E49E2EE14C9B60B035524B878BF0143767761E6160A6200263E0569AC47334D19B8DF4645600F3526703E3F293CBA46354E54993F43CB7DEE8A3F3F3C63603F6D96113F74393FF500ADF554CA3F993F149B3F937A1F450A9FAA7A5ED0476564405CD059D0ED7D6E4F7A3F005B6B5C0C087B532D62313F4822232E3437314871B5483FA10917455E335D322B6A5A1F3B392B3F671D69733F40D75255242F30633F4AD9DEBD403F7A1864BF979AC3335C854A497291493F3FF53F',NULL,NULL,NULL,NULL,NULL,NULL,"1",NULL);

Insert  Into [photos] ([_id],[exists_on_server],[person],[local_version],[data],[sync_error],[_sync_account],[_sync_id],[_sync_time],[_sync_version],[_sync_local_id],[_sync_dirty],[_sync_mark]) 

           Values("2","0","2",NULL,X'F53F3F00104A46494600010100000100010000F53F004300080606070605080707070909080A0C140D0C0B0B0C1912130F141D1A1F1E1D1A1C1C20242E2720222C231C1C2837292C30313434341F27393D38323C2E333432F53F0043010909090C0B0C180D0D1832211C213232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232F53F0011080060006003012200021101031101F53F001F0000010501010101010100000000000000000102030405060708090A0BF53F003F0002010303020403050504040000017D0102030004110512213141061351610722711432BC3F2342F715526F243362723F0A161718191A25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A0E97729B00439FDEBAE5A6160624399779DD9A4CA892E3C9BF2D7ACFB4811D9F6EB1BC8C3F3F001F0100030101010101010101010000000000000102030405060708090A0BF53F003F00020102040403040705040400010277000102031104052131061241510761711322323F1442BDF7092333523F62723F1624343F3F18191A262728292A35363738393A434445464748494A535455565758595A636465666768696A737475767778797A11603691C3427CD9C47245972B119200AF2DC55044ECA4C969D5DDCFB4811D5DDD8A2CEBF53F000C03010002110311003F00C5288B310A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28650A28653FF53F',NULL,NULL,NULL,NULL,NULL,NULL,"1",NULL);

CREATE TRIGGER contact_cleanup DELETE ON people BEGIN DELETE FROM peopleLookup WHERE source = old._id;DELETE FROM peopleLookupWithPhoneticName WHERE source = old._id;DELETE FROM phones WHERE person = old._id;DELETE FROM contact_methods WHERE person = old._id;DELETE FROM organizations WHERE person = old._id;DELETE FROM groupmembership WHERE person = old._id;DELETE FROM extensions WHERE person = old._id;END;

CREATE TRIGGER contact_methods_delete DELETE ON contact_methods BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER contact_methods_insert INSERT ON contact_methods BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=new.person;END;

CREATE TRIGGER contact_methods_INSERT_typeAndLabel AFTER INSERT ON contact_methods   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER contact_methods_update UPDATE ON contact_methods BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER contact_methods_UPDATE_typeAndLabel AFTER UPDATE ON contact_methods   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER extensions_delete DELETE ON extensions BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER extensions_insert INSERT ON extensions BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=new.person; END;

CREATE TRIGGER extensions_update AFTER UPDATE ON extensions BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person; END;

CREATE TRIGGER groupmembership_delete DELETE ON groupmembership BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER groupmembership_insert INSERT ON groupmembership BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=new.person; END;

CREATE TRIGGER groupmembership_update AFTER UPDATE ON groupmembership BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person; END;

CREATE TRIGGER groups_cleanup DELETE ON groups BEGIN UPDATE groupmembership SET group_id = null WHERE group_id = old._id;END;

CREATE TRIGGER groups_to_deleted DELETE ON groups WHEN old._sync_id is not null BEGIN INSERT INTO _deleted_groups (_sync_id, _sync_account, _sync_version) VALUES (old._sync_id, old._sync_account, old._sync_version);END;

CREATE TRIGGER organizations_delete DELETE ON organizations BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER organizations_insert INSERT ON organizations BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=new.person; END;

CREATE TRIGGER organizations_INSERT_typeAndLabel AFTER INSERT ON organizations   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER organizations_update AFTER UPDATE ON organizations BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person; END;

CREATE TRIGGER organizations_UPDATE_typeAndLabel AFTER UPDATE ON organizations   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER peopleDeleteAndPhotos DELETE ON people  BEGIN   DELETE FROM photos WHERE person=OLD._id; END;

CREATE TRIGGER peopleLookupWithPhoneticName_insert AFTER INSERT ON people BEGIN SELECT _TOKENIZE('peopleLookupWithPhoneticName', new._id, GET_NORMALIZED_STRING(CASE WHEN (new.phonetic_name IS NOT NULL AND new.phonetic_name != '') THEN new.phonetic_name ELSE (CASE WHEN (new.name is NOT NULL AND new.name != '') THEN new.name ELSE '' END) END), ' ', 1);END;

CREATE TRIGGER peopleLookupWithPhoneticName_update UPDATE OF name, phonetic_name ON people BEGIN DELETE FROM peopleLookupWithPhoneticName WHERE source = new._id;SELECT _TOKENIZE('peopleLookupWithPhoneticName', new._id, GET_NORMALIZED_STRING(CASE WHEN (new.phonetic_name IS NOT NULL AND new.phonetic_name != '') THEN new.phonetic_name ELSE (CASE WHEN (new.name is NOT NULL AND new.name != '') THEN new.name ELSE '' END) END), ' ', 1);END;

CREATE TRIGGER peopleLookup_insert AFTER INSERT ON people BEGIN SELECT _TOKENIZE('peopleLookup', new._id, new.name, ' ', 1);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, ' ', 1);END;

CREATE TRIGGER people_timesContacted UPDATE OF last_time_contacted ON people BEGIN UPDATE people SET times_contacted = (new.times_contacted + 1) WHERE _id = new._id;END;

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_INSERT_typeAndLabel AFTER INSERT ON phones   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER phones_update UPDATE ON phones BEGIN UPDATE people SET _sync_dirty=1 WHERE people._id=old.person;END;

CREATE TRIGGER phones_UPDATE_typeAndLabel AFTER UPDATE ON phones   WHEN (NEW.type != 0 AND NEW.label IS NOT NULL) OR         (NEW.type = 0 AND NEW.label IS NULL)   BEGIN      SELECT RAISE (ABORT, 'exactly one of type or label must be set');    END;

CREATE TRIGGER timestamp_trigger1 AFTER UPDATE ON phones BEGIN UPDATE voice_dialer_timestamp SET timestamp=strftime('%s', 'now') WHERE _id=1;END;

CREATE TRIGGER timestamp_trigger2 AFTER UPDATE OF name ON people BEGIN UPDATE voice_dialer_timestamp SET timestamp=strftime('%s', 'now') WHERE _id=1;END;

CREATE INDEX contactMethodsPeopleIndex ON contact_methods (person);

CREATE INDEX extensionsIndex1 ON extensions (person, name);

CREATE INDEX groupmembershipIndex1 ON groupmembership (person, group_id);

CREATE INDEX groupmembershipIndex2 ON groupmembership (group_id, person);

CREATE INDEX groupmembershipIndex3 ON groupmembership (group_sync_account, group_sync_id);

CREATE INDEX groupsSyncDirtyIndex ON groups (_sync_dirty);

CREATE INDEX organizationsIndex1 ON organizations (person);

CREATE INDEX peopleLookupIndex ON peopleLookup (token,source);

CREATE INDEX peopleLookupWithPhoneticNameIndex ON peopleLookupWithPhoneticName (token,source);

CREATE INDEX peopleNameIndex ON people (name);

CREATE INDEX peopleSyncDirtyIndex ON people (_sync_dirty);

CREATE INDEX peopleSyncIdIndex ON people (_sync_id);

CREATE INDEX phonesIndex1 ON phones (person);

CREATE INDEX phonesIndex2 ON phones (number_key);

CREATE INDEX photoPersonIndex ON photos (person);

CREATE INDEX photosSyncDirtyIndex ON photos (_sync_dirty);

Commit Transaction;

Pragma foreign_keys=true;

分享到:
评论

相关推荐

    Android通讯录附搜索及字母索引Demo

    综上所述,"Android通讯录附搜索及字母索引Demo"涵盖了Android开发中的多个重要概念和技术,对于想要深入学习Android应用开发,尤其是涉及数据存储和UI交互的开发者来说,这是一个宝贵的实践资源。通过这个Demo,...

    Android通讯录.zip

    《Android通讯录项目详解》 在移动开发领域,Android平台上的通讯录管理是不可或缺的一部分,它涉及到用户数据的存储、查询、更新以及删除等操作。本篇将详细探讨基于Android的通讯录项目,主要涉及的技术点包括...

    Android通讯录源代码

    【Android通讯录源代码】是Android平台上实现联系人管理功能的一种源码实现,它涉及到Android系统的核心组件和服务,包括数据库操作、UI设计、数据存储和检索等关键知识点。在这个源码中,我们可以深入理解Android...

    使用android通讯录中的内容提供者实例

    在Android系统中,内容提供者(Content ...总结,Android通讯录内容提供者是访问和管理用户联系人数据的核心工具。通过学习和实践,开发者可以构建出强大的通讯录应用,提升用户体验,同时确保数据的安全和隐私。

    Android通讯录的源代码

    【Android通讯录源代码解析】 在移动设备上,通讯录是一个至关重要的功能,它帮助用户存储、管理和查找联系人的信息。本项目是基于Java语言开发的Android通讯录应用,提供了全面的通讯录功能,旨在帮助开发者理解...

    android通讯录(完整,可运行)

    《Android通讯录系统详解——基于adt-bundle-windows的实现》 在移动设备上,通讯录是用户日常使用的重要功能之一。Android系统以其开放性和灵活性,为开发者提供了丰富的API,使得开发自定义通讯录应用成为可能。...

    Android通讯录的开发-完整代码

    以上就是基于标题“Android通讯录的开发-完整代码”和描述“Android]通讯录的开发_完整代码,项目可直接运行,欢迎下载学习”的主要技术知识点。通过学习和实践这个项目,开发者可以深入了解Android应用开发的各个...

    android 通讯录(注释完整)

    1. 数据存储:Android通讯录通常使用SQLite数据库来存储联系人信息。SQLite是轻量级的、嵌入式的关系型数据库,它允许开发者在应用中执行SQL语句,进行数据的增删改查。创建一个Contact表,包含姓名、电话号码、电子...

    自己做的android通讯录

    在这个项目中,开发者可能使用ContentProvider来管理本地通讯录数据,实现了增删改查的功能。同时,Android的SQLite数据库是常用的本地数据存储方式,它轻量级且高效,适合存储结构化的数据,如联系人的姓名、电话...

    Android通讯录源码.rar

    【Android通讯录源码分析】 本项目是一款基于Android平台的通讯录应用,它不仅提供了基本的本地联系人存储和检索功能,还集成了拨打电话和发送短信的能力,非常适合用于学习和理解Android应用开发中的核心概念和...

    android 通讯录(A-Z)带可模糊查询搜索框

    通讯录数据通常是姓名列表,我们可以通过对姓名的首字母进行排序,然后将排序后的数据传递给`Adapter`。在Android中,这可以通过`Collections.sort()`方法实现,配合自定义的比较器来完成。 模糊查询搜索框是通讯录...

    android 通讯录 (有索引)

    本教程将深入探讨如何在Android中与通讯录进行交互,尤其是涉及到有索引和分割的通讯录数据处理。 首先,我们需要了解Android提供的Contacts Provider,这是Android系统用于存储和检索联系人数据的API。通过...

    仿android通讯录demo

    2. **数据存储**:通讯录数据通常从系统联系人API获取,使用`ContentResolver`来查询和操作联系人信息。开发者可能还使用SQLite数据库来缓存部分数据,提高加载速度。 3. **过滤和搜索**:搜索功能的实现可能涉及到...

    Android通讯录源码

    这份"Android通讯录源码"提供了一个实现这一功能的实例,让我们来深入探讨其中的关键技术。 1. **Android UI 设计**:在Android应用中,通讯录通常使用ListView或RecyclerView来显示联系人列表。这些组件允许动态...

    android通讯录简单实现

    7. **数据同步**:考虑到同步手机的系统通讯录,可以利用Android的ContactContract类和ContentResolver,将应用中的联系人数据与系统通讯录进行同步。 以上就是实现“android4.3通讯录的简单实现”的核心技术点。在...

    基于android通讯录的实现

    本项目“基于Android通讯录的实现”旨在为初学者和开发者提供一个完整的实现案例,帮助他们理解和掌握Android系统中如何与通讯录数据进行交互。 1. **Android权限管理**: 在Android中,访问通讯录数据需要获取...

    Android通讯录详细demo

    本教程将深入探讨如何在Android应用中实现对通讯录的获取、添加、删除等操作,通过提供的"Android通讯录详细demo",你可以更好地理解这些概念。 首先,让我们了解Android系统中的通讯录API。Android提供了一个名为`...

    android通讯录

    下面将详细探讨Android通讯录的相关知识点。 1. **通讯录数据存储**: - Android使用SQLite数据库存储通讯录数据,每个联系人可能包含多个条目,如姓名、电话号码、电子邮件地址、生日等。 - 数据表主要分为两个...

    android通讯录程序的实现.rar

    这个压缩包“android通讯录程序的实现.rar”显然包含了实现这样一个程序的所有源代码和相关说明,非常适合初学者或者对Android编程感兴趣的开发者学习。下面我们将深入探讨这个项目可能包含的知识点。 首先,通讯录...

    Android2.2通讯录源码

    1. **Content Provider**:通讯录数据存储的核心组件,它提供了一个统一的数据接口,使得不同的应用可以共享和访问联系人信息。在Android 2.2的源码中,`ContactsProvider2`是主要的Content Provider实现,它封装了...

Global site tag (gtag.js) - Google Analytics