objective c - If Statement give error with sqlite statement in iOS -


i learning sqlite concept ios. @ learning stage got stuck with problem, problem is:

when put nslog after if statement give no error. see image:

enter image description here

but when remove nslog compiler give me error, see image:

enter image description here

why error come have not find yet. code are:

-(void)runquery:(const char *)query isqueryexecutable:(bool)queryexecutable{     sqlite3 *sqlite3database;     nsstring *databasepath= [self.documentsdirectory stringbyappendingpathcomponent:self.databasefilename];      if(self.arrresults != nil){         [self.arrresults removeallobjects];         self.arrresults= nil;     }     self.arrresults =[[nsmutablearray alloc] init];      if(self.arrcolumnnames != nil){         [self.arrcolumnnames removeallobjects];         self.arrcolumnnames= nil;     }     self.arrcolumnnames= [[nsmutablearray alloc] init];      bool opendatabaseresult= sqlite3_open([databasepath utf8string],&sqlite3database);      if(opendatabaseresult==sqlite_ok)          sqlite3_stmt *compiledstatement;          bool preparestatementresult = sqlite3_prepare_v2(sqlite3database,query,-1,&compiledstatement,null);   } 

i learning sqlite tutorial link: https://www.appcoda.com/sqlite-database-ios-app-tutorial/

thanks in advance.

your issue appears you've forgotten bracket @ end of if statement before line.

if(opendatabaseresult==sqlite_ok)  {     sqlite3_stmt *compiledstatement;      bool preparestatementresult = sqlite3_prepare_v2(sqlite3database,query,-1,&compiledstatement,null); } 

Comments