The Internet is more popular: backup storage of database files and file restoration: that is, the database operation before saving a copy of the original file need to restore the operation of the file to replace the database file
However, a database table with a limited number of bars needs to be restored: just save the data in the original database table and restore it when it needs to be restored.
However, you cannot use the following methods
Take all the data out of the database table and put it in a collection 1, then new one, 2 2.addall (1)
Special Note: The address reference of an object is saved in the collection: Operation 1 Changes the same object in 2 and changes: So there is no longer the ability to use the second restore
So the above method is wrong.
So: it's actually
When traversing the database table to get cursor: New object when new two objects in a network set 1 save A to set 2 in the Save changes in the Set 1 set 2 to restore the database table to prepare
Get a collection of databases
Cursor cursor= App.getsqlmanager (). Seleteall (tablename,new string[]{"id", "name", "mobile", "Identitycard", "Agent"}, "id desc");
if (Cursor!=null&&cursor.getcount () >0) {
LOG.E ("JXF", "Customer database has data");
while (Cursor.movetonext ()) {
Buyticketinfo bean=new buyticketinfo ();
Buyticketinfo bean1=new buyticketinfo ();
Bean.id=cursor.getint (0);
Bean1.id=cursor.getint (0);
Bean.name=cursor.getstring (1);
Bean1.name=cursor.getstring (1);
Bean.mobile=cursor.getstring (2);
Bean1.mobile=cursor.getstring (2);
Bean.identitycard=cursor.getstring (3);
Bean1.identitycard=cursor.getstring (3);
Bean.agent=cursor.getstring (4);
Bean1.agent=cursor.getstring (4);
The default check box is not checked
Bean.ischeck=false;
1 new Trainees 2 refresher training
Bean.identify=1;
Sqlcustomers.add (Bean);
Tempbackupsql.add (BEAN1);
}
Cursor.close ();
if (Sqlcustomers.size () >40) {
int id=sqlcustomers.get. ID;
App.getsqlmanager (). Deleteone (tablename, "id