简体   繁体   English

将mySQL表和API同步到手机的DB sqlite

[英]Sync mySQL tables and API to phone's DB sqlite

I have created an app which contains a lot of data syncing between server and app. 我创建了一个应用程序,其中包含服务器和应用程序之间的大量数据同步。 Now I want to adapt the tables and api from server to my phone's DB, so that data can be accessed via offline mode also. 现在我想调整服务器中的表和api到我手机的数据库,这样也可以通过离线模式访问数据。

There are 2 parts of my question: 我的问题分为两部分:

  1. How will I port the tables from server MYSQL to phone's SQLite? 如何将表从服务器MYSQL移植到手机的SQLite?
  2. I am having a lot of Api's to access specific data from server, how will implement those for fetching data from phone's SQLite? 我有很多Api从服务器访问特定数据,如何实现从电话的SQLite获取数据?

Any help would be appreciated. 任何帮助,将不胜感激。 Thanks in advance 提前致谢

Basically, you should move all method responsible for fetching data from server for a particular entity into separate interface. 基本上,您应该将所有负责从特定实体的服务器获取数据的方法移动到单独的接口中。 For you local database also create DAO ( data access object) interface and implement it. 对于您本地数据库也创建DAO(数据访问对象)接口并实现它。 By doing so, you'll be able to write tests for you database and create implementations for different databases, ORMLite (or Realm) 通过这样做,您将能够为您的数据库编写测试并为不同的数据库创建实现,ORMLite(或Realm)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM