您现在的位置: IOS教程網 >> IOS系統 >  >> iOS 教學 >> iOS 相關教學

iPhone 三大資料庫結構中英文對照翻譯

編輯:iOS 相關教學
一、AddressBook.sqlitedb 通訊錄資料庫
位置:/private/var/root/Library/AddressBook/AddressBook.sqlitedb
1. ABGroup 聯絡人分組資訊
ROWID:組 ID,自增主鍵
Name:組名
2. ABGroupChanges 分組資訊更新
record:
type:
3. ABGroupMembers 組聯絡人
UID:主鍵
group_id:組 ID,對應 ABGroup.ROWID
member_type:組員類別
member_id:組員(聯絡人)ID,對應 ABPerson.ROWID
注意:UNIQUE(group_id, member_type, member_id)
4. ABMultiValue 儲存聯絡人的各種聯絡方式
UID:主鍵
record_id:聯絡人 ID,對應 ABPerson.ROWID
property:屬性值。3. 電話;4. email;待補充…
identifier:標識符。0、1、2、3、4,目前所知用於排序
label:標誌值。1. mobile;2. home;3. work;4. other;5. homepage(URL),對應 ABMultiValueLabel.value
value:值。例如一個手機號碼 13800138000,或一個 email 地址 foo@bar.com
5. ABMultiValueEntry(未知)
parent_id:(未知)
key:(未知)
value:(未知)
注意:UNIQUE(parent_id, key)
6. ABMultiValueEntryKey(未知)
value:(未知)
注意:UNIQUE(value)
7. ABMultiValueLabel 聯絡方式標誌值清單
value:見 ABMultiValue.label
8. ABPerson
ROWID 自增主鍵,也是聯絡人的唯一標識
First 名字
Last 姓
Middle(未定)
FirstPhonetic(未定,貌似留作語音撥號用)
MiddlePhonetic(未定,貌似留作語音撥號用)
LastPhonetic(未定,貌似留作語音撥號用)
Organization 所在公司、組織
Department 所在部門
Note 註釋
Kind 未定
Birthday 生日
JobTitle 頭銜
Nickname 暱稱
Prefix 前綴
Suffix 後綴
FirstSort 排序用(具體未知)
LastSort 排序用(具體未知)
CreationDate 建立時間
ModificationDate 最後修改時間
CompositeNameFallback(未知)
9. ABPersonChanges(未知)
record
type
10. ABPersonMultiValueDeletes(未知)
record_id
property_id
identifier
11. ABPhoneLastFour 電話號碼後四位比對表
multivalue_id 對應 ABMultiValue.UID
value 電話號碼後四位
12. ABRecent(未知)
date
name
property
value
13. sorting_first_section_list(未知)
character
number
14. sorting_last_section_list(未知)
character
number
15. sqlite_sequence(用於記錄序列)
name:表名,如 ABPerson
seq:最新序列號
— ========== 以下為建表語句 ==========
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 ABMultiValue
BEGIN
DELETE FROM ABPhoneLastFour WHERE multivalue_id = OLD.UID;
END;
CREATE TRIGGER sorting_first_prefix_trigger AFTER INSERT ON ABPerson
BEGIN
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 update_first_prefix_trigger AFTER UPDATE ON ABPerson
BEGIN
INSERT 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 ABPerson
BEGIN
INSERT 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 ABPerson
BEGIN
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 update_last_prefix_trigger AFTER UPDATE ON ABPerson
BEGIN
INSERT 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 ABPerson
BEGIN
INSERT 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 記事本資料庫
位置:/private/var/root/Library/Notes/notes.db
1. Note 摘要資訊記錄表
creation_date:建立時間
title:標題
summary:摘要
2. note_bodies 詳細資訊
note_id:note ID
data:記事內容,包含標題
— ========== 以下為建表語句 ==========
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 Note
BEGIN
DELETE FROM note_bodies WHERE note_id = OLD.ROWID;
END;
三、sms.db 短信資料庫
位置:/private/var/root/Library/SMS/sms.db
1. message 短信表
ROWID:自增主鍵
address:對方手機號碼(+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);
  1. 上一篇文章:
  2. 下一篇文章:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © IOS教程網 All Rights Reserved