IOS???????????????
???????????? ???????[ 2014/2/18 11:16:41 ] ???????????? ???????
??????????:????????FMDB????????????
/**
* ???????????
*/
- (void)createDatabaseIfNeeded
{
// ?????·??
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory?? NSUserDomainMask?? YES);
NSString *doc = [paths objectAtIndex:0];
NSString *path = [doc stringByAppendingPathComponent:@"test.sqlite"];
NSFileManager * fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:path] == NO) {
// create it
FMDatabase * db = [FMDatabase databaseWithPath:path];
if ([db open]) {
// ????User??
NSMutableString *sql = [NSMutableString stringWithFormat:@"%@"??@"CREATE TABLE User"];
[sql appendString:@"("];
[sql appendString:@"username varchar??"];
[sql appendString:@"password varchar"];
[sql appendString:@")"];
BOOL res = [db executeUpdate:sql];
if (!res) {
debugLog(@"error when creating table User");
} else {
debugLog(@"succ to creating table User");
}
[db close];
}
else {
debugLog(@"error when open db");
}
}
}
|
?????:FMDB????y??http://blog.devtang.com/blog/2012/04/22/use-fmdb/
???????????
????1?????????????????????????????????(??????????)????????????????????????
????2????????????????ж????????????????????????????/??????????????????????£??????°汾?????????????????????????汾?п??????°汾??(?ο?:http://blog.csdn.net/zyx586/article/details/18989199)????????°汾??????????????????κθ???????????μ?汾???????????????????????????????????????????e汾?????????′????????μ?????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11