package com.cooloongwu.greendao.gen; 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 com.cooloongwu.coolchat.entity.Group; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table "GROUP". */ public class GroupDao extends AbstractDao<Group, Long> { public static final String TABLENAME = "GROUP"; /** * Properties of entity Group.<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 GroupId = new Property(1, int.class, "groupId", false, "GROUP_ID"); public final static Property GroupName = new Property(2, String.class, "groupName", false, "GROUP_NAME"); public final static Property GroupAvatar = new Property(3, String.class, "groupAvatar", false, "GROUP_AVATAR"); public final static Property CreateTime = new Property(4, String.class, "createTime", false, "CREATE_TIME"); } public GroupDao(DaoConfig config) { super(config); } public GroupDao(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 + "\"GROUP\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"GROUP_ID\" INTEGER NOT NULL ," + // 1: groupId "\"GROUP_NAME\" TEXT," + // 2: groupName "\"GROUP_AVATAR\" TEXT," + // 3: groupAvatar "\"CREATE_TIME\" TEXT);"); // 4: createTime } /** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GROUP\""; db.execSQL(sql); } @Override protected final void bindValues(DatabaseStatement stmt, Group entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindLong(2, entity.getGroupId()); String groupName = entity.getGroupName(); if (groupName != null) { stmt.bindString(3, groupName); } String groupAvatar = entity.getGroupAvatar(); if (groupAvatar != null) { stmt.bindString(4, groupAvatar); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(5, createTime); } } @Override protected final void bindValues(SQLiteStatement stmt, Group entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindLong(2, entity.getGroupId()); String groupName = entity.getGroupName(); if (groupName != null) { stmt.bindString(3, groupName); } String groupAvatar = entity.getGroupAvatar(); if (groupAvatar != null) { stmt.bindString(4, groupAvatar); } String createTime = entity.getCreateTime(); if (createTime != null) { stmt.bindString(5, createTime); } } @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } @Override public Group readEntity(Cursor cursor, int offset) { Group entity = new Group( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getInt(offset + 1), // groupId cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // groupName cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // groupAvatar cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // createTime ); return entity; } @Override public void readEntity(Cursor cursor, Group entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setGroupId(cursor.getInt(offset + 1)); entity.setGroupName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); entity.setGroupAvatar(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setCreateTime(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); } @Override protected final Long updateKeyAfterInsert(Group entity, long rowId) { entity.setId(rowId); return rowId; } @Override public Long getKey(Group entity) { if(entity != null) { return entity.getId(); } else { return null; } } @Override public boolean hasKey(Group entity) { return entity.getId() != null; } @Override protected final boolean isEntityUpdateable() { return true; } }