i read few times need open , close connection database when schema changes when using fmdb. however, following works fine:
fmdatabase *derp = [self getdefaultdatabase]; // custom function returns open db [derp executeupdate:@"create table `derping` (`id` int, `time_stamp` datetime, primary key (id))"]; [derp executeupdate:@"insert derping (id) values (123)"]; fmresultset *derping = [derp executequery:@"select * derping"]; [derping next]; nslog(@"%@", [derping resultdictionary]);
is dangerous? there situations fail?
i think you're doing should ok - if alter table, better sure close , re-open database handle.
Comments
Post a Comment