Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 0.81 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android - SQLite Cursor getColumnIndex() is case sensitive?
  2. Column Name in DB was: Rules
  3. cursor.getColumnIndex("Rules")  //workes fine
  4. cursor.getColumnIndex("rules")  //throws error, see the error detail
  5.        
  6. // write table name
  7. public static final String TABLE_MESSAGE = "messages";
  8. // and column name accordingly
  9. public static final String COLUMN_ID = "_id";
  10. public static final String COLUMN_MESSAGE = "message";
  11.        
  12. // TABLE creation sql statement
  13. private static final String TABLE_CREATE = "create table "
  14.             + TABLE_MESSAGE + "( " + COLUMN_ID
  15.             + " integer primary key autoincrement, " + COLUMN_MESSAGE
  16.             + " text not null);";
  17.        
  18. database.query(TABLE_MESSAGE, new String[]{COLUMN_ID,COLUMN_MESSAGE}, null, null, null, null, null);
  19.        
  20. int index = cursor.getColumnIndex(COLUMN_MESSAGE);