Unable to retrieve data from SQLite database iOS6.0

Posted by kunalg on Stack Overflow See other posts from Stack Overflow or by kunalg
Published on 2012-09-29T07:29:04Z Indexed on 2012/09/29 9:37 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

When i run build ios5.0 or less then Sqlite response correct and retrieve data its work fine but when run on ios6.0 i am trying to fetch data from my.sqlite database but it is not executing my if case. It always enters in else condition. What wrong thing i am doing? I am not able to execute my if case i.e. if(sqlite3_prepare_v2(database, sqlQuerry, -1, &querryStatement, NULL)==SQLITE_OK).

for reference check this code .

NSLog(@"sqlite3_prepare_v2 = %d SQLITE_OK %d ",sqlite3_prepare_v2(sqlite, [strQuery UTF8String], -1, &compiledStatement, nil),SQLITE_OK);

    if(sqlite3_prepare_v2(sqlite, [strQuery UTF8String], -1, &compiledStatement, nil)==SQLITE_OK)
    {

        NSLog(@"sqlite3_step = %d SQLITE_ROW %d ",sqlite3_step(compiledStatement),SQLITE_ROW);
        while (sqlite3_step(compiledStatement)==SQLITE_ROW)
        {           if(sqlite3_column_text(compiledStatement, 2) != nil)
                modelObj.Name = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];

        }
    }

else {

}

////////// in ios6.0
log Print
sqlite3_prepare_v2 = 1 SQLITE_OK 0
sqlite3_step = 21 SQLITE_ROW 100

in iOS5.0 log Print
sqlite3_prepare_v2 = 0 SQLITE_OK 0
sqlite3_step = 100 SQLITE_ROW 100

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c