title: sqlite query with multiple condition giving error : library routine called out of sequence
body: <p>I am creating an app and using sqlite 3 for storing data.
  Here is my code I am executing to fetch data</p>
  
  <pre><code>sqlite3_stmt *statement; 
  NSString *querySQL = [NSString stringWithFormat: @"SELECT ID, HolderName, AccountNumber, BankName, Location FROM Accounts WHERE UserID='%@'",userID];
  
  if(![name isEqualToString:@""]) 
  {
      querySQL = [NSString stringWithFormat: @"SELECT ID, HolderName, AccountNumber, BankName, Location FROM Accounts WHERE UserID='%@' and HolderName='%@'",userID, name];
  }
  const char *query_stmt = [querySQL UTF8String]; 
  
  if (sqlite3_prepare_v2(db, query_stmt, -1, &amp;statement, NULL) == SQLITE_OK)
  {
      while(sqlite3_step(statement) == SQLITE_ROW)
      {
          ....
      }
  }
  </code></pre>
  
  <p>What is happening here, if name is empty then query(only with one condition in where clause) runs properly and fetches proper data but its giving error : library routine called out of sequence if name is not empty and query contains two conditions in where clause.
  I am not sure what is wrong with it, I have searched a lot but found that query runs perfect with multiple conditions.
  Please suggest me what should I do here.</p>