views:

17

answers:

0

my code is given below

NSMutableArray *arrayBookMark = nil;
sqlite3_stmt *selectStatement = nil;
NSString * strSql = [NSString stringWithFormat:@"SELECT bokmark_id,pdf_id,pdf_name,bookmark_name,pageno,imagedata,createddate from bookmarks"];
int returnValue = sqlite3_prepare_v2(database, [strSql UTF8String], -1, &selectStatement, NULL);
if(returnValue == SQLITE_OK){
    if(!arrayBookMark){
    arrayBookMark = [[NSMutableArray alloc] init];
    }
    else{
        [arrayBookMark removeAllObjects];
    }
    while(sqlite3_step(selectStatement)==SQLITE_ROW){           
        bookmarks *objBookMarks = [[[bookmarks alloc]init]autorelease];
        objBookMarks.intBookMarkId = sqlite3_column_int(selectStatement,0); 
        objBookMarks.intPdfId = sqlite3_column_int(selectStatement,1);
        objBookMarks.strPdfName = [NSString stringWithCString:(char  *)sqlite3_column_text_check(selectStatement, 2) encoding:NSUTF8StringEncoding];
        objBookMarks.strBookMarkName = [NSString stringWithCString:(char  *)sqlite3_column_text_check(selectStatement, 3) encoding:NSUTF8StringEncoding];
        objBookMarks.intPageNo = sqlite3_column_int(selectStatement,4);
        objBookMarks.imgPage = [UIImage imageWithData:[NSData dataWithBytes:sqlite3_column_blob(selectStatement,5) length:sqlite3_column_bytes(selectStatement, 5)]];
        objBookMarks.strDate = [NSString stringWithCString:(char  *)sqlite3_column_text_check(selectStatement,6) encoding:NSUTF8StringEncoding];
        [arrayBookMark addObject:objBookMarks];
        [objBookMarks release];
    }
}
sqlite3_finalize(selectStatement);
return arrayBookMark;

on click event I open the subview and reload data code is give below

[viewBookmark setHidden:NO];
    bookmarkArray = [appDelegate SelectBookMark];
    if([bookmarkArray count] < 1) { 
        [btnBookMarkEdit setEnabled:NO];
        [btnBrowse setEnabled:NO];

    }
    else {
        [btnBookMarkEdit setEnabled:YES];
        [btnBrowse setEnabled:YES];

    }
    [tblBookMark reloadData];

When I get data from bookmarkArray it is out of scope. please give me a hint.

Thanx in advanced