????????FMDB
???????????? ???????[ 2014/5/13 15:25:10 ] ???????????????? FMDB
???????
????SQLite (http://www.sqlite.org/docs.html) ????????????????????iOS SDK?????????SQLite?????????????????? libsqlite3.dylib ??????????? sqlite3.h ???????ɡ???????????SQLite API???????????????????????????????????????????г????????н?SQLite API???з???????FMDB (https://github.com/tryingx/fmdb-master) ???????????е????
????????? ????sqlite3?????
????????? ????FMDB?????
????????????????????
?????????????????????????????ú??
????????? ??????????????
1 NSString *docPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory?? NSUserDomainMask?? YES) objectAtIndex:0]; // ???document?????·??
2 /**
3 * ??????????????????????????????"" ???? NULL
4 *
5 * An empty string (@""). An empty database is created at a temporary location. This database is deleted with the FMDatabase connection is closed.
6 ??????????????(@"")??????????????????????????????????????
7 NULL. An in-memory database is created. This database will be destroyed with the FMDatabase connection is closed.
8 ??????и?????????????
9 */
10 NSString *dbPath = [docPath stringByAppendingPathComponent:@"student.sqlite"];
11 NSLog(@"%@"?? dbPath); // ????????
12 FMDatabase *dataBase = [FMDatabase databaseWithPath:dbPath];
13 [dataBase open];
14 // ?????ж????????????
15 if (![dataBase open]) {
16 NSLog(@"error");
17 }
|
????????? ??????Щ????????
???????ò?????
????1.?????????
????NSString *sql = @"CREATE TABLE student(_id Integer primary key?? name text?? password text?? email text)";
????BOOL isCreateTable = [dataBase executeStatements:sql];
????NSLog(@"%d"?? isCreateTable );
????2.????????
????NSString *sqlInsert = @"INSERT INTO student (name?? password?? email) values ('????'?? '1232'?? '3343243')";
????BOOL isInsertOK = [dataBase executeStatements:sqlInsert];
????NSLog(@"%d"?? isInsertOK );
??????
???·???
??????????????????
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