我读了几次,当使用 FMDB 时架构发生变化时,我需要打开和关闭与数据库的连接。但是,以下工作正常:
FMDatabase *derp = [self getDefaultDatabase]; // custom function that returns open db
[derp executeUpdate:@"create table `derping` (`id` int, `time_stamp` datetime, primary key (id))"];
[derp executeUpdate:@"INSERT INTO derping (id) VALUES (123)"];
FMResultSet *derping = [derp executeQuery:@"select * from derping"];
[derping next];
NSLog(@"%@", [derping resultDictionary]);
这很危险吗?是否存在会失败的情况?