Comparison between CoreData and SQLite

Source: Internet
Author: User
Tags sqlite sqlite database

CoreData.framework:iOS provides an encapsulation of the original SQLite database API access, which is much simpler and more convenient to manage the data cache and persistent data through this framework than using SQL statements to manipulate the SQLite database.

Mechanism: Using the framework to store and query data requires only the classes provided by the framework, you can manage your data and the relationship between data in the form of objects, and the framework has nicely encapsulated database tables and fields into objects and properties. A one-to-many, many-to-many relationship between tables is encapsulated as a containment relationship between objects.

By means of relationship:

One-to-one: set to Properties Select Optional, Plural option To-many relationship selected;

When a many-to-one inverse relationship occurs: The properties item is selected Optional, the Count entry selects Minimun and Maximun and sets its value to 1 respectively;

Core Data Features:

1) The power of Core data is that this relationship can be updated with an object, and its associated objects are updated as you update a table, and the other tables associated with it are updated as well.

2) Another feature of Core data is the provision of simpler performance management mechanisms, such as the use of the Nsfetchedresultscontroller class, Instead of using the limit of SQL, you can limit the total number of query records by using the Setfetchbatchsize () of the Nsfetchrequest class. The magic of the Nsfetchedresultscontroller class is that when more records are needed, the class automatically updates its cache.

3) for a multi-table query on the relative, CoreData no SQL intuitive, but the CoreData function can still complete the relevant operation.

But for similar outer connection, left connection and so on operation, in CoreData appears powerless.

Comparison between CoreData and SQLite

Related Article

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.