title: Selecting all columns in sqLite table and storing it in a (mutable) array - and return array to caller
body: <p>I have searched for a solution for several days now and unfortunately could not find any relevant information which suits the needs of my app.  </p>
  
  <p><strong>What I'm trying to do is:</strong><br>
  call an sqLite query method<br>
  method queries sqLite table (selects all columns)<br>
  saves selected rows and columns in an array<br>
  array must return to caller<br>
  UITableView must show the returned values  </p>
  
  <p>My code:  </p>
  
  <p>FirstViewController.m:  </p>
  
  <pre><code>result = [queryObject myQueryMethod]; //result is of type NSMutableArray  
  </code></pre>
  
  <p>Query.m:  </p>
  
  <pre><code>NSString *myUsername;  
  NSString *from;  
  NSString *to;  
  NSString *message;  
  
  querySQL = [NSString stringWithFormat:@"SELECT * FROM messages WHERE to = '%@'" , myUsername];  
  query_stmt = [querySQL UTF8String];  
  
  NSMutableArray *allMessages = [[NSMutableArray alloc] init];  
  if(sqlite3_prepare_v2(_userDB, query_stmt, -1, &amp;statement, NULL) == SQLITE_OK ) {  
  
          while (sqlite3_step(statement) == SQLITE_ROW) {  
              from = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];  
              to = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 2)];  
              message = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 3)];  
              [allMessages addObject:message];  //MY PROBLEM..
          }
  
          return allMessages; //return to caller in FirstViewController.m
  
      }  
  </code></pre>
  
  <p><strong>My problem is:</strong> how can I add all columns (three) to an array, and return the array to caller inside FirstViewController.m in order to sort through the indexes for UITableView?<br>
  To display info in the tableview, I use:  </p>
  
  <pre><code>cell.textLabel.text = [result objectAtIndex:indexPath.row];  
  </code></pre>
  
  <p>I would appreciate any help I can get, thanks!</p>