- 首页 > it技术 > >
#define PATH_OF_DOCUMENT[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]- (instancetype)init {
if (self = [super init]) {_feedDBPath = [PATH_OF_DOCUMENT stringByAppendingPathComponent:@"feeds.sqlite"];
if ([[NSFileManager defaultManager] fileExistsAtPath:_feedDBPath] == NO) {
FMDatabase *db = [FMDatabase databaseWithPath:_feedDBPath];
if ([db open]) {
/*
unread:未读数
updatetime:最后更新时间用来排序
ishide:是否隐藏,0表示显示,1表示不显示
*/
NSString *createSql = @"create table feeds (fid INTEGER PRIMARY KEY AUTOINCREMENTNOT NULL, title text, link text, des text, copyright text, generator text, imageurl text, feedurl text, unread integer, updatetime integer, ishide integer)";
[db executeUpdate:createSql];
/*
des:正文内容
isread:是否点开查看过,0表示没看过,1表示看过
isCached:是否缓存了内容
thumbnails:图片集,各个图片地址使用|作为分隔符
*/
NSString *createItemSql = @"create table feeditem (iid INTEGER PRIMARY KEY AUTOINCREMENTNOT NULL, fid integer, link text, title text, author text, category text, pubdate text, des blob, isread integer, iscached integer, thumbnails text)";
[db executeUpdate:createItemSql];
}
}}
return self;
}
推荐阅读