title: how to iterate through all the columns in sqlite using fmdb in objective-c
body: <p>I need to do a search on all the columns, so instead of specifying each column name in the where clause I would like to create a method that can search through all the columns.</p>
  
  <pre><code>-(void) fillSomeobjectNames:(NSString *)filter
  {
      FMDatabase *db = [FMDatabase databaseWithPath:databasePath];
  
      [db open];
  
      NSString *sql = [NSString stringWithFormat:@"SELECT id, name, imagefile FROM %@ %@", mainTableName, filter];
      FMResultSet *results = [db executeQuery:sql];
      while([results next]) 
      {
          Someobject *someobject = [[Someobject alloc] init];
          [someobject setID:[results intForColumn:@"id"]];
          [someobject setName:[results stringForColumn:@"name"]];
          NSString *iconName = [[results stringForColumn:@"imagefile"] stringByReplacingOccurrencesOfString:@".jpg" withString:@""];
          [someobject setIconPath:[NSString stringWithFormat:@"%@-ico.jpg",iconName]];
          [someobjects someobject];
      }
  
      [db close];
  }
  </code></pre>
  
  <p>'filter' can be 'WHERE remark=[searchText] AND description=[searchText] AND so on...'</p>