Wirelessly database operations

Source: Internet
Author: User

1. Native operation

A good way to pack in Android-------Sqlliteopenhelper

    • Object-oriented operations
    • Operation of SQL statements

2. Three-party operation

orm refers to object-relational mapping (Relation Mapping), which is a programming technique (both Greendao and Ormlite are based on ORM frameworks)

Used to implement transformations between data in different types of systems in an object-oriented programming language.

In effect, it actually creates a "virtual object database" that can be used in a programming language.

Object-oriented is developed from the basic Principles of software engineering (such as coupling, aggregation, encapsulation),

The relational database is developed from the mathematical theory. There is no match between the two.

ORM, as the form of project middleware, realizes data relation mapping in different scenarios.

Object-relational mapping is a technique to solve the phenomenon of non-matching between object-oriented and relational database . That's how ORM comes in .

    • Ormlite Frame

Based on annotations and reflection, the performance of Ormlite has been lost (annotations are actually using the principle of reflection)

Advantages:
The document is more comprehensive, the community is active, has the good maintenance, the use is simple, easy to get started.

Disadvantages:
Low efficiency due to reflection

    • Greendao


Advantages:
The efficiency is high , the insertion and update speed is twice times of SQLite, the loading entity speed is 4.5 times times ormlite.

The file is small (<100k), consumes less memory, but requires the Create Dao,
Flexible operation entities: support Get,update,delete and other operations

Disadvantages:

higher learning costs . which uses a Java project according to some properties and rules to generate some of the basic code, similar to JavaBean but there are some rules, in addition to QueryBuilder, DAO and other APIs, so first understand the whole process, in order to facilitate the use. Without ormlite that package intact, Greendao's official web site also points out that it is based on generator rather than reflection that makes it much more efficient.

Wirelessly database operations

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.