package com.lotaai.canguiayw.sqllitedb;
|
|
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;
|
|
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
/**
|
* DAO for table "TEST".
|
*/
|
public class TestDao extends AbstractDao<Test, Void> {
|
|
public static final String TABLENAME = "TEST";
|
|
/**
|
* Properties of entity Test.<br/>
|
* Can be used for QueryBuilder and for referencing column names.
|
*/
|
public static class Properties {
|
public final static Property BarCode = new Property(0, String.class, "barCode", false, "BAR_CODE");
|
public final static Property ETageCode = new Property(1, String.class, "eTageCode", false, "E_TAGE_CODE");
|
}
|
|
|
public TestDao(DaoConfig config) {
|
super(config);
|
}
|
|
public TestDao(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 + "\"TEST\" (" + //
|
"\"BAR_CODE\" TEXT UNIQUE ," + // 0: barCode
|
"\"E_TAGE_CODE\" TEXT NOT NULL );"); // 1: eTageCode
|
}
|
|
/** Drops the underlying database table. */
|
public static void dropTable(Database db, boolean ifExists) {
|
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TEST\"";
|
db.execSQL(sql);
|
}
|
|
@Override
|
protected final void bindValues(DatabaseStatement stmt, Test entity) {
|
stmt.clearBindings();
|
|
String barCode = entity.getBarCode();
|
if (barCode != null) {
|
stmt.bindString(1, barCode);
|
}
|
stmt.bindString(2, entity.getETageCode());
|
}
|
|
@Override
|
protected final void bindValues(SQLiteStatement stmt, Test entity) {
|
stmt.clearBindings();
|
|
String barCode = entity.getBarCode();
|
if (barCode != null) {
|
stmt.bindString(1, barCode);
|
}
|
stmt.bindString(2, entity.getETageCode());
|
}
|
|
@Override
|
public Void readKey(Cursor cursor, int offset) {
|
return null;
|
}
|
|
@Override
|
public Test readEntity(Cursor cursor, int offset) {
|
Test entity = new Test( //
|
cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // barCode
|
cursor.getString(offset + 1) // eTageCode
|
);
|
return entity;
|
}
|
|
@Override
|
public void readEntity(Cursor cursor, Test entity, int offset) {
|
entity.setBarCode(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
|
entity.setETageCode(cursor.getString(offset + 1));
|
}
|
|
@Override
|
protected final Void updateKeyAfterInsert(Test entity, long rowId) {
|
// Unsupported or missing PK type
|
return null;
|
}
|
|
@Override
|
public Void getKey(Test entity) {
|
return null;
|
}
|
|
@Override
|
public boolean hasKey(Test entity) {
|
// TODO
|
return false;
|
}
|
|
@Override
|
protected final boolean isEntityUpdateable() {
|
return true;
|
}
|
|
}
|