Android 数据库中加入内容 为什么还会报 没有匹配的错误 (加了一个premission) 代码如下

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);
}

@Override
protected 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);
   }
}

@Override
public String getKey(AccountInfo entity) {
   if (entity != null) {
       return entity.getAccountId();
   }
   return null;
}

@Override
protected boolean isEntityUpdateable() {
   return true;
}

@Override
public 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;
}

@Override
public 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

}

@Override
public String readKey(Cursor cursor, int offset) {
   return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
}

@Override
protected 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");
}http://img.mukewang.com/59c236420001ca5607020061.jpg

lay_hu
浏览 1095回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP