为便携式应用程序同步两个mysql数据库 [英] Syncronizing two mysql databases for a portable application

查看:120
本文介绍了为便携式应用程序同步两个mysql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



我正在开发一个移动应用程序,用c#连接到一个便携式应用程序的mysql服务器。

基本上有两个MySQL服务器,一个主服务器和一个移动服务器。该应用程序必须将信息从主服务器导入到移动服务器以允许应用程序脱机工作,但只有工作的基本信息。



例表:



Hello there,

I'm developing a mobile application in c# connected to a mysql server for a portable application.
Basically there are two MySQL servers, a main server and a mobile one. the app has to import information from the main server to the mobile one to allow the app to work offline, but only the essential information for the job.

Exemple Tables:

   Technicians           Jobs              Clients           Machines
    id | name      id |idTec|idClient   id |  name       id |idClient | idModel
    1  | John       1 |  1  |   4        1 | Client1      1 |   5     |   1
    2  | Mike       2 |  3  |   2        2 | Client2      2 |   5     |   2
    3  | Bob        4 |  2  |   1        3 | Client3      3 |   2     |   1
                    5 |  2  |   3        4 | Client4      4 |   3     |   1
                    6 |  2  |   5        5 | Client5      5 |   2     |   2     
                                                          6 |   1     |   2     
                                                          7 |   4     |   2        

   MachinesModels
id |  brand  | model
 1 |  brand1 | X4-333
 2 |  brand2 | Fas-12    



因此,如果Mike在应用程序中登录(连接到主服务器),则会有一个Sync选项,该选项应该做的就是获取所有他的工作,,只有他的工作这样:




So, if "Mike" login in the app (connected to the mainserver) there will be a Sync option and what that option should do is get all his jobs, and only his jobs like this:

   Technicians           Jobs              Clients           Machines
    id | name      id |idTec|idClient   id |  name       id |idClient | idModel
    2  | Mike       4 |  2  |   1        1 | Client1      1 |   5     |   1
                    5 |  2  |   3        3 | Client3      2 |   5     |   2
                    6 |  2  |   5        5 | Client5      4 |   3     |   1
                                                          6 |   1     |   2

   MachinesModels
id |  brand  | model
 1 |  brand1 | X4-333
 2 |  brand2 | Fas-12





所以,我的问题是,最有效的方法是什么?

是否有一个MySQL选项导出一些行和所有连接的表,只导出特定的行?



我可以按表获取所有作业和搜索表fk连接,但对于大型数据库来说这似乎不是很有效。



你有什么看法?



(对不起任何写入错误,BTW很抱歉)



so, my question is, what would be the most effective way to do that?
is there a MySQL option that exports some rows and all the connected tables and only the specific rows?

I could get all the jobs and search table by table for the fk connections, but that dosen't seem very efficient for large DB.

What's your opinion?

(BTW sorry for any writing error)

推荐答案

您可以尝试 MySQL中的双向复制 [ ^ ]。


这篇关于为便携式应用程序同步两个mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆