代替SQLite的手機數據庫:Realm

jopen 10年前發布 | 34K 次閱讀 Realm 數據庫服務器

logo.png
Realm是一個能夠代替SQLite和Core Data的手機數據庫。使用 C++ 內核,所以效率非常的高,是 sqlite 的近幾倍。

特性:

  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to keep our API down to very few classes: most of our users pick it up intuitively, getting simple apps up & running in minutes.
  • Modern: Realm supports easy thread-safety, relationships & encryption.
  • Fast: Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set.
  • </ul>

    Realm 中文文檔:http://djyde.github.io/2014/10/17/realm-doc-in-chinese.html

    Realm realm = Realm.getInstance(this);
    
    // All writes are wrapped in a transaction
    // to facilitate safe multi threading
    realm.beginTransaction();
    
    // Add a person
    Person person = realm.createObject(Person.class);
    person.setName("Young Person");
    person.setAge(14);
    
    realm.commitTransaction();
    
    RealmResults<User> result = realm.where(User.class)
                                     .greaterThan("age", 10)  // implicit AND
                                     .beginGroup()
                                          .equalTo("name", "Peter")
                                          .or()
                                          .contains("name", "Jo")
                                     .endGroup()
                                     .findAll();

    項目主頁:http://www.baiduhome.net/lib/view/home/1413557451497

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!