コード例 #1
0
 public void updateCertify(Customer customer) {
   db.beginTransaction();
   try {
     db.execSQL(
         "UPDATE customer set certify = ? where phonenumber = ?;",
         new Object[] {customer.getCertify(), customer.getPhonenumber()});
     db.setTransactionSuccessful();
   } finally {
     db.endTransaction();
   }
 }
コード例 #2
0
 public void add(Customer customer) {
   db.beginTransaction();
   try {
     db.execSQL(
         "INSERT INTO customer(_id,phonenumber,password,active,certify) VALUES(?,?,?,?,?)",
         new Object[] {
           customer.getId(),
           customer.getPhonenumber(),
           customer.getPassword(),
           customer.getActive(),
           customer.getCertify()
         });
     db.setTransactionSuccessful();
   } finally {
     db.endTransaction();
   }
 }
コード例 #3
0
 public List<Customer> query() {
   ArrayList<Customer> customers = new ArrayList<Customer>();
   Cursor c = queryCursor();
   while (c.moveToNext()) {
     Customer customer = new Customer();
     customer.setId(c.getInt(c.getColumnIndex("_id")));
     customer.setPhonenumber(c.getString(c.getColumnIndex("phonenumber")));
     customer.setPassword(c.getString(c.getColumnIndex("password")));
     customer.setActive(c.getInt(c.getColumnIndex("active")));
     customer.setCertify(c.getInt(c.getColumnIndex("certify")));
     customers.add(customer);
   }
   c.close();
   return customers;
 }