@Test public void doesColumnExistTest() { String tableName = "testTable"; SQLiteDatabase db = Collect.getInstance().openOrCreateDatabase("testDatabase", MODE_PRIVATE, null); db.execSQL("CREATE TABLE " + tableName + " (id integer, column1 text);"); assertTrue(SQLiteUtils.doesColumnExist(db, tableName, "id")); assertTrue(SQLiteUtils.doesColumnExist(db, tableName, "column1")); assertFalse(SQLiteUtils.doesColumnExist(db, tableName, "column2")); }
public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); }
SQLiteUtils { public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); } }
SQLiteUtils { public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); } private  SQLiteUtils(); }
SQLiteUtils { public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); } private  SQLiteUtils(); static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName); static List<String> getColumnNames(SQLiteDatabase db, String tableName); }
SQLiteUtils { public static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName) { return getColumnNames(db, tableName).contains(columnName); } private  SQLiteUtils(); static boolean doesColumnExist(SQLiteDatabase db, String tableName, String columnName); static List<String> getColumnNames(SQLiteDatabase db, String tableName);  }