Android?????????????????
???????????? ???????[ 2015/1/15 13:39:06 ] ????????Android ??????? ?????
???????????????????????д??????????
????public class PersonDao {
????private PersonDBHelper personDBHelper;
????//???-???????????????
????public PersonDao(PersonDBHelper personDBHelper) {
????super();
????this.personDBHelper = personDBHelper;
????}
????public boolean GetList(String username){
????SQLiteDatabase db =personDBHelper.getReadableDatabase();
????if(db.isOpen()){
????Cursor reader =db.rawQuery("select * from userInfo where username=?"?? ????new String []{username});//?????????
????if(reader.moveToNext()){
????return true;
????}
????reader.close();
????db.close();
????}
????return false;
????}
????public boolean Insert(Person model ){
????Object [] parms =new Object[]{model.getUsername()??model.getTelphone????()??model.getCreatedate()};
????SQLiteDatabase db =personDBHelper.getReadableDatabase();
????if(db.isOpen()){
????db.execSQL("insert into userInfo(username??telphone??createdate) values????(???????)"?? parms);
????db.close();
????return true;
????}
????return false;
????}
????}
?????????Android?μ??????????PersonDao??????
????public class testPersonDao extends AndroidTestCase {
????public void testAdd(){
????Person person =new Person();
????person.setUsername("????");
????person.setTelphone("15110041588");
????person.setRemark("?????????");
????person.setCreatedate(new Date());
????PersonDBHelper personDBHelper =new PersonDBHelper(getContext()?? "person.db"?? null?? 1);
????PersonDao dao =new PersonDao(personDBHelper);
????boolean res =dao.Insert(person);
????assertEquals(true?? res);
????}
????}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11