package com.mgw.member; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteStatement; import de.greenrobot.dao.AbstractDao; import de.greenrobot.dao.Property; import de.greenrobot.dao.internal.DaoConfig; import com.mgw.member.TopUser; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table TOP_USER. */ public class TopUserDao extends AbstractDao<TopUser, Long> { public static final String TABLENAME = "TOP_USER"; /** * Properties of entity TopUser.<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 JoinTime = new Property(1, String.class, "joinTime", false, "JOIN_TIME"); public final static Property UserName = new Property(2, String.class, "userName", false, "USER_NAME"); public final static Property IsGroup = new Property(3, Integer.class, "isGroup", false, "IS_GROUP"); }; public TopUserDao(DaoConfig config) { super(config); } public TopUserDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession); } /** Creates the underlying database table. */ public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "'TOP_USER' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'JOIN_TIME' TEXT NOT NULL ," + // 1: joinTime "'USER_NAME' TEXT NOT NULL ," + // 2: userName "'IS_GROUP' INTEGER);"); // 3: isGroup } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'TOP_USER'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, TopUser entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getJoinTime()); stmt.bindString(3, entity.getUserName()); Integer isGroup = entity.getIsGroup(); if (isGroup != null) { stmt.bindLong(4, isGroup); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public TopUser readEntity(Cursor cursor, int offset) { TopUser entity = new TopUser( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // joinTime cursor.getString(offset + 2), // userName cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3) // isGroup ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, TopUser entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setJoinTime(cursor.getString(offset + 1)); entity.setUserName(cursor.getString(offset + 2)); entity.setIsGroup(cursor.isNull(offset + 3) ? null : cursor.getInt(offset + 3)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(TopUser entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(TopUser entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }