Difference with online database backup recovery: Use memory set list or MAP_ database

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.