Parse.com是否適合在Android中與SQLite進行備份/同步?

[英]Is Parse.com an appropriate service for backup/sync with SQLite in Android?


The example apps and documentation I've seen so far seems to use Parse as the primary (if not only) storage solution for the app, which is great in some situations.

我到目前為止看到的示例應用程序和文檔似乎使用Parse作為應用程序的主要(如果不僅僅是)存儲解決方案,這在某些情況下很棒。

I'm looking to integrate Parse with an existing application of mine on Android, which uses multiple SQLite tables in a single database.

我正在尋找將Parse與我在Android上的現有應用程序集成,該應用程序在單個數據庫中使用多個SQLite表。

Are there any examples which show usage of Parse, where local storage (i.e. the SQLite DBs) is the primary storage, and data is only sync'd between Parse and local storage if there are newer changes which need updating/committing?

是否有任何示例顯示Parse的用法,其中本地存儲(即SQLite DB)是主存儲,如果有更新需要更新/提交的更新,則數據僅在Parse和本地存儲之間同步?

For my database, I have two tables, Tasks and Dates. Tasks is formed of:

對於我的數據庫,我有兩個表,任務和日期。任務由以下組成:

  • _id (a unique integer key for this table)
  • _id(此表的唯一整數鍵)
  • item (a String describing the task)
  • item(描述任務的String)
  • desc (a String with a longer description - may be null)
  • desc(具有更長描述的字符串 - 可以為null)
  • parent (an integer indicating the _id of this task's parent)
  • parent(一個整數,表示此任務的父級的_id)

and Date:

和日期:

  • _id (a unique integer key for this table)
  • _id(此表的唯一整數鍵)
  • item_id (a foreign key which corresponds to _id in Tasks) date (a date stored in long format)
  • item_id(與任務中的_id對應的外鍵)date(以長格式存儲的日期)

In this instance, would I store each row as a separate ParseObject? Having different classes for Task and Date, and I could link Dates with their Task parents? Is this the recommended way?

在這種情況下,我會將每一行存儲為單獨的ParseObject嗎?有不同的任務和日期類,我可以將日期與他們的任務父母鏈接?這是推薦的方式嗎?

--

-

Edit: I received a reply from an engineer at Parse who said that it's possible (to sync with a local SQLite DB), but that it's not supported, and didn't comment on the method I proposed - specifically mapping rows to ParseObjects.

編輯:我收到了Parse工程師的回復,他說可能(與本地SQLite數據庫同步),但它不受支持,並且沒有評論我提出的方法 - 特別是將行映射到ParseObjects。

2 个解决方案

#1


1  

I have been thinking on similar lines but there is not adapter or library that implements the sync. So, you would have to implement it from scratch. Seeing as your schema is pretty straight-forward, it shouldn't be too difficult.

我一直在考慮類似的行,但沒有實現同步的適配器或庫。所以,你必須從頭開始實現它。看到你的架構很簡單,它應該不會太難。

Is the solution is appropriate: in your scenario parse.com would act as any other REST service that would provide data, so I don't see any problems.

解決方案是否合適:在您的方案中,parse.com將充當提供數據的任何其他REST服務,因此我沒有看到任何問題。

#2


0  

Actually, now there is a simple library for Parse <=> sqlite integration. Check out https://github.com/ntoskrnl/DataSync

實際上,現在有一個簡單的Parse <=> sqlite集成庫。查看https://github.com/ntoskrnl/DataSync


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/12/17/7302ce93d351289db49b6841adbfeeaf.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com