package org.literacyapp.contentprovider.dao; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.internal.DaoConfig; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; import org.literacyapp.contentprovider.model.content.multimedia.JoinAudiosWithNumbers; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "JOIN_AUDIOS_WITH_NUMBERS". */ public class JoinAudiosWithNumbersDao extends AbstractDao<JoinAudiosWithNumbers, Long> { public static final String TABLENAME = "JOIN_AUDIOS_WITH_NUMBERS"; /** * Properties of entity JoinAudiosWithNumbers.<br/> * 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 AudioId = new Property(1, long.class, "audioId", false, "AUDIO_ID"); public final static Property NumberId = new Property(2, long.class, "numberId", false, "NUMBER_ID"); } public JoinAudiosWithNumbersDao(DaoConfig config) { super(config); } public JoinAudiosWithNumbersDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"JOIN_AUDIOS_WITH_NUMBERS\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"AUDIO_ID\" INTEGER NOT NULL ," + // 1: audioId "\"NUMBER_ID\" INTEGER NOT NULL );"); // 2: numberId } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"JOIN_AUDIOS_WITH_NUMBERS\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, JoinAudiosWithNumbers entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindLong(2, entity.getAudioId()); stmt.bindLong(3, entity.getNumberId()); } @Override protected final void bindValues(SQLiteStatement stmt, JoinAudiosWithNumbers entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindLong(2, entity.getAudioId()); stmt.bindLong(3, entity.getNumberId()); } @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } @Override public JoinAudiosWithNumbers readEntity(Cursor cursor, int offset) { JoinAudiosWithNumbers entity = new JoinAudiosWithNumbers( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getLong(offset + 1), // audioId cursor.getLong(offset + 2) // numberId ); return entity; } @Override public void readEntity(Cursor cursor, JoinAudiosWithNumbers entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setAudioId(cursor.getLong(offset + 1)); entity.setNumberId(cursor.getLong(offset + 2)); } @Override protected final Long updateKeyAfterInsert(JoinAudiosWithNumbers entity, long rowId) { entity.setId(rowId); return rowId; } @Override public Long getKey(JoinAudiosWithNumbers entity) { if(entity != null) { return entity.getId(); } else { return null; } } @Override public boolean hasKey(JoinAudiosWithNumbers entity) { return entity.getId() != null; } @Override protected final boolean isEntityUpdateable() { return true; } }