In Android, you can get an instance of the database that can be manipulated by Getreadabledatabase and Getwritabledatabase (). Then can be added to the database, delete, check, change. , but there is a difference between the two
1.getReadableDatabase is the first to read and write to open the database, but when the database disk is full, it will open failure, after failure, the program will try to open the database as read-only, if you can complete the required tasks, the read-only database will be closed. Returns a read-write database object.
2.getWritableDatabase is also read-write to open the database, but when the database disk is full, it will open the failure, and then because the use of getwritabledatabase, so open a read-only database has failed, then the program will be wrong
The Getwritabledatabase method is called in the 3.getReadableDatabase method
The source code is:
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/85/DC/wKiom1esdAuh1tMMAAEDxkzJogY504.png-wh_500x0-wm_3 -wmp_4-s_4280600721.png "style=" Float:none; "title=" Sql9.png "alt=" Wkiom1esdauh1tmmaaedxkzjogy504.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M00/85/DB/wKioL1esdA3Sq_PNAAESOG8jztI277.png-wh_500x0-wm_3 -wmp_4-s_110437772.png "style=" Float:none; "title=" Sql10.png "alt=" Wkiol1esda3sq_pnaaesog8jzti277.png-wh_50 "/>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/DB/wKioL1esdA7A5UsJAADNuBb8lyw801.png-wh_500x0-wm_3 -wmp_4-s_713253605.png "style=" Float:none; "title=" Sql11.png "alt=" Wkiol1esda7a5usjaadnubb8lyw801.png-wh_50 "/>
This article is from the "11828641" blog, please be sure to keep this source http://11838641.blog.51cto.com/11828641/1837074
The difference between Getreadabledatabase and getwritabledatabase