Back to project page blink.
The source code is released under:
Apache License
If you think the Android project blink listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.nashlincoln.blink.model; //from w ww . j a va 2 s . com 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.nashlincoln.blink.model.AttributeType; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table ATTRIBUTE_TYPE. */ public class AttributeTypeDao extends AbstractDao<AttributeType, Long> { public static final String TABLENAME = "ATTRIBUTE_TYPE"; /** * Properties of entity AttributeType.<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 Description = new Property(1, String.class, "description", false, "DESCRIPTION"); public final static Property DataType = new Property(2, String.class, "dataType", false, "DATA_TYPE"); }; public AttributeTypeDao(DaoConfig config) { super(config); } public AttributeTypeDao(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 + "'ATTRIBUTE_TYPE' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'DESCRIPTION' TEXT," + // 1: description "'DATA_TYPE' TEXT);"); // 2: dataType } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'ATTRIBUTE_TYPE'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, AttributeType entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } String description = entity.getDescription(); if (description != null) { stmt.bindString(2, description); } String dataType = entity.getDataType(); if (dataType != null) { stmt.bindString(3, dataType); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public AttributeType readEntity(Cursor cursor, int offset) { AttributeType entity = new AttributeType( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // description cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2) // dataType ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, AttributeType entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setDescription(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); entity.setDataType(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(AttributeType entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(AttributeType entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }