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.RememberLoginName;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table REMEMBER_LOGIN_NAME.
*/
public class RememberLoginNameDao extends AbstractDao<RememberLoginName, Long> {
public static final String TABLENAME = "REMEMBER_LOGIN_NAME";
/**
* Properties of entity RememberLoginName.<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 LoginUserName = new Property(1, String.class, "loginUserName", false, "LOGIN_USER_NAME");
public final static Property LoginPassword = new Property(2, String.class, "loginPassword", false, "LOGIN_PASSWORD");
public final static Property IsRemember = new Property(3, boolean.class, "isRemember", false, "IS_REMEMBER");
public final static Property LastUseTime = new Property(4, java.util.Date.class, "lastUseTime", false, "LAST_USE_TIME");
};
public RememberLoginNameDao(DaoConfig config) {
super(config);
}
public RememberLoginNameDao(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 + "'REMEMBER_LOGIN_NAME' (" + //
"'_id' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"'LOGIN_USER_NAME' TEXT NOT NULL ," + // 1: loginUserName
"'LOGIN_PASSWORD' TEXT NOT NULL ," + // 2: loginPassword
"'IS_REMEMBER' INTEGER NOT NULL ," + // 3: isRemember
"'LAST_USE_TIME' INTEGER);"); // 4: lastUseTime
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'REMEMBER_LOGIN_NAME'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, RememberLoginName entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getLoginUserName());
stmt.bindString(3, entity.getLoginPassword());
stmt.bindLong(4, entity.getIsRemember() ? 1l: 0l);
java.util.Date lastUseTime = entity.getLastUseTime();
if (lastUseTime != null) {
stmt.bindLong(5, lastUseTime.getTime());
}
}
/** @inheritdoc */
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
/** @inheritdoc */
@Override
public RememberLoginName readEntity(Cursor cursor, int offset) {
RememberLoginName entity = new RememberLoginName( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // loginUserName
cursor.getString(offset + 2), // loginPassword
cursor.getShort(offset + 3) != 0, // isRemember
cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)) // lastUseTime
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, RememberLoginName entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setLoginUserName(cursor.getString(offset + 1));
entity.setLoginPassword(cursor.getString(offset + 2));
entity.setIsRemember(cursor.getShort(offset + 3) != 0);
entity.setLastUseTime(cursor.isNull(offset + 4) ? null : new java.util.Date(cursor.getLong(offset + 4)));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(RememberLoginName entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(RememberLoginName entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}