jeudi 1 septembre 2016

If Statement give error with sqlite statement in iOS

I am learning the sqlite concept with iOS. At the learning stage I got stuck with with a problem, The problem is:

When i put NSLog after if statement it give no error. See the image:

enter image description here

But when I remove NSLog the compiler give me error, see the image:

enter image description here

Why this error come I have not find yet. My 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 am learning the sqlite tutorial from this link: http://ift.tt/2cdZ1rl

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire