public static final String TABLENAME = "account";public AccountInfoDao(DaoConfig config) { super(config);}public AccountInfoDao(DaoConfig config, DaoSession daoSession) { super(config, daoSession);}public static void createTable(SQLiteDatabase db, boolean ifNotExists) { String constraint = ifNotExists ? "IF NOT EXISTS " : ""; db.execSQL("CREATE TABLE " + constraint + "'account' " + "(" + "'ACCOUNT_ID' TEXT PRIMARY KEY NOT NULL ," + "'NAME' TEXT," + "'USERNAME' TEXT," + "'PWD' TEXT,"+"'PREMISSION' TEXT);");}public static void dropTable(SQLiteDatabase db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"account\""; db.execSQL(sql);}@Overrideprotected void bindValues(SQLiteStatement stmt, AccountInfo entity) { stmt.clearBindings(); String accountId = entity.getAccountId(); if (accountId != null) { stmt.bindString(1, accountId); } String name = entity.getName(); if (name != null) { stmt.bindString(2, name); } String username = entity.getUsername(); if (username != null) { stmt.bindString(3, username); } String password = entity.getPwd(); if (entity != null) { stmt.bindString(4, password); } String premission = entity.getPremission(); if (entity != null) { stmt.bindString(5, premission); }}@Overridepublic String getKey(AccountInfo entity) { if (entity != null) { return entity.getAccountId(); } return null;}@Overrideprotected boolean isEntityUpdateable() { return true;}@Overridepublic AccountInfo readEntity(Cursor cursor, int offset) { AccountInfo entity = new AccountInfo( // cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // accountId cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // name cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pwd cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) ,// username cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4) // premission ); return entity;}@Overridepublic void readEntity(Cursor cursor, AccountInfo entity, int offset) { entity.setAccountId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0)); // accountId entity.setName(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1)); // name entity.setPwd(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));// pwd entity.setUsername(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));// username entity.setPremission(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));// Premission}@Overridepublic String readKey(Cursor cursor, int offset) { return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);}@Overrideprotected String updateKeyAfterInsert(AccountInfo entity, long rowId) { return entity.getAccountId();}public static class Properties { public static final Property AccountId = new Property(0, String.class, "accountId", true, "ACCOUNT_ID"); public static final Property Name = new Property(1, String.class, "name", false, "NAME"); public static final Property Pwd = new Property(3, String.class, "pwd", false, "PWD"); public static final Property Username = new Property(2, String.class, "username", false, "USERNAME"); public static final Property Premission = new Property(4, String.class, "premission", false, "PREMISSION");}
目前暂无任何回答
- 0 回答
- 0 关注
- 1117 浏览
添加回答
举报
0/150
提交
取消