package com.yuantiku.dbdata; 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.yuantiku.dbdata.Account; // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. /** * DAO for table ACCOUNT. */ public class AccountDao extends AbstractDao<Account, Long> { public static final String TABLENAME = "ACCOUNT"; /** * Properties of entity Account.<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 Ldap = new Property(2, String.class, "ldap", false, "LDAP"); public final static Property Email = new Property(3, String.class, "email", false, "EMAIL"); public final static Property Phone = new Property(4, String.class, "phone", false, "PHONE"); public final static Property Dept = new Property(5, String.class, "dept", false, "DEPT"); public final static Property GoogleAccount = new Property(6, String.class, "googleAccount", false, "GOOGLE_ACCOUNT"); public final static Property Birth = new Property(7, String.class, "birth", false, "BIRTH"); public final static Property Constellation = new Property(8, String.class, "constellation", false, "CONSTELLATION"); }; public AccountDao(DaoConfig config) { super(config); } public AccountDao(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 + "'ACCOUNT' (" + // "'_id' INTEGER PRIMARY KEY ," + // 0: id "'NAME' TEXT NOT NULL ," + // 1: name "'LDAP' TEXT NOT NULL ," + // 2: ldap "'EMAIL' TEXT," + // 3: email "'PHONE' TEXT," + // 4: phone "'DEPT' TEXT," + // 5: dept "'GOOGLE_ACCOUNT' TEXT," + // 6: googleAccount "'BIRTH' TEXT," + // 7: birth "'CONSTELLATION' TEXT);"); // 8: constellation } /** Drops the underlying database table. */ public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'ACCOUNT'"; db.execSQL(sql); } /** @inheritdoc */ @Override protected void bindValues(SQLiteStatement stmt, Account entity) { stmt.clearBindings(); Long id = entity.getId(); if (id != null) { stmt.bindLong(1, id); } stmt.bindString(2, entity.getName()); stmt.bindString(3, entity.getLdap()); String email = entity.getEmail(); if (email != null) { stmt.bindString(4, email); } String phone = entity.getPhone(); if (phone != null) { stmt.bindString(5, phone); } String dept = entity.getDept(); if (dept != null) { stmt.bindString(6, dept); } String googleAccount = entity.getGoogleAccount(); if (googleAccount != null) { stmt.bindString(7, googleAccount); } String birth = entity.getBirth(); if (birth != null) { stmt.bindString(8, birth); } String constellation = entity.getConstellation(); if (constellation != null) { stmt.bindString(9, constellation); } } /** @inheritdoc */ @Override public Long readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); } /** @inheritdoc */ @Override public Account readEntity(Cursor cursor, int offset) { Account entity = new Account( // cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id cursor.getString(offset + 1), // name cursor.getString(offset + 2), // ldap cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // email cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // phone cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // dept cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // googleAccount cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // birth cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // constellation ); return entity; } /** @inheritdoc */ @Override public void readEntity(Cursor cursor, Account entity, int offset) { entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); entity.setName(cursor.getString(offset + 1)); entity.setLdap(cursor.getString(offset + 2)); entity.setEmail(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); entity.setPhone(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); entity.setDept(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); entity.setGoogleAccount(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); entity.setBirth(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); entity.setConstellation(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); } /** @inheritdoc */ @Override protected Long updateKeyAfterInsert(Account entity, long rowId) { entity.setId(rowId); return rowId; } /** @inheritdoc */ @Override public Long getKey(Account entity) { if(entity != null) { return entity.getId(); } else { return null; } } /** @inheritdoc */ @Override protected boolean isEntityUpdateable() { return true; } }