Back to project page campus.
The source code is released under:
GNU General Public License
If you think the Android project campus 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 lecho.app.campus.dao; //from w ww.j av a 2 s . c o m 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 lecho.app.campus.dao.Place; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table PLACE. */ public class PlaceDao extends AbstractDao<Place, Long> { public static final String TABLENAME = "PLACE"; /** * Properties of entity Place.<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 Name = new Property(1, String.class, "name", false, "NAME"); public final static Property Symbol = new Property(2, String.class, "symbol", false, "SYMBOL"); public final static Property Description = new Property(3, String.class, "description", false, "DESCRIPTION"); public final static Property Latitude = new Property(4, double.class, "latitude", false, "LATITUDE"); public final static Property Longitude = new Property(5, double.class, "longitude", false, "LONGITUDE"); public final static Property HasImage = new Property(6, boolean.class, "hasImage", false, "HAS_IMAGE"); }; private DaoSession daoSession; public PlaceDao(DaoConfig config) { super(config); } public PlaceDao(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 + "'PLACE' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'NAME' TEXT NOT NULL ," + // 1: name "'SYMBOL' TEXT NOT NULL ," + // 2: symbol "'DESCRIPTION' TEXT," + // 3: description "'LATITUDE' REAL NOT NULL ," + // 4: latitude "'LONGITUDE' REAL NOT NULL ," + // 5: longitude "'HAS_IMAGE' INTEGER NOT NULL );"); // 6: hasImage } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'PLACE'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Place entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getName()); stmt.bindString(3, entity.getSymbol()); String description = entity.getDescription(); if (description != null) { stmt.bindString(4, description); } stmt.bindDouble(5, entity.getLatitude()); stmt.bindDouble(6, entity.getLongitude()); stmt.bindLong(7, entity.getHasImage() ? 1l: 0l); } @Override protected void attachEntity(Place 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 Place readEntity(Cursor cursor, int offset) { Place entity = new Place( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // name cursor.getString(offset + 2), // symbol cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // description cursor.getDouble(offset + 4), // latitude cursor.getDouble(offset + 5), // longitude cursor.getShort(offset + 6) != 0 // hasImage ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Place entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setName(cursor.getString(offset + 1)); entity.setSymbol(cursor.getString(offset + 2)); entity.setDescription(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setLatitude(cursor.getDouble(offset + 4)); entity.setLongitude(cursor.getDouble(offset + 5)); entity.setHasImage(cursor.getShort(offset + 6) != 0); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Place entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Place entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }