NSString *dbPath = [self getDBPath];
NSFileManager *fileManager = [NSFileManager defaultManager];
FMDatabase *db = [FMDatabase databaseWithPath:dbPath];
if (![fileManager fileExistsAtPath:dbPath]) {
NSLog(@"还未创建数据库,现在正在创建数据库");
if (![db open]) {
[db open];
};
//创建表
[db executeUpdate:@"CREATE TABLE IF NOT EXISTS tb_shareholder (ID INTEGER PRIMARY KEY,companyId int(11) DEFAULT NULL,name varchar(64) DEFAULT NULL,investmentMode varchar(3) DEFAULT NULL,capitalContribution decimal(13,2) DEFAULT NULL,shareholding decimal(6,3) DEFAULT NULL,userId varchar(64) DEFAULT NULL,remarks varchar(255) DEFAULT NULL,companyName varchar(64) DEFAULT NULL,createDate datetime DEFAULT NULL,updateDate datetime DEFAULT NULL,isNewRecord varchar(3) DEFAULT NULL,isLocal varchar(10) DEFAULT '1')"];
[db commit];
[db close];
}
}