123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- package com.sunzee.db;
- import android.database.Cursor;
- import android.database.sqlite.SQLiteStatement;
- import com.sunzee.model.domain.WarringBean;
- 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 "WARRING_BEAN".
- */
- public class WarringBeanDao extends AbstractDao<WarringBean, Long> {
- public static final String TABLENAME = "WARRING_BEAN";
- /**
- * Properties of entity WarringBean.<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, long.class, "time", false, "TIME");
- public final static Property ThingError = new Property(2, String.class, "thingError", false, "ERROR");
- public final static Property Remark = new Property(3, String.class, "remark", false, "REMARK");
- }
- public WarringBeanDao(DaoConfig config) {
- super(config);
- }
-
- public WarringBeanDao(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 + "\"WARRING_BEAN\" (" + //
- "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
- "\"TIME\" INTEGER NOT NULL ," + // 1: time
- "\"ERROR\" TEXT," + // 2: thingError
- "\"REMARK\" TEXT);"); // 3: remark
- }
- /** Drops the underlying database table. */
- public static void dropTable(Database db, boolean ifExists) {
- String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"WARRING_BEAN\"";
- db.execSQL(sql);
- }
- @Override
- protected final void bindValues(DatabaseStatement stmt, WarringBean entity) {
- stmt.clearBindings();
-
- Long id = entity.getId();
- if (id != null) {
- stmt.bindLong(1, id);
- }
- stmt.bindLong(2, entity.getTime());
-
- String thingError = entity.getThingError();
- if (thingError != null) {
- stmt.bindString(3, thingError);
- }
-
- String remark = entity.getRemark();
- if (remark != null) {
- stmt.bindString(4, remark);
- }
- }
- @Override
- protected final void bindValues(SQLiteStatement stmt, WarringBean entity) {
- stmt.clearBindings();
-
- Long id = entity.getId();
- if (id != null) {
- stmt.bindLong(1, id);
- }
- stmt.bindLong(2, entity.getTime());
-
- String thingError = entity.getThingError();
- if (thingError != null) {
- stmt.bindString(3, thingError);
- }
-
- String remark = entity.getRemark();
- if (remark != null) {
- stmt.bindString(4, remark);
- }
- }
- @Override
- public Long readKey(Cursor cursor, int offset) {
- return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
- }
- @Override
- public WarringBean readEntity(Cursor cursor, int offset) {
- WarringBean entity = new WarringBean( //
- cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
- cursor.getLong(offset + 1), // time
- cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // thingError
- cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // remark
- );
- return entity;
- }
-
- @Override
- public void readEntity(Cursor cursor, WarringBean entity, int offset) {
- entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
- entity.setTime(cursor.getLong(offset + 1));
- entity.setThingError(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
- entity.setRemark(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
- }
-
- @Override
- protected final Long updateKeyAfterInsert(WarringBean entity, long rowId) {
- entity.setId(rowId);
- return rowId;
- }
-
- @Override
- public Long getKey(WarringBean entity) {
- if(entity != null) {
- return entity.getId();
- } else {
- return null;
- }
- }
- @Override
- public boolean hasKey(WarringBean entity) {
- return entity.getId() != null;
- }
- @Override
- protected final boolean isEntityUpdateable() {
- return true;
- }
-
- }
|