package com.icareyou.food;
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.icareyou.food.Reports;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table REPORTS.
*/
public class ReportsDao extends AbstractDao<Reports, Long> {
public static final String TABLENAME = "REPORTS";
/**
* Properties of entity Reports.<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 Reportcat = new Property(1, String.class, "reportcat", false, "REPORTCAT");
public final static Property Reportid = new Property(2, String.class, "reportid", false, "REPORTID");
public final static Property Batchno = new Property(3, String.class, "batchno", false, "BATCHNO");
public final static Property Companyname = new Property(4, String.class, "companyname", false, "COMPANYNAME");
public final static Property Companycountry = new Property(5, String.class, "companycountry", false, "COMPANYCOUNTRY");
public final static Property Productname = new Property(6, String.class, "productname", false, "PRODUCTNAME");
public final static Property Importexport = new Property(7, String.class, "importexport", false, "IMPORTEXPORT");
public final static Property Guarantee = new Property(8, String.class, "guarantee", false, "GUARANTEE");
public final static Property Result = new Property(9, String.class, "result", false, "RESULT");
public final static Property Watched = new Property(10, Boolean.class, "watched", false, "WATCHED");
public final static Property Created_at = new Property(11, java.util.Date.class, "created_at", false, "CREATED_AT");
public final static Property Udpated_at = new Property(12, java.util.Date.class, "udpated_at", false, "UDPATED_AT");
};
public ReportsDao(DaoConfig config) {
super(config);
}
public ReportsDao(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 + "'REPORTS' (" + //
"'_id' INTEGER PRIMARY KEY ," + // 0: id
"'REPORTCAT' TEXT NOT NULL ," + // 1: reportcat
"'REPORTID' TEXT," + // 2: reportid
"'BATCHNO' TEXT," + // 3: batchno
"'COMPANYNAME' TEXT," + // 4: companyname
"'COMPANYCOUNTRY' TEXT," + // 5: companycountry
"'PRODUCTNAME' TEXT," + // 6: productname
"'IMPORTEXPORT' TEXT," + // 7: importexport
"'GUARANTEE' TEXT," + // 8: guarantee
"'RESULT' TEXT," + // 9: result
"'WATCHED' INTEGER," + // 10: watched
"'CREATED_AT' INTEGER," + // 11: created_at
"'UDPATED_AT' INTEGER);"); // 12: udpated_at
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'REPORTS'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, Reports entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getReportcat());
String reportid = entity.getReportid();
if (reportid != null) {
stmt.bindString(3, reportid);
}
String batchno = entity.getBatchno();
if (batchno != null) {
stmt.bindString(4, batchno);
}
String companyname = entity.getCompanyname();
if (companyname != null) {
stmt.bindString(5, companyname);
}
String companycountry = entity.getCompanycountry();
if (companycountry != null) {
stmt.bindString(6, companycountry);
}
String productname = entity.getProductname();
if (productname != null) {
stmt.bindString(7, productname);
}
String importexport = entity.getImportexport();
if (importexport != null) {
stmt.bindString(8, importexport);
}
String guarantee = entity.getGuarantee();
if (guarantee != null) {
stmt.bindString(9, guarantee);
}
String result = entity.getResult();
if (result != null) {
stmt.bindString(10, result);
}
Boolean watched = entity.getWatched();
if (watched != null) {
stmt.bindLong(11, watched ? 1l: 0l);
}
java.util.Date created_at = entity.getCreated_at();
if (created_at != null) {
stmt.bindLong(12, created_at.getTime());
}
java.util.Date udpated_at = entity.getUdpated_at();
if (udpated_at != null) {
stmt.bindLong(13, udpated_at.getTime());
}
}
/** @inheritdoc */
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
/** @inheritdoc */
@Override
public Reports readEntity(Cursor cursor, int offset) {
Reports entity = new Reports( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1), // reportcat
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // reportid
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // batchno
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // companyname
cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // companycountry
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // productname
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // importexport
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // guarantee
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // result
cursor.isNull(offset + 10) ? null : cursor.getShort(offset + 10) != 0, // watched
cursor.isNull(offset + 11) ? null : new java.util.Date(cursor.getLong(offset + 11)), // created_at
cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12)) // udpated_at
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, Reports entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setReportcat(cursor.getString(offset + 1));
entity.setReportid(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setBatchno(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
entity.setCompanyname(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
entity.setCompanycountry(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
entity.setProductname(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
entity.setImportexport(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
entity.setGuarantee(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
entity.setResult(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
entity.setWatched(cursor.isNull(offset + 10) ? null : cursor.getShort(offset + 10) != 0);
entity.setCreated_at(cursor.isNull(offset + 11) ? null : new java.util.Date(cursor.getLong(offset + 11)));
entity.setUdpated_at(cursor.isNull(offset + 12) ? null : new java.util.Date(cursor.getLong(offset + 12)));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(Reports entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(Reports entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}