Back to project page JayJayLab-Android-Demo.
The source code is released under:
Apache License
If you think the Android project JayJayLab-Android-Demo 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.jayjaylab.androiddemo; //from w w w .j a v a 2s . co 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 com.jayjaylab.androiddemo.Path; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table path. */ public class PathDao extends AbstractDao<Path, Long> { public static final String TABLENAME = "path"; /** * Properties of entity Path.<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 GpxPath = new Property(1, String.class, "gpxPath", false, "GPX_PATH"); public final static Property StartTime = new Property(2, String.class, "startTime", false, "START_TIME"); public final static Property EndTime = new Property(3, String.class, "endTime", false, "END_TIME"); }; public PathDao(DaoConfig config) { super(config); } public PathDao(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 + "'path' (" + // "'_id' INTEGER PRIMARY KEY ASC AUTOINCREMENT ," + // 0: id "'GPX_PATH' TEXT NOT NULL ," + // 1: gpxPath "'START_TIME' TEXT NOT NULL ," + // 2: startTime "'END_TIME' TEXT NOT NULL );"); // 3: endTime // Add Indexes db.execSQL("CREATE INDEX " + constraint + "IDX_path__id ON path" + " (_id);"); } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'path'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Path entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getGpxPath()); stmt.bindString(3, entity.getStartTime()); stmt.bindString(4, entity.getEndTime()); } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public Path readEntity(Cursor cursor, int offset) { Path entity = new Path( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // gpxPath cursor.getString(offset + 2), // startTime cursor.getString(offset + 3) // endTime ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Path entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setGpxPath(cursor.getString(offset + 1)); entity.setStartTime(cursor.getString(offset + 2)); entity.setEndTime(cursor.getString(offset + 3)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Path entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Path entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }