If you think the Android project guerrillaprose listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package de.handler.mobile.android.bachelorapp.app.database;
//www.java2s.comimport 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 de.handler.mobile.android.bachelorapp.app.database.MediaType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* DAO for table MEDIA_TYPE.
*/publicclass MediaTypeDao extends AbstractDao<MediaType, Long> {
publicstaticfinal String TABLENAME = "MEDIA_TYPE";
/**
* Properties of entity MediaType.<br/>
* Can be used for QueryBuilder and for referencing column names.
*/publicstaticclass Properties {
publicfinalstatic Property Id = new Property(0, Long.class, "id", true, "_id");
publicfinalstatic Property Media_type = new Property(1, String.class, "media_type", false, "MEDIA_TYPE");
};
private DaoSession daoSession;
public MediaTypeDao(DaoConfig config) {
super(config);
}
public MediaTypeDao(DaoConfig config, DaoSession daoSession) {
super(config, daoSession);
this.daoSession = daoSession;
}
/** Creates the underlying database table. */publicstaticvoid createTable(SQLiteDatabase db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "'MEDIA_TYPE' (" + //
"'_id' INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"'MEDIA_TYPE' TEXT NOT NULL );"); // 1: media_type
}
/** Drops the underlying database table. */publicstaticvoid dropTable(SQLiteDatabase db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'MEDIA_TYPE'";
db.execSQL(sql);
}
/** @inheritdoc */
@Override
protectedvoid bindValues(SQLiteStatement stmt, MediaType entity) {
stmt.clearBindings();
Long id = entity.getId();
if (id != null) {
stmt.bindLong(1, id);
}
stmt.bindString(2, entity.getMedia_type());
}
@Override
protectedvoid attachEntity(MediaType 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 MediaType readEntity(Cursor cursor, int offset) {
MediaType entity = new MediaType( //
cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
cursor.getString(offset + 1) // media_type
);
return entity;
}
/** @inheritdoc */
@Override
publicvoid readEntity(Cursor cursor, MediaType entity, int offset) {
entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
entity.setMedia_type(cursor.getString(offset + 1));
}
/** @inheritdoc */
@Override
protected Long updateKeyAfterInsert(MediaType entity, long rowId) {
entity.setId(rowId);
return rowId;
}
/** @inheritdoc */
@Override
public Long getKey(MediaType entity) {
if(entity != null) {
return entity.getId();
} else {
return null;
}
}
/** @inheritdoc */
@Override
protectedboolean isEntityUpdateable() {
return true;
}
}