ios - SQLite Database Hangs Upon Update -
i've been grinding on problem couple hours , grateful outside input. new ios, objective-c , sqlite , trying execute sqlite update statement. issue ui freezes , seems hang in process within sqlite.
here's code:
nsstring *docspath = [paths objectatindex:0]; nsstring *path = [docspath stringbyappendingpathcomponent:@"sqlite3database.sqlite"]; sqlite3_instance *db = [sqlite3_instance databasewithpath:path]; [db open]; nsstring *execupdate = [nsstring stringwithformat:@"update listitem set status=%i,message=\"%@\",gpslong=%@, gpslat=%@,lastupdated=datetime('now') userid = %@",[status_picker selectedrowincomponent:0],messagetextfield.text , longitude, latitude,loggedinuserid]; nslog(@"execupdate: %@", execupdate); if (![db executeupdate:execupdate]) nslog(@"data insert failed %@", db.lasterrormessage);
this code executed in ibaction after clicking uibutton, mentioned, ui hung in process. output above code following:
*execupdate: update listitem set status=0,message="",gpslong=44.48916, gpslat=6.28739,lastupdated=datetime('now') userid = 1*
can see how code hung up?
looks issue xcode memory leak. after hours of pounding head agains wall, closing , starting again fixed issue.
are sure process/thread didn't have transaction open against database? cause behavior.
Comments
Post a Comment