iPhone三大数据库结构中英文对照翻译

新手教程
0 2524
一、AddressBook.sqlitedb 通讯录数据库location: /private/var/root/Library/AddressBook/AddressBook.sqlitedb1.ABGroup 联系人分组信息ROWID:组ID,自增PKName:组名2.ABGroupChanges 分组信息更新record:type:3.ABGroupMembers 组联系人UID: PKgroup_id:组ID,对应ABGroup.ROWIDmember_type: 组员类别member_id: 组员(联系人)ID,对应ABPerson.ROWID注意:UNIQUE(group_id, member_type, member_id)4.ABMultiValue 存储联系人的各种联系方式UID: PKrecord_id: 联系人ID,对应ABPerson.ROWIDproperty: 属性值. 3.电话; 4.email; 待补充…identifier: 标识符.0,1,2,3,4,目前所知用于排序label: 标志值. 1.mobile;2.home;3.work;4.other;5.homepage(URL) 对应ABMultiValueLabel.valuevalue: 值. 例如一个手机号码13800138000,或一个email地址foo@bar.com5.ABMultiValueEntry (未知)parent_id: (未知)key: (未知)value: (未知)注意:UNIQUE(parent_id, key)6.ABMultiValueEntryKey (未知)value: (未知)注意:UNIQUE(value)7.ABMultiValueLabel 联系方式标志值列表value: 见ABMultiValue.label8.ABPersonROWID 自增PK,也是联系人的唯一标识First 名字Last 姓Middle (未定)FirstPhonetic (未定,貌似留作语音拨号用的)MiddlePhonetic (未定,貌似留作语音拨号用的)LastPhonetic (未定,貌似留作语音拨号用的)Organization 所在公司,组织Department 所在部门Note 注释Kind 未定Birthday 生日JobTitle 头衔Nickname 昵称Prefix 前缀Suffix 后缀FirstSort 排序用(具体未知)LastSort 排序用(具体未知)CreationDate 创建时间ModificationDate 最后修改时间CompositeNameFallback (未知)9.ABPersonChanges (未知)recordtype10.ABPersonMultiValueDeletes (未知)record_idproperty_ididentifier11.ABPhoneLastFour 电话号码后四位匹配表multivalue_id 对应ABMultiValue.UIDvalue 电话号码后四位12.ABRecent (未知)datenamepropertyvalue13.sorting_first_section_list (未知)characternumber14.sorting_last_section_list (未知)characternumber15.sqlite_sequence (用于记录序列)name:表命,如ABPersonseq: 最新序列号— ==========下面是建表语句==========CREATE TABLE ABGroup (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT);CREATE TABLE ABGroupChanges (record INTEGER, type INTEGER);CREATE TABLE ABGroupMembers (UID INTEGER PRIMARY KEY, group_id INTEGER, member_type INTEGER, member_id INTEGER, UNIQUE(group_id, member_type, member_id));CREATE TABLE ABMultiValue (UID INTEGER PRIMARY KEY, record_id INTEGER, property INTEGER, identifier INTEGER, label INTEGER, value TEXT);CREATE TABLE ABMultiValueEntry (parent_id INTEGER, key INTEGER, value TEXT, UNIQUE(parent_id, key));CREATE TABLE ABMultiValueEntryKey (value TEXT, UNIQUE(value));CREATE TABLE ABMultiValueLabel (value TEXT, UNIQUE(value));CREATE TABLE ABPerson (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, First TEXT, Last TEXT, Middle TEXT, FirstPhonetic TEXT, MiddlePhonetic TEXT, LastPhonetic TEXT, Organization TEXT, Department TEXT, Note TEXT, Kind INTEGER, Birthday TEXT, JobTitle TEXT, Nickname TEXT, Prefix TEXT, Suffix TEXT, FirstSort TEXT, LastSort TEXT, CreationDate INTEGER, ModificationDate INTEGER, CompositeNameFallback TEXT);CREATE TABLE ABPersonChanges (record INTEGER, type INTEGER);CREATE TABLE ABPersonMultiValueDeletes (record_id INTEGER, property_id INTEGER, identifier INTEGER);CREATE TABLE ABPhoneLastFour (multivalue_id INTEGER PRIMARY KEY, value TEXT);CREATE TABLE ABRecent(date INTEGER, name, property INTEGER, value);CREATE TABLE sorting_first_section_list(character, number, UNIQUE(character));CREATE TABLE sorting_last_section_list(character, number, UNIQUE(character));CREATE TABLE sqlite_sequence(name TEXT, seq INTEGER);— ==========下面是创建索引==========CREATE INDEX ABMultiValueRecordIDIndex on ABMultiValue(record_id);CREATE INDEX ABMultiValueLabelIndex ON ABMultiValue(label);CREATE INDEX ABMultiValueEntryKeyIndex ON ABMultiValueEntry(key);CREATE INDEX ABFirstSortIndex on ABPerson(FirstSort);CREATE INDEX ABLastSortIndex on ABPerson(LastSort);CREATE INDEX ABPhoneLastFourIndex ON ABPhoneLastFour(value);CREATE INDEX ABRecent_value_index ON ABRecent(property, value);CREATE INDEX ABRecent_date_index ON ABRecent(property, date);— ==========下面是创建触发器==========CREATE TRIGGER delete_phone_last_four AFTER DELETE ON ABMultiValueBEGINDELETE FROM ABPhoneLastFour WHERE multivalue_id = OLD.UID;END;CREATE TRIGGER sorting_first_prefix_trigger AFTER INSERT ON ABPersonBEGININSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number from sorting_first_section_list WHERE character = substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1)), 0));END;CREATE TRIGGER update_first_prefix_trigger AFTER UPDATE ON ABPersonBEGININSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1), (SELECT number from sorting_first_section_list WHERE character = substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1)) - 1);INSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number from sorting_first_section_list WHERE character = substr(IFNULL(NEW.FirstSort, ‘~’), 1, 1)), 0));END;CREATE TRIGGER delete_first_prefix_trigger AFTER DELETE ON ABPersonBEGININSERT OR REPLACE INTO sorting_first_section_list VALUES(substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1), (SELECT number from sorting_first_section_list WHERE character = substr(IFNULL(OLD.FirstSort, ‘~’), 1, 1)) - 1);END;CREATE TRIGGER sorting_last_prefix_trigger AFTER INSERT ON ABPersonBEGININSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(NEW.LastSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number from sorting_last_section_list WHERE character = substr(IFNULL(NEW.LastSort, ‘~’), 1, 1)), 0));END;CREATE TRIGGER update_last_prefix_trigger AFTER UPDATE ON ABPersonBEGININSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(OLD.LastSort, ‘~’), 1, 1), (SELECT number from sorting_last_section_list WHERE character = substr(IFNULL(OLD.LastSort, ‘~’), 1, 1)) - 1);INSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(NEW.LastSort, ‘~’), 1, 1), 1 + IFNULL((SELECT number from sorting_last_section_list WHERE character = substr(IFNULL(NEW.LastSort, ‘~’), 1, 1)), 0));END;CREATE TRIGGER delete_last_prefix_trigger AFTER DELETE ON ABPersonBEGININSERT OR REPLACE INTO sorting_last_section_list VALUES(substr(IFNULL(Old.LastSort, ‘~’), 1, 1), (SELECT number from sorting_last_section_list WHERE character = substr(IFNULL(Old.LastSort, ‘~’), 1, 1)) - 1);END;二、notes.db 记事本数据库location: /private/var/root/Library/Notes/notes.db1.Note 摘要信息记录表creation_date: 创建时间title: 标题summary: 摘要2.note_bodies 详细信息note_id: note IDdata: 记事内容,包含标题? ==========下面是建表语句==========CREATE TABLE Note (creation_date INTEGER, title TEXT, summary TEXT);CREATE TABLE note_bodies (note_id INTEGER, data, UNIQUE(note_id));? ==========下面是创建触发器==========CREATE TRIGGER delete_note_bodies AFTER DELETE ON NoteBEGINDELETE FROM note_bodies WHERE note_id = OLD.ROWID;END;三、sms.db 短信数据库location: /private/var/root/Library/SMS/sms.db1.message 短信表ROWID: 自增PKaddress: 对方手机号码(+86)date: 时间text: 内容flags: 标记. 2.收到的;3.自己发送的replace: (未知)svc_center: (未知)? ==========下面是建表语句==========CREATE TABLE message (ROWID INTEGER PRIMARY KEY AUTOINCREMENT, address TEXT, date INTEGER, text TEXT, flags INTEGER, replace INTEGER, svc_center TEXT);
精选帖子
苹果iphone 8/plus值得买吗 iphone 8/plus预约人数破百万 4700
iphone8/iphonex怎么预定 iphone8/iphonex购买攻略 4651
iphone7什么时候降价 iphone7和iphone8区别介绍 4996
解开末代皇帝溥仪无后之谜 被虎狼宫女榨干 4123
台媒讽刺中国足球:国脚年薪1亿身材却像白斩鸡 4055
skype搜索不到好友怎么办 4714
天天酷跑魔法少爷和羊小妃妃实战搭配攻略 4735
天天酷跑飞天云豹搭配技巧 最强搭配攻略 4396
王者荣耀武则天多少必出?获取方法介绍 4641
热门帖子
人到中年才能深切地体会到人生的意义责任和问题,反省到人生的究竟,所以哀乐之感得以深沉。——宗白华 987
模拟的成绩一定不要成为包袱,成为阴影。 975
遇到会做的题:仔细;遇到不会做的题:冷静。 957
杨幂的身材究竟有多好?看路人镜头的她,网友:难怪是“少女幂” 950
最弱的人,集中精力于单一目标,也能有所成就,最强的人,分心太多事务,可能一事无成。 947
金钱再多也无法阻止死亡,长相再美也不能讨好阎王,声名再大也要经过生死。因此人生不要太贪,不要活得太累。 928
对自己狠一点,逼自己努力,再过几年你将会感谢今天发狠的自己、恨透今天懒惰自卑的自己。 906
人生就是一场漫长的自娱自乐。讨别人欢心只是小聪明,每天都能讨到自己的欢喜才算大智慧。 896
须交有道之人,莫结无义之友。饮清静之茶,莫贪花色之酒。开方便之门,闲是非之口。 892