- If you need to increase the number of fields in the database how to implement, if you do not use coredata ?
Writing SQL statements to manipulate fields in the original table
1> Add Table field
ALTER table name ADD COLUMN Name field type;
2> Delete a table field
ALTER Table name DROP COLUMN field name;
3> Modifying a table field
ALTER table name RENAME column Old field name to new field name;
- How is SQLite data storage used?
1> add SQLite Dynamic Library:
2> Import Primary header file: #import <sqlite3.h>
3> using C language functions to create \ Open database, write SQL Statements
- A simple description of the client's caching mechanism?
- The cache can be divided into: memory data cache, database cache, file cache
- Every time I want to get the data,
1> detect if there is no cache in memory first
2> re-detect local cache ( database \ file )
3> Final Send network request
4> caches the network data returned by the server (memory, database, file) for the next read
- Do you implement too many threads of Core Data ? nspersistentstorecoordinator,nsmanagedobjectcontext and Which of the nsmanagedobject need to be created or passed in the thread? What kind of strategy do you use to achieve this?
1> CoreData is an encapsulation of the SQLite Database
nsmanagedobjectcontext in 2> coredata is unsafe in multiple threads
3> If you want to have multi-threaded access to coredata , the best approach is to have a thread a nsmanagedobjectcontext
4> each nsmanagedobjectcontext Object instance can use the same Nspersistentstorecoordinator instance because Nsmanagedobjectcontext will lock the nspersistentstorecoordinator before he uses it .
5 What is data persistence?
Plist, preferences, key-value archiving, Sqlite3,core data five. The previous 4 kinds, all just save OC type Object data, for example: NSNumber nsstring nsdata nsarray nsdictionary, and database, first is check whether the library, no then create a library,
then create the table inside the library, and then make the specific data store in the table , finally to close the database, the database is generally written in C, but Apple he has a library of his own, called Fmdb, is the OC version,
used to more face objects, but also after the C package, the first 4 types are ordinary object type, and core data is not, can be stored in a wide range, but not very good operation, poor stability, not a library, just a file
6 How is data transmitted, and what are the ways?
block, notification, agent, attribute, Singleton, etc.
iOS Technology interview 04: Data storage