title: Query statement is not executing of sqlite database in xcode
body: <p>I am using sqlite database mathFActs in my project which i create through Sqlite Database Browser and add it to Xcode. following is my code from a view controller class</p>
  
  <pre><code>- (void)viewDidLoad
  {   [super viewDidLoad];
  
      [self copyDatabaseIfNeeded];
      [self getInitialDataToDisplay:[self getDBPath]];
  }
  
  
  - (void) copyDatabaseIfNeeded {
      //Using NSFileManager we can perform many file system operations.
      NSFileManager *fileManager = [NSFileManager defaultManager];
      NSError *error;
  
      NSString *dbPth = [self getDBPath];
      BOOL success = [fileManager fileExistsAtPath:dbPth];
  
      if(!success) {
  
          NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"mathFActs"];
          success = [fileManager copyItemAtPath:defaultDBPath toPath:dbPath error:&amp;error];
  
          if (!success)
              NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
      }
  }
  - (NSString *) getDBPath {
  
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory , NSUserDomainMask, YES);
      NSString *documentsDir = [paths objectAtIndex:0];
      return [documentsDir stringByAppendingPathComponent:@"mathFActs"];
  
  }
  
  -(void) getInitialDataToDisplay:(NSString *)databasePath{
  
      if (sqlite3_open([databasePath UTF8String], &amp;database) == SQLITE_OK) {
        NSLog(@"open");
      const char *sql = "select Question  from math ";
          sqlite3_stmt *selectstmt;
          if(sqlite3_prepare_v2(database, sql, -1, &amp;selectstmt, NULL) == SQLITE_OK) {
              NSLog(@"prepare");
              while(sqlite3_step(selectstmt) == SQLITE_ROW) {
  
                  NSString *addressField = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(selectstmt, 0)];
                  //address.text = addressField;
  
                  qstn.text=addressField;         
                 sqlite3_finalize(selectstmt); 
  
              }}
          else
              sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.
      }
  
  }
  </code></pre>
  
  <p>when i run the project it print open but not prepare means it's not executing query statement .. plz help  me  to solve my problem </p>