示例#1
0
文件: User.java 项目: vMASg/ExerDv
 public static User read(String userName) {
   Cursor c = dbhelp.read(userName);
   if (c.moveToFirst()) {
     User user =
         new User(
             c.getString(c.getColumnIndex("user_name")),
             c.getString(c.getColumnIndex("hometown")),
             c.getString(c.getColumnIndex("birthplace")));
     user.password = c.getString(c.getColumnIndex("password"));
     return user;
   }
   return null;
 }
示例#2
0
文件: User.java 项目: vMASg/ExerDv
 public static ArrayList<User> readAll() {
   ArrayList<User> retVal = new ArrayList<>();
   Cursor c = dbhelp.readAll();
   if (c.moveToFirst()) {
     do {
       User user =
           new User(
               c.getString(c.getColumnIndex("user_name")),
               c.getString(c.getColumnIndex("hometown")),
               c.getString(c.getColumnIndex("birthplace")));
       user.password = c.getString(c.getColumnIndex("password"));
       retVal.add(user);
     } while (c.moveToNext());
   }
   return retVal;
 }