融云之sealtalk数据库

数据库名称位置

沙盒下边的Documents下,有些以RongIMDemoDB开头的文件。命名方式是RongIMDemoDB+userid

NSString *dbPath = [documentDirectory
                    stringByAppendingPathComponent:
                    [NSString stringWithFormat:@"RongIMDemoDB%@",
                     [RCIMClient sharedRCIMClient]
                     .currentUserInfo.userId]];

数据库表

共5个表,分别是BLACKTABLE,GROUPMEMBERTABLE,USERTABLE,FRIENDSTABLE,GROUPTABLEV2

sqlite> .tables
BLACKTABLE        GROUPMEMBERTABLE  USERTABLE       
FRIENDSTABLE      GROUPTABLEV2  

表结构

BLACKTABLE

sqlite> .schema BLACKTABLE
CREATE TABLE BLACKTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text);
CREATE UNIQUE INDEX idx_blackId ON BLACKTABLE(userid);

GROUPMEMBERTABLE

sqlite> .schema GROUPMEMBERTABLE
CREATE TABLE GROUPMEMBERTABLE (id integer PRIMARY KEY autoincrement, groupid text, userid text,name text, portraitUri text);
CREATE UNIQUE INDEX idx_groupmemberId ON GROUPMEMBERTABLE(groupid,userid);

USERTABLE

对应RongIMLibRCUserInfo

sqlite> .schema USERTABLE
CREATE TABLE USERTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text);
CREATE UNIQUE INDEX idx_userid ON USERTABLE(userid);

FRIENDSTABLE

对应RCloundMessageRCDUserInfo

sqlite> .schema FRIENDSTABLE
CREATE TABLE FRIENDSTABLE (id integer PRIMARY KEY autoincrement, userid text,name text, portraitUri text, status text, updatedAt text, displayName text);
CREATE UNIQUE INDEX idx_friendsId ON FRIENDSTABLE(userid);

GROUPTABLEV2

对应RCloundMessageRCDGroupInfo

sqlite> .schema GROUPTABLEV2
CREATE TABLE GROUPTABLEV2 (id integer PRIMARY KEY autoincrement, groupId text,name text, portraitUri text,inNumber text,maxNumber text ,introduce text ,creatorId text,creatorTime text, isJoin text, isDismiss text);
CREATE UNIQUE INDEX idx_groupid ON GROUPTABLEV2(groupId);

数据库操作

RCDataBaseManager类用来操作数据库

使用queue

_dbQueue = [FMDatabaseQueue databaseQueueWithPath:dbPath];

插入操作是替换

insertUserToDB使用的命令是REPLACE
insertGroupMemberToDB使用先deleteREPLACE

你可能感兴趣的:(融云之sealtalk数据库)