| | |
| | | * Can be used for QueryBuilder and for referencing column names. |
| | | */ |
| | | public static class Properties { |
| | | public final static Property Id = new Property(0, long.class, "id", true, "_id"); |
| | | public final static Property Id = new Property(0, Long.class, "id", true, "_id"); |
| | | public final static Property SceneTypeId = new Property(1, int.class, "sceneTypeId", false, "SCENE_TYPE_ID"); |
| | | public final static Property TypeId = new Property(2, int.class, "typeId", false, "TYPE_ID"); |
| | | public final static Property TypeName = new Property(3, String.class, "typeName", false, "TYPE_NAME"); |
| | |
| | | public static void createTable(Database db, boolean ifNotExists) { |
| | | String constraint = ifNotExists? "IF NOT EXISTS ": ""; |
| | | db.execSQL("CREATE TABLE " + constraint + "\"MEDIA_TYPE_ALIAS\" (" + // |
| | | "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL ," + // 0: id |
| | | "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id |
| | | "\"SCENE_TYPE_ID\" INTEGER NOT NULL ," + // 1: sceneTypeId |
| | | "\"TYPE_ID\" INTEGER NOT NULL ," + // 2: typeId |
| | | "\"TYPE_NAME\" TEXT," + // 3: typeName |
| | |
| | | @Override |
| | | protected final void bindValues(DatabaseStatement stmt, MediaTypeAlias entity) { |
| | | stmt.clearBindings(); |
| | | stmt.bindLong(1, entity.getId()); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindLong(2, entity.getSceneTypeId()); |
| | | stmt.bindLong(3, entity.getTypeId()); |
| | | |
| | |
| | | @Override |
| | | protected final void bindValues(SQLiteStatement stmt, MediaTypeAlias entity) { |
| | | stmt.clearBindings(); |
| | | stmt.bindLong(1, entity.getId()); |
| | | |
| | | Long id = entity.getId(); |
| | | if (id != null) { |
| | | stmt.bindLong(1, id); |
| | | } |
| | | stmt.bindLong(2, entity.getSceneTypeId()); |
| | | stmt.bindLong(3, entity.getTypeId()); |
| | | |
| | |
| | | |
| | | @Override |
| | | public Long readKey(Cursor cursor, int offset) { |
| | | return cursor.getLong(offset + 0); |
| | | return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); |
| | | } |
| | | |
| | | @Override |
| | | public MediaTypeAlias readEntity(Cursor cursor, int offset) { |
| | | MediaTypeAlias entity = new MediaTypeAlias( // |
| | | cursor.getLong(offset + 0), // id |
| | | cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id |
| | | cursor.getInt(offset + 1), // sceneTypeId |
| | | cursor.getInt(offset + 2), // typeId |
| | | cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // typeName |
| | |
| | | |
| | | @Override |
| | | public void readEntity(Cursor cursor, MediaTypeAlias entity, int offset) { |
| | | entity.setId(cursor.getLong(offset + 0)); |
| | | entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); |
| | | entity.setSceneTypeId(cursor.getInt(offset + 1)); |
| | | entity.setTypeId(cursor.getInt(offset + 2)); |
| | | entity.setTypeName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); |
| | |
| | | |
| | | @Override |
| | | public boolean hasKey(MediaTypeAlias entity) { |
| | | throw new UnsupportedOperationException("Unsupported for entities with a non-null key"); |
| | | return entity.getId() != null; |
| | | } |
| | | |
| | | @Override |