package com.casic.endoscope.greendao; import android.database.Cursor; import android.database.sqlite.SQLiteStatement; import com.casic.endoscope.bean.GasValueBean; import org.greenrobot.greendao.AbstractDao; import org.greenrobot.greendao.Property; import org.greenrobot.greendao.database.Database; import org.greenrobot.greendao.database.DatabaseStatement; import org.greenrobot.greendao.internal.DaoConfig; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "GAS_VALUE_BEAN". */ public class GasValueBeanDao extends AbstractDao<GasValueBean, Long> { public static final String TABLENAME = "GAS_VALUE_BEAN"; /** * Properties of entity GasValueBean.<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 Time = new Property(1, String.class, "time", false, "TIME"); public final static Property Value = new Property(2, int.class, "value", false, "VALUE"); public final static Property Location = new Property(3, String.class, "location", false, "LOCATION"); } public GasValueBeanDao(DaoConfig config) { super(config); } public GasValueBeanDao(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 + "\"GAS_VALUE_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"TIME\" TEXT," + // 1: time "\"VALUE\" INTEGER NOT NULL ," + // 2: value "\"LOCATION\" TEXT);"); // 3: location } /** * Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GAS_VALUE_BEAN\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, GasValueBean entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); } } @Override protected final void bindValues(SQLiteStatement stmt, GasValueBean entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String time = entity.getTime(); if (time != null) { stmt.bindString(2, time); } stmt.bindLong(3, entity.getValue()); String location = entity.getLocation(); if (location != null) { stmt.bindString(4, location); } } @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } @Override public GasValueBean readEntity(Cursor cursor, int offset) { GasValueBean entity = new GasValueBean( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // time cursor.getInt(offset + 2), // value cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // location ); return entity; } @Override public void readEntity(Cursor cursor, GasValueBean entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setTime(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setValue(cursor.getInt(offset + 2)); entity.setLocation(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); } @Override protected final Long updateKeyAfterInsert(GasValueBean entity, long rowId) { entity.setId(rowId); return rowId; } @Override public Long getKey(GasValueBean entity) { if (entity != null) { return entity.getId(); } else { return null; } } @Override public boolean hasKey(GasValueBean entity) { return entity.getId() != null; } @Override protected final boolean isEntityUpdateable() { return true; } }