title: FMDB Result set ruturning nil
body: <p>So here is the deal, I am using FMDB SQLite Wrapper for my DB app. I know Cord Data is there but My database is really really huge and all I want to do is read it. No new records are going to be inserted / updated via iOS app. At one point in this app I am trying to pull records from DB which are name of player and thier Id based on searchTerm and searchPosition. searchTerm works perfectly fine. searchPosition query works in sqlite3 but not in iOS app. I don know where I am going wrong. Help me out. Code for both methods are as follows:</p>
  
  <pre><code>-(IBAction)searchTerm
  {
  searchTermValue=self.term.text;
  self.fmdbUtils = [[[FMDBUtils alloc] initWithDatabase:@"Colts.sql"] autorelease];
  FMDatabase *db = [self.fmdbUtils sharedDB];
  FMResultSet *rs = nil;
  NSString *AgentId = nil;
  NSString *PlayerName = nil;
  NSString *PlayerId = nil;
  ScoutAppDelegate *appDelegate = (ScoutAppDelegate *)[[UIApplication sharedApplication] delegate];
  appDelegate.playerList = [[NSMutableArray alloc] init];
  
  NSString * query = @"SELECT * FROM Player WHERE LENGTH (lastname)&gt;0 AND LENGTH (firstname)&gt;0 AND ( lastname LIKE '%' || ? || '%' OR firstname LIKE'%' || ? || '%' OR Height LIKE '%' || ? || '%' OR Weight LIKE '%' || ? || '%') ORDER BY lastname,firstname";
  rs = [db executeQuery:query,searchTermValue,searchTermValue,searchTermValue,searchTermValue];
  [query release];
  
  while([rs next]) 
  {
      PlayerId = [rs stringForColumn:@"player_id"];
      //NSString *PlayerName = [rs stringForColumn:@"Player Name"];
      if ([rs stringForColumn:@"Player Name"]!= NULL) 
      {
          PlayerName = [rs stringForColumn:@"Player Name"];
      }
      else
          PlayerName=@"";
      if ([rs stringForColumn:@"agent_id"]!= NULL) 
      {
          AgentId = [rs stringForColumn:@"agent_id"];
      }
      else
          AgentId=@"0";
  
      Player *temp =[[Player alloc]initPlayerID:PlayerId Name:PlayerName Agent:AgentId];
      [appDelegate.playerList addObject:temp];
      [temp release];
  }
  [rs close];
  [db close];
  
  
  PlayersListTableViewController *temp=[[PlayersListTableViewController alloc]initWithNibName:@"PlayersListTableViewController" bundle:nil];
  temp.title=@"Players";
  self.playersListTableViewCtrl=temp;
  [temp release];
  
  [self.navigationController pushViewController:playersListTableViewCtrl animated:YES];
  }
  </code></pre>
  
  <p>Here is theIBAction used to search players based on their playing position.</p>
  
  <pre><code>-(IBAction)SearchPosition
  {
  searchTermValue= searchPositionValue;
  self.fmdbUtils = [[[FMDBUtils alloc] initWithDatabase:@"Colts.sql"] autorelease];
  FMDatabase *db = [self.fmdbUtils sharedDB];
  FMResultSet *rs =  nil;
  NSString *AgentId = nil;
  NSString *PlayerName = nil;
  NSString *PlayerId = nil;
  ScoutAppDelegate *appDelegate = (ScoutAppDelegate *)[[UIApplication sharedApplication] delegate];
  //appDelegate.playerList = [[NSMutableArray alloc] init];
  
  NSString * query = @"SELECT * FROM Player WHERE LENGTH (lastname)&gt;0 AND LENGTH (firstname)&gt;0 AND ( College_Position LIKE '%' || ? || '%' OR Pro_Position LIKE'%' || ? || '%') ORDER BY lastname,firstname";
  rs = [db executeQuery:query,searchPositionValue,searchPositionValue];
  [query release];
  
  while([rs next]) 
  {
      PlayerId = [rs stringForColumn:@"player_id"];
      //NSString *PlayerName = [rs stringForColumn:@"Player Name"];
      if ([rs stringForColumn:@"Player Name"]!= NULL) 
      {
          PlayerName = [rs stringForColumn:@"Player Name"];
      }
      else
          PlayerName=@"";
      if ([rs stringForColumn:@"agent_id"]!= NULL) 
      {
          AgentId = [rs stringForColumn:@"agent_id"];
      }
      else
          AgentId=@"0";
  
      Player *temp =[[Player alloc]initPlayerID:PlayerId Name:PlayerName Agent:AgentId];
      [appDelegate.playerList addObject:temp];
      [temp release];
  }
  [rs close];
  [db close];
  
  PlayersListTableViewController *temp=[[PlayersListTableViewController alloc]initWithNibName:@"PlayersListTableViewController" bundle:nil];
  temp.title=@"Players";
  self.playersListTableViewCtrl=temp;
  [temp release];
  
  [self.navigationController pushViewController:playersListTableViewCtrl animated:YES];
  }
  </code></pre>
  
  <p>This method just gives selected playing position for search in pickerview.</p>
  
  <pre><code>- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
  self.searchPositionValue = [playingPositions objectAtIndex: row];
  }
  </code></pre>