package model.daoModels;
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 model.daoModels.Project;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table "PROJECT".
*/
public class ProjectDao extends AbstractDao<Project, Long> {
public static final String TABLENAME = "PROJECT";
/**
* Properties of entity Project.<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 UniqueSlug = new Property(1, String.class, "uniqueSlug", false, "UNIQUE_SLUG");
public final static Property Slug = new Property(2, String.class, "slug", false, "SLUG");
public final static Property Title = new Property(3, String.class, "title", false, "TITLE");
};
private DaoSession daoSession;
public ProjectDao(DaoConfig config) {
super(config);
}
public ProjectDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = 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 + "\"PROJECT\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"UNIQUE_SLUG\" TEXT," + // 1: uniqueSlug
"\"SLUG\" TEXT," + // 2: slug
"\"TITLE\" TEXT);"); // 3: title
}
/** Drops the underlying database table. */
public static void dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"PROJECT\"";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protected void bindValues(SQLiteStatement stmt, Project entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
String uniqueSlug = entity.getUniqueSlug();
if (uniqueSlug != null) {
stmt.bindString(2, uniqueSlug);
}
String slug = entity.getSlug();
if (slug != null) {
stmt.bindString(3, slug);
}
String title = entity.getTitle();
if (title != null) {
stmt.bindString(4, title);
}
}
@Override
protected void attachEntity(Project entity) {
super.attachEntity(entity);
entity.__setDaoSession(daoSession);
}
/** @inheritdoc */
@Override
public Long readKey(Cursor cursor, int offset) {
return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
}
/** @inheritdoc */
@Override
public Project readEntity(Cursor cursor, int offset) {
Project entity = new Project( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // uniqueSlug
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // slug
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // title
);
return entity;
}
/** @inheritdoc */
@Override
public void readEntity(Cursor cursor, Project entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setUniqueSlug(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
entity.setSlug(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
entity.setTitle(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(Project entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(Project entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protected boolean isEntityUpdateable() {
return true;
}
}