package me.bell.killprocess.db.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 me.bell.killprocess.db.entity.AppData;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "APP_DATA".
*/
public class AppDataDao extends AbstractDao<AppData, Long> {
public static final String TABLENAME = "APP_DATA";
/**
* Properties of entity AppData.<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 Name = new Property(1, String.class, "name", false, "NAME");
public final static Property PackageName = new Property(2, String.class, "packageName", false, "PACKAGE_NAME");
public final static Property Code = new Property(3, String.class, "code", false, "CODE");
public final static Property CodeID = new Property(4, String.class, "codeID", false, "CODE_ID");
public final static Property IsChecked = new Property(5, int.class, "isChecked", false, "IS_CHECKED");
}
public AppDataDao(DaoConfig config) {
super(config);
}
public AppDataDao(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 + "\"APP_DATA\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: _id
"\"NAME\" TEXT," + // 1: name
"\"PACKAGE_NAME\" TEXT," + // 2: packageName
"\"CODE\" TEXT," + // 3: code
"\"CODE_ID\" TEXT," + // 4: codeID
"\"IS_CHECKED\" INTEGER NOT NULL );"); // 5: isChecked
}
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"APP_DATA\"";
db.execSQL(sql);
}
@Override
protected final void bindValues(DatabaseStatement stmt, AppData entity) {
stmt.clearBindings();
Long _id = entity.get_id();
if (_id != null) {
stmt.bindLong(1, _id);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String packageName = entity.getPackageName();
if (packageName != null) {
stmt.bindString(3, packageName);
}
String code = entity.getCode();
if (code != null) {
stmt.bindString(4, code);
}
String codeID = entity.getCodeID();
if (codeID != null) {
stmt.bindString(5, codeID);
}
stmt.bindLong(6, entity.getIsChecked());
}
@Override
protected final void bindValues(SQLiteStatement stmt, AppData entity) {
stmt.clearBindings();
Long _id = entity.get_id();
if (_id != null) {
stmt.bindLong(1, _id);
}
String name = entity.getName();
if (name != null) {
stmt.bindString(2, name);
}
String packageName = entity.getPackageName();
if (packageName != null) {
stmt.bindString(3, packageName);
}
String code = entity.getCode();
if (code != null) {
stmt.bindString(4, code);
}
String codeID = entity.getCodeID();
if (codeID != null) {
stmt.bindString(5, codeID);
}
stmt.bindLong(6, entity.getIsChecked());
}
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
@Override
public AppData readEntity(Cursor cursor, int offset) {
AppData entity = new AppData( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // _id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // name
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // packageName
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // code
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // codeID
cursor.getInt(offset + 5) // isChecked
);
return entity;
}
@Override
public void readEntity(Cursor cursor, AppData entity, int offset) {
entity.set_id(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setPackageName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setCode(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setCodeID(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setIsChecked(cursor.getInt(offset + 5));
}
@Override
protected final Long updateKeyAfterInsert(AppData entity, long rowId) {
entity.set_id(rowId);
return rowId;
}
@Override
public Long getKey(AppData entity) {
if(entity != null) {
return entity.get_id();
} else {
return null;
}
}
@Override
public boolean hasKey(AppData entity) {
return entity.get_id() != null;
}
@Override
protected final boolean isEntityUpdateable() {
return true;
}
}