TWI816875B - Data synchronous query method, device, computer device and storage medium - Google Patents

Data synchronous query method, device, computer device and storage medium Download PDF

Info

Publication number
TWI816875B
TWI816875B TW108131975A TW108131975A TWI816875B TW I816875 B TWI816875 B TW I816875B TW 108131975 A TW108131975 A TW 108131975A TW 108131975 A TW108131975 A TW 108131975A TW I816875 B TWI816875 B TW I816875B
Authority
TW
Taiwan
Prior art keywords
query
data
synchronization
item index
operation instruction
Prior art date
Application number
TW108131975A
Other languages
Chinese (zh)
Other versions
TW202109307A (en
Inventor
劉慧丰
陸欣
范壽峰
Original Assignee
鴻海精密工業股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 鴻海精密工業股份有限公司 filed Critical 鴻海精密工業股份有限公司
Publication of TW202109307A publication Critical patent/TW202109307A/en
Application granted granted Critical
Publication of TWI816875B publication Critical patent/TWI816875B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention provides a data synchronization query method, a data synchronization query device, a computer device and a storage medium. The data synchronization query device creates a data item index and an operation instruction set table for the data in the database. The operation instruction set table includes: data item index, operation time, operation type, operation instruction and session table. The method includes: receiving a data query statement sent by the client; determining whether the data to be queried by the query statement is a first query; outputting the data query result if the query data is first queried; founding last synchronization time of the data item index in the session table, according to the synchronization time; confirming at least one operation instruction corresponding to the data item index; and outputting the operation instruction , if the query data isn’t first queried.

Description

資料同步查詢方法、裝置、電腦裝置及存儲介質 Data synchronization query method, device, computer device and storage medium

本發明涉及資料查詢技術領域,具體涉及一種資料同步查詢方法、資料同步查詢裝置、電腦裝置及電腦可讀存儲介質。 The invention relates to the technical field of data query, and specifically to a data synchronization query method, a data synchronization query device, a computer device and a computer-readable storage medium.

在日常工作中,經常需要在不同之資料存儲點之間進行資料同步,例如資料庫與用戶端之間。通常是存儲資料庫之服務端執行用戶端之同步查詢指令來查詢資料並將所要查詢之結果返回給用戶端。這種將資料完整查詢並傳輸之做法過於浪費頻寬。 In daily work, it is often necessary to synchronize data between different data storage points, such as between a database and a client. Usually, the server that stores the database executes the client's synchronous query command to query the data and returns the desired query results to the client. This method of querying and transmitting complete data wastes bandwidth.

鑒於以上內容,有必要提出一種資料同步查詢方法及裝置、電腦裝置和電腦可讀存儲介質,通過所述方法使得用戶端與服務端在同步資料時,以更加節約頻寬之方式進行。 In view of the above, it is necessary to propose a data synchronization query method and device, a computer device and a computer-readable storage medium. Through the method, the client and the server can synchronize data in a more bandwidth-saving manner.

本申請之第一方面提供一種資料同步查詢方法,應用於資料同步查詢裝置中,所述資料同步查詢裝置為資料庫中之資料創建資料項目索引以及操作指令集表,所述操作指令集表包括:資料項目索引、操作時間、操作類型、操作指令、會話表的序號,所述方法包括:接收用戶端發送之資料查詢語句;判斷所述查詢語句所要查詢之資料是否為第一次查詢; 若所述查詢之資料為第一次查詢,則輸出資料查詢結果;及若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 The first aspect of this application provides a data synchronization query method, which is applied in a data synchronization query device. The data synchronization query device creates a data item index and an operation instruction set table for the data in the database. The operation instruction set table includes : Data item index, operation time, operation type, operation command, and session table serial number. The method includes: receiving a data query statement sent by the client; determining whether the data to be queried by the query statement is the first query; If the data queried is the first query, the data query results are output; and if the data queried is not the first query, the last synchronization time of the data item index is searched in the session table, and based on The synchronization time determines at least one operation instruction corresponding to the data item index, and outputs the operation instruction.

優選地,當所述資料庫中之資料有更新時,以所述資料之資料項目索引、操作類型、操作指令、操作時間生成一條更新記錄並添加到所述資料操作指令集表中。 Preferably, when the data in the database is updated, an update record is generated based on the data item index, operation type, operation instruction, and operation time of the data and added to the data operation instruction set table.

優選地,所述會話表用於存儲用戶端之同步查詢記錄;所述會話表之內容包括:資料項目索引、同步時間、同步結果中之一項或多項。 Preferably, the session table is used to store synchronization query records of the client; the content of the session table includes one or more of: data item index, synchronization time, and synchronization result.

優選地,所述判斷所述查詢語句中所要查詢之資料是否為第一次查詢之方法包括如下任意一種方式:在所述操作指令集表中查找是否包含所述用戶端同步查詢記錄之會話表的序號;若不包含所述用戶端同步查詢記錄之會話表的序號,則判定所述查詢語句為第一次查詢;若包含所述用戶端同步查詢記錄之會話表的序號,在所述會話表中查找是否包含所要查詢是資料之資料項目索引,若不包含,則判定所述查詢語句為第一次查詢。 Preferably, the method for determining whether the data to be queried in the query statement is the first query includes any of the following methods: searching in the operation instruction set table whether the session table contains the user-side synchronous query record. The sequence number; if it does not contain the sequence number of the session table of the client's synchronous query record, then it is determined that the query statement is the first query; if it contains the sequence number of the session table of the client's synchronous query record, in the session Check whether the table contains the data item index of the data to be queried. If not, the query statement is determined to be the first query.

優選地,若所述查詢之資料為第一次查詢,所述步驟還包括:將所述查詢之資料之資料項目索引和所述查詢語句對應之操作類型添加到所述會話表中。 Preferably, if the queried data is the first query, the step further includes: adding the data item index of the queried data and the operation type corresponding to the query statement to the session table.

優選地,若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令之步驟包括: 根據所述同步時間在所述操作指令集表中之預設範圍中查找與所述資料項目索引對應之至少一條操作指令,其中所述預設範圍是指從所述同步時間到當前查詢時間之間與所述資料項目索引對應之操作指令;若所述資料項目索引對應之操作指令為一條,則將所述操作指令發送至用戶端;及若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併後發送至用戶端。 Preferably, if the queried data is not queried for the first time, the last synchronization time of the data item index is searched in the session table, and at least one operation corresponding to the data item index is determined based on the synchronization time. instructions, and the steps of outputting the operation instructions include: Search at least one operation instruction corresponding to the data item index in a preset range in the operation instruction set table according to the synchronization time, where the preset range refers to the period from the synchronization time to the current query time. There is an operation instruction corresponding to the data item index; if there is one operation instruction corresponding to the data item index, the operation instruction is sent to the user terminal; and if there are multiple operation instructions corresponding to the data item index , then the operation instructions are sorted and merged and sent to the user end.

優選地,若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併之步驟包括:提取與所述資料項目索引對應之多條操作指令,將所述多條操作指令按照時間順序進行排序;按照時間先後順序,將相鄰兩項操作類型相同之操作指令進行合併,所述操作類型包括刪除、添加、修改中之一項或多項。 Preferably, if there are multiple operation instructions corresponding to the data item index, the step of sorting and merging the operation instructions includes: extracting multiple operation instructions corresponding to the data item index, and combining the multiple operation instructions. The instructions are sorted in chronological order; two adjacent operation instructions with the same operation type are merged in chronological order, and the operation type includes one or more of deletion, addition, and modification.

本申請之第二方面提供一種資料同步查詢裝置,所述裝置包括:接收模組,用於接收用戶端發送之資料查詢語句;判斷模組,用於判斷所述查詢語句所要查詢之資料是否為第一次查詢;第一執行模組,用於當所述查詢之資料為第一次查詢時,則並輸出資料查詢結果;及第二執行模組,用於當所述查詢之資料非第一次查詢時,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 The second aspect of the present application provides a data synchronization query device. The device includes: a receiving module for receiving a data query sentence sent by the client; a judgment module for judging whether the data to be queried by the query sentence is The first query; the first execution module is used to output the data query results when the query data is the first query; and the second execution module is used when the query data is not the first query. During a query, the last synchronization time of the data item index is searched in the session table, at least one operation instruction corresponding to the data item index is determined based on the synchronization time, and the operation instruction is output.

本申請之協力廠商面提供一種電腦裝置,所述電腦裝置包括處理器,所述處理器用於執行記憶體中存儲之電腦程式時實現如前所述資料同步查詢方法。 The third party of this application provides a computer device. The computer device includes a processor. The processor is used to implement the data synchronization query method as described above when executing a computer program stored in the memory.

本申請之第四方面提供一種電腦可讀存儲介質,其上存儲有電腦程式,所述電腦程式被處理器執行時實現如前所述資料同步查詢方法。 A fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the data synchronization query method as described above is implemented.

本發明資料同步查詢方法通過為資料庫中之所有資料創建資料項目索引並創建資料操作指令集表,並對用戶端之查詢語句創建會話表,會話表中記錄用戶端查詢語句所對應之資料項目索引,通過在操作指令集表中查詢上次更新時間之後與所要查詢資料對應之資料項目索引對應之操作指令發送給用戶端。通過所述方法減少了查詢資料之資料量,節約了頻寬。 The data synchronization query method of the present invention creates a data item index and a data operation instruction set table for all data in the database, and creates a session table for the user's query statement. The session table records the data items corresponding to the user's query statement. The index is sent to the user by querying the operation instruction set table for the operation instructions corresponding to the data item index corresponding to the data to be queried after the last update time. The method reduces the amount of query data and saves bandwidth.

1:電腦裝置 1: Computer device

2:用戶端 2: Client

10:資料同步查詢裝置 10: Data synchronization query device

101:接收模組 101:Receive module

102:判斷模組 102:Judgement module

103:第一執行模組 103: First execution module

104:第二執行模組 104: Second execution module

20:記憶體 20:Memory

30:處理器 30: Processor

40:電腦程式 40:Computer program

圖1是本發明一實施方式提供之資料同步查詢方法之應用環境圖。 Figure 1 is an application environment diagram of the data synchronization query method provided by an embodiment of the present invention.

圖2是本發明一實施方式提供之資料同步查詢方法流程圖。 Figure 2 is a flow chart of a data synchronization query method provided by an embodiment of the present invention.

圖3是本發明一實施方式提供之資料同步查詢裝置之功能模組圖。 Figure 3 is a functional module diagram of a data synchronization query device provided by an embodiment of the present invention.

圖4是本發明一實施方式提供之電腦裝置示意圖。 FIG. 4 is a schematic diagram of a computer device according to an embodiment of the present invention.

為了能夠更清楚地理解本發明之上述目的、特徵和優點,下面結合附圖和具體實施例對本發明進行詳細描述。需要說明之是,在不衝突之情況下,本申請之實施例及實施例中之特徵可以相互組合。 In order to understand the above objects, features and advantages of the present invention more clearly, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, as long as there is no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.

在下面之描述中闡述了很多具體細節以便於充分理解本發明,所描述之實施例僅僅是本發明一部分實施例,而不是全部之實施例。基於本發明中之實施例,本領域普通技術人員在沒有做出創造性勞動前提下所獲得之所有其他實施例,都屬於本發明保護之範圍。 Many specific details are set forth in the following description in order to fully understand the present invention. The described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative efforts fall within the scope of protection of the present invention.

除非另有定義,本文所使用之所有之技術和科學術語與屬於本發明之技術領域之技術人員通常理解之含義相同。本文中在本發明之說明書中所使用之術語只是為了描述具體之實施例之目的,不是旨在於限制本發明。 Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein in the description of the present invention is for the purpose of describing specific embodiments only and is not intended to limit the present invention.

參閱圖1所示,為本發明一實施例提供之資料同步查詢方法之應 用環境架構示意圖。 Referring to Figure 1, an application of a data synchronization query method provided by an embodiment of the present invention is shown. Schematic diagram of the environment architecture.

本發明中之資料同步查詢方法應用在電腦裝置1中,所述電腦裝置1和至少一個用戶端2通過網路建立通信連接。所述網路可以是有線網路,也可以是無線網路,例如無線電、無線保真(Wireless Fidelity,WIFI)、蜂窩、衛星、廣播等。 The data synchronization query method in the present invention is applied to the computer device 1, and the computer device 1 and at least one client 2 establish a communication connection through the network. The network may be a wired network or a wireless network, such as radio, wireless fidelity (Wireless Fidelity, WIFI), cellular, satellite, broadcast, etc.

所述電腦裝置1可以為安裝有資料同步查詢方法具有存儲計算等功能之電子設備,所述電腦裝置1中存儲有資料庫資訊,所述電腦裝置1可以是個人電腦、伺服器等,其中,所述伺服器可以是單一之伺服器、伺服器集群或雲伺服器等。 The computer device 1 can be an electronic device equipped with a data synchronization query method and has functions such as storage and calculation. Database information is stored in the computer device 1. The computer device 1 can be a personal computer, a server, etc., wherein, The server may be a single server, a server cluster or a cloud server, etc.

所述用戶端2可以為具有檔同步查詢功能之各種智慧電子設備,用於向電腦裝置1發送查詢語句,接收電腦裝置1發送之資料查詢資訊。包括但不限於智慧手機、平板電腦、膝上型便捷電腦、臺式電腦等。 The client 2 can be various smart electronic devices with a file synchronization query function, used for sending query statements to the computer device 1 and receiving data query information sent by the computer device 1 . Including but not limited to smartphones, tablets, laptops, desktop computers, etc.

根據不同之需求,所述流程圖中步驟之順序可以改變,某些步驟可以省略。 According to different requirements, the order of steps in the flow chart can be changed, and some steps can be omitted.

步驟S1、接收用戶端發送之查詢語句。 Step S1: Receive the query statement sent by the client.

在一實施方式中,所述查詢語句可以為結構化查詢語言。所述結構化查詢語言是一種資料庫查詢和程式設計語言,用於存取資料以及查詢、更新和管理關聯式資料庫系統。安裝有資料同步查詢方法之電腦裝置1接受用戶端2發送之查詢語句,可以逐條接收所述查詢語句,根據所述查詢語句查詢所要查詢之資料。 In one implementation, the query statement may be a structured query language. The structured query language is a database query and programming language used for accessing data and querying, updating and managing relational database systems. The computer device 1 installed with the data synchronization query method accepts the query statements sent by the client 2, can receive the query statements one by one, and query the data to be queried according to the query statements.

在一實施方式中,所述用戶端2也可以將所要查詢之多條資料資訊使用結構化查詢語言寫入查詢腳本中,使用查詢腳本可以一次查詢多條資料資訊。所述電腦裝置1可以接收所述用戶端2發送之使用結構化查詢語言編寫之查詢腳本。 In one implementation, the client 2 can also write multiple pieces of data information to be queried into a query script using structured query language. The query script can be used to query multiple pieces of data information at one time. The computer device 1 can receive a query script written using structured query language sent by the client 2 .

步驟S2、判斷所述查詢語句所要查詢之資料是否為第一次查詢。 Step S2: Determine whether the data to be queried by the query statement is the first query.

在一實施方式中,電腦裝置1可對接收到之查詢語句之合法性進 行檢查,如果電腦裝置1之進程認為所述查詢語句不符合語法規定會把這個錯誤資訊回饋給用戶端2。如果所述查詢語句合法,會對所述用戶端2之身份資訊進行判斷,判斷所述用戶端2是否具有訪問所述查詢語句對應之資料庫之許可權。並且對所述用戶端2之許可權範圍進行確認,確定所述用戶端2所能操作之資料範圍。如果所述用戶端2沒有所述查詢語句對應之資料庫許可權則會回饋用戶端2。 In one embodiment, the computer device 1 can check the validity of the received query statement. Check, if the process of computer device 1 thinks that the query statement does not meet the grammatical requirements, this error message will be fed back to user terminal 2. If the query statement is legal, the identity information of the client 2 will be judged to determine whether the user terminal 2 has the permission to access the database corresponding to the query statement. And confirm the permission range of the client 2 to determine the data range that the client 2 can operate. If the client 2 does not have the database permission corresponding to the query statement, a feedback will be given to the client 2.

所述電腦裝置1根據接收到之用戶端發送之查詢語句,判斷所述查詢語句中所要查詢之資料是否為第一次查詢之方法包括如下任意一種方式:在所述操作指令集表中查找是否包含所述用戶端2同步查詢記錄之會話表的序號;若不包含所述用戶端2同步查詢記錄之會話表的序號,則判定所述查詢語句為第一次查詢;若包含所述用戶端2同步查詢記錄之會話表的序號,在所述會話表中查找是否包含所要查詢資料之資料項目索引,若不包含,則判定所述查詢語句為第一次查詢。 The method for the computer device 1 to determine whether the data to be queried in the query statement is the first query according to the received query statement sent by the client includes any of the following methods: searching in the operation instruction set table whether Contains the sequence number of the session table of the synchronous query record of the client 2; if it does not contain the sequence number of the session table of the synchronous query record of the client 2, it is determined that the query statement is the first query; if it contains the sequence number of the session table of the synchronous query record of the client 2 2. Query the serial number of the session table of the record synchronously, and search in the session table whether the data item index of the data to be queried is included. If it is not included, the query statement is determined to be the first query.

其中,所述資料項目索引為電腦裝置1為資料庫中之所有資料創建,電腦裝置1還為資料庫中之資料創建資料操作指令集表。所述操作指令集表包括:資料項目索引、操作時間、操作類型、操作指令、會話表的序號。所述資料操作指令集表如表1所示:

Figure 108131975-A0305-02-0008-1
Figure 108131975-A0305-02-0009-2
The data item index is created by the computer device 1 for all the data in the database, and the computer device 1 also creates a data operation instruction set table for the data in the database. The operation instruction set table includes: data item index, operation time, operation type, operation instruction, and serial number of the session table. The data operation instruction set table is shown in Table 1:
Figure 108131975-A0305-02-0008-1
Figure 108131975-A0305-02-0009-2

當所述資料庫中之資料有更新時,以所述資料之資料項目索引、操作類型、操作指令、操作時間生成一條更新記錄並添加到所述資料操作指令集表中。 When the data in the database is updated, an update record is generated based on the data item index, operation type, operation instruction, and operation time of the data and added to the data operation instruction set table.

舉例而言,電腦裝置1在所述操作指令集表中查找是否包含用戶端2之會話表的序號,所述會話表用於記錄用戶端2之查詢記錄,所述會話表之內容包含查詢資料之資料項目索引、同步時間、同步結果中之一項或多項。若操作指令集表中不包含所述用戶端2之會話表的序號,則所述查詢語句所要查詢之資料為第一次查詢。若操作指令集表中包含所述用戶端2之會話表的序號,則在所述會話表中,則根據所要查詢之資料確定所述資料對應之資料項目索引,並在會話表中查找是否包含所述資料項目索引,若不包含,則所述資料項目索引為第一次查詢。例如在表1操作指令集表中,會話表的序號一欄中之每個序號對應一個用戶端,電腦裝置1對於接受到之查詢語句首先在操作指令集表中查找是否存在與所述用戶端對應之會話表的序號。又如表2中所示,表2為會話表6中記錄之內容,所述會話表6用於記錄用戶端之查詢記錄,其中 記錄了用戶端更新過之資料資訊為:資料項目索引4,同步時間201906290925,同步結果為成功。若所述會話表中存在此次查詢資料對應之資料項目索引,則所要查詢之資料非第一次查詢,若不存在,則所要查詢之資料是第一次查詢。 For example, the computer device 1 searches the operation instruction set table to see whether the sequence number of the session table of the client 2 is included. The session table is used to record the query record of the client 2, and the content of the session table includes query data. One or more of the data item index, synchronization time, and synchronization results. If the operation instruction set table does not contain the serial number of the session table of the client 2, the data to be queried by the query statement is the first query. If the operation instruction set table contains the serial number of the session table of the client 2, then in the session table, determine the data item index corresponding to the data according to the data to be queried, and search in the session table whether it contains If the data item index is not included, the data item index is the first query. For example, in the operation instruction set table in Table 1, each serial number in the sequence number column of the session table corresponds to a client. For the received query statement, the computer device 1 first searches the operation instruction set table to see whether there is a link to the client. The sequence number of the corresponding session table. As shown in Table 2, Table 2 is the content recorded in the session table 6, which is used to record the query records of the client, where The data information updated by the client is recorded as: data item index 4, synchronization time 201906290925, and the synchronization result is successful. If the data item index corresponding to the query data exists in the session table, the data to be queried is not the first query. If it does not exist, the data to be queried is the first query.

Figure 108131975-A0305-02-0010-3
Figure 108131975-A0305-02-0010-3

步驟S3、若所述查詢之資料為第一次查詢,則輸出資料查詢結果。 Step S3: If the data being queried is the first query, output the data query results.

若所述查詢之資料為第一次查詢,所述步驟還可以包括:將所述查詢之資料之資料項目索引和所述查詢語句對應之操作類型添加到所述會話表中。 If the queried data is the first query, the step may further include: adding the data item index of the queried data and the operation type corresponding to the query statement to the conversation table.

舉例而言,電腦裝置1經過判斷所述所要查詢之資料是第一次查詢,則輸出資料查詢結果,並將所要查詢之資料之資料項目索引添加到所述用戶端2對應之會話表中,並在會話表中記錄此次同步資料之時間和同步結果。 For example, after determining that the data to be queried is the first query, the computer device 1 outputs the data query results and adds the data item index of the data to be queried to the session table corresponding to the client 2. And record the time and synchronization result of this synchronization data in the session table.

在本發明又一實施方式中,電腦裝置1經過判斷所述所要查詢之資料是第一次查詢,則輸出資料查詢結果,並將查詢之資料對應之資料項目索引一同發送給用戶端2。用戶端2接收所述查詢資料及所述資料之資料項目索引,並根據所述資料項目索引創建同步資訊狀態表;所述同步資訊狀態表包括:資料項目索引、同步時間、同步結果中之一項或多項。 In another embodiment of the present invention, after determining that the data to be queried is the first query, the computer device 1 outputs the data query results and sends the data item index corresponding to the queried data to the client 2 together. The client 2 receives the query data and the data item index of the data, and creates a synchronization information status table based on the data item index; the synchronization information status table includes one of: data item index, synchronization time, and synchronization result. item or multiple items.

用戶端2接收電腦裝置1發送之資料查詢結果,並將所述資料查詢結果更新在用戶端2之資料系統中。 The client 2 receives the data query results sent by the computer device 1, and updates the data query results in the data system of the client 2.

步驟S4、若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 Step S4: If the queried data is not queried for the first time, search the session table for the last synchronization time of the data item index, and determine at least one operation corresponding to the data item index based on the synchronization time. instructions, and output the operation instructions.

在本發明一實施方式中,若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定 與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令之步驟包括:根據所述同步時間在所述操作指令集表中之預設範圍中查找與所述資料項目索引對應之至少一條操作指令,其中所述預設範圍是指從所述同步時間到當前查詢時間之間與所述資料項目索引對應之操作指令;若所述資料項目索引對應之操作指令為一條,則將所述操作指令發送至用戶端;若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併後發送至用戶端。 In an embodiment of the present invention, if the queried data is not queried for the first time, the last synchronization time of the data item index is searched in the session table, and the determination is made based on the synchronization time. At least one operation instruction corresponding to the data item index, and the step of outputting the operation instruction includes: searching for an operation instruction corresponding to the data item index in a preset range in the operation instruction set table according to the synchronization time. At least one operation instruction, wherein the preset range refers to the operation instruction corresponding to the data item index from the synchronization time to the current query time; if there is one operation instruction corresponding to the data item index, then The operation instructions are sent to the user terminal; if there are multiple operation instructions corresponding to the data item index, the operation instructions are sorted and merged and then sent to the user terminal.

其中,若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併之步驟可以包括:提取與所述資料項目索引對應之多條操作指令,將所述多條操作指令按照時間順序進行排序;按照時間先後順序,將相鄰兩項操作類型相同之操作指令進行合併,所述操作類型包括刪除、添加、修改中之一項或多項。 Wherein, if there are multiple operation instructions corresponding to the data item index, the step of sorting and merging the operation instructions may include: extracting multiple operation instructions corresponding to the data item index, and combining the multiple operation instructions. The instructions are sorted in chronological order; two adjacent operation instructions with the same operation type are merged in chronological order, and the operation type includes one or more of deletion, addition, and modification.

一實施方式中,電腦裝置1解析結構化查詢語句之後判斷所述結構化查詢語句中查詢之資料為第二次查詢,根據所述查詢資料對應之資料項目索引在會話表中查找所述用戶端2上一次同步所述資料項目索引之同步時間,根據所述同步時間在操作指令集表中之資料項目索引中查詢所述資料項目索引自上一次同步時間到當前查詢時間之所有操作指令。例如電腦裝置1根據用戶端2所要查詢之資料項目索引3非第一次查詢,則在會話表中查詢所述資料項目索引3上次之同步時間為201905091008,則在操作指令集表中查找從2019年5月9日10點08分到當前查詢時間資料項目索引3對應之所有操作指令,所述資料項目索引3對應之操作指令如表3所示,並將所述操作時間按照時間順序進行排列,並對相同之操作類型之操作指令進行合併,例如在表3中,有兩條操作類型為“添加”之“操作指令”,將這兩條操作指令合併成一條。對所述 資料項目索引對應之操作指令整理合併完成之後,然後按照時間順序將所述操作指令和操作類型發送給用戶端。 In one embodiment, after parsing the structured query statement, the computer device 1 determines that the data queried in the structured query statement is the second query, and searches the client in the session table according to the data item index corresponding to the query data. 2. The synchronization time of the last synchronization of the data item index, and query all the operation instructions of the data item index from the last synchronization time to the current query time in the data item index in the operation instruction set table according to the synchronization time. For example, according to the data item index 3 that the client 2 wants to query, the computer device 1 queries the data item index 3 in the session table. The last synchronization time is 201905091008, and then searches the operation instruction set table from All operation instructions corresponding to data item index 3 from 10:08 on May 9, 2019 to the current query time. The operation instructions corresponding to data item index 3 are as shown in Table 3, and the operation times are performed in chronological order. Arrange and merge operation instructions of the same operation type. For example, in Table 3, there are two "operation instructions" with the operation type "add". Merge these two operation instructions into one. to the stated After the operation instructions corresponding to the data item index are sorted and merged, the operation instructions and operation types are then sent to the user in chronological order.

Figure 108131975-A0305-02-0012-4
Figure 108131975-A0305-02-0012-4

所述用戶端2接收電腦裝置1發送之所述合併整理後之一個或多個操作指令,並按照操作時間順序在用戶端2執行所述一個或多個操作指令,完成用戶端2中資料資訊之同步更新。 The user terminal 2 receives the merged and sorted one or more operation instructions sent by the computer device 1, and executes the one or more operation instructions in the user terminal 2 according to the operation time sequence to complete the data information in the user terminal 2 synchronized updates.

上述圖2詳細介紹了本發明之資料同步查詢方法,下面結合第3-4圖,對實現所述資料同步查詢方法之軟體裝置之功能模組以及實現所述資料同步查詢方法之硬體裝置架構進行介紹。 The above-mentioned Figure 2 introduces the data synchronization query method of the present invention in detail. The following is a description of the functional modules of the software device that implements the data synchronization query method and the hardware device architecture that implements the data synchronization query method with reference to Figures 3-4. Make an introduction.

應所述瞭解,所述實施例僅為說明之用,在專利申請範圍上並不受此結構之限制。 It should be understood that the above-described embodiments are for illustration only, and the scope of the patent application is not limited by this structure.

圖3為本發明資料同步查詢裝置較佳實施例之結構圖。 Figure 3 is a structural diagram of a preferred embodiment of the data synchronization query device of the present invention.

在一些實施例中,資料同步查詢裝置10運行於電腦裝置1中。所述電腦裝置1通過網路連接了多個用戶端2。所述資料同步查詢裝置10可以包括多個由程式碼段所組成之功能模組。所述資料同步查詢裝置10中之各個程式段之程式碼可以存儲於電腦裝置1之記憶體中,並由所述至少一個處理器所執行,以實現資料同步查詢功能。 In some embodiments, the data synchronization query device 10 runs in the computer device 1 . The computer device 1 is connected to multiple clients 2 through the network. The data synchronization query device 10 may include a plurality of functional modules composed of program code segments. The program codes of each program segment in the data synchronization query device 10 can be stored in the memory of the computer device 1 and executed by the at least one processor to implement the data synchronization query function.

本實施例中,所述資料同步查詢裝置10根據其所執行之功能,可以被劃分為多個功能模組。參閱圖3所示,所述功能模組可以包括:接收模組101、判斷模組102、第一執行模組103、第二執行模組104,本發明所稱之 模組是指一種能夠被至少一個處理器所執行並且能夠完成固定功能之一系列電腦程式段,其存儲在記憶體中。在本實施例中,關於各模組之功能將在後續之實施例中詳述。 In this embodiment, the data synchronization query device 10 can be divided into multiple functional modules according to the functions it performs. Referring to Figure 3, the functional module may include: a receiving module 101, a judgment module 102, a first execution module 103, and a second execution module 104, which are referred to in the present invention. A module refers to a series of computer program segments that can be executed by at least one processor and perform a fixed function, and are stored in memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

所述接收模組101用於接收用戶端發送之資料查詢語句。 The receiving module 101 is used to receive data query statements sent by the client.

在一實施方式中,所述查詢語句可以為結構化查詢語言。所述結構化查詢語言是一種資料庫查詢和程式設計語言,用於存取資料以及查詢、更新和管理關聯式資料庫系統。所述接收模組101接受用戶端2發送之查詢語句,可以逐條接收所述查詢語句,根據所述查詢語句查詢所要查詢之資料。 In one implementation, the query statement may be a structured query language. The structured query language is a database query and programming language used for accessing data and querying, updating and managing relational database systems. The receiving module 101 accepts the query statements sent by the client 2, can receive the query statements one by one, and query the data to be queried according to the query statements.

在一實施方式中,所述用戶端2也可以將所要查詢之多條資料資訊使用結構化查詢語言寫入查詢腳本中,使用查詢腳本可以一次查詢多條資料資訊。所述接收模組101可以接收所述用戶端2發送之使用結構化查詢語言編寫之查詢腳本。 In one implementation, the client 2 can also write multiple pieces of data information to be queried into a query script using structured query language. The query script can be used to query multiple pieces of data information at one time. The receiving module 101 can receive a query script written using structured query language sent by the client 2 .

判斷模組102用於判斷所述查詢語句所要查詢之資料是否為第一次查詢。 The judgment module 102 is used to judge whether the data to be queried by the query statement is the first query.

在一實施方式中,所述判斷模組102可對接收到之查詢語句之合法性進行檢查,如果判斷模組102認為所述查詢語句不符合語法規定會把這個錯誤資訊回饋給用戶端2。如果所述查詢語句合法,會對所述用戶端2之身份資訊進行判斷,判斷所述用戶端2是否具有訪問所述查詢語句對應之資料庫之許可權。並且對所述用戶端2之許可權範圍進行確認,確定所述用戶端2所能操作之資料範圍。如果所述用戶端2沒有所述查詢語句對應之資料庫許可權則會回饋用戶端2。 In one embodiment, the judgment module 102 can check the validity of the received query statement. If the judgment module 102 believes that the query statement does not comply with the grammatical requirements, the error information will be fed back to the user terminal 2 . If the query statement is legal, the identity information of the client 2 will be judged to determine whether the user terminal 2 has the permission to access the database corresponding to the query statement. And confirm the permission range of the client 2 to determine the data range that the client 2 can operate. If the client 2 does not have the database permission corresponding to the query statement, a feedback will be given to the client 2.

所述判斷模組102根據接收到之用戶端發送之查詢語句,判斷所述查詢語句中所要查詢之資料是否為第一次查詢之方法包括如下任意一種方式:在所述操作指令集表中查找是否包含所述用戶端2同步查詢記錄之會話表的序號; 若不包含所述用戶端2同步查詢記錄之會話表的序號,則判定所述查詢語句為第一次查詢;若包含所述用戶端2同步查詢記錄之會話表的序號,在所述會話表中查找是否包含所要查詢資料之資料項目索引,若不包含,則判定所述查詢語句為第一次查詢。 The determination module 102 determines whether the data to be queried in the query statement is the first query according to the received query statement sent by the client, including any of the following methods: searching in the operation instruction set table Whether it contains the sequence number of the session table of the synchronous query record of the client 2; If the sequence number of the session table of the synchronous query record of the client 2 is not included, the query statement is determined to be the first query; if the sequence number of the session table of the synchronous query record of the client 2 is included, the query statement is determined in the session table. Search whether the data item index of the data to be queried is included. If not, the query statement is determined to be the first query.

其中,所述資料項目索引為電腦裝置1為資料庫中之所有資料創建,電腦裝置1還為資料庫中之資料創建資料操作指令集表。所述操作指令集表包括:資料項目索引、操作時間、操作類型、操作指令、會話表的序號。所述資料操作指令集表如表1所示:

Figure 108131975-A0305-02-0014-5
The data item index is created by the computer device 1 for all the data in the database, and the computer device 1 also creates a data operation instruction set table for the data in the database. The operation instruction set table includes: data item index, operation time, operation type, operation instruction, and serial number of the session table. The data operation instruction set table is shown in Table 1:
Figure 108131975-A0305-02-0014-5

當所述資料庫中之資料有更新時,以所述資料之資料項目索引、操作類型、操作指令、操作時間生成一條更新記錄並添加到所述資料操作指令集表中。 When the data in the database is updated, an update record is generated based on the data item index, operation type, operation instruction, and operation time of the data and added to the data operation instruction set table.

舉例而言,所述判斷模組102在所述操作指令集表中查找是否包含用戶端2之會話表的序號,所述會話表用於記錄用戶端2之查詢記錄,所述會話表之內容包含查詢資料之資料項目索引、同步時間、同步結果中之一項或多項。若操作指令集表中不包含所述用戶端2之會話表的序號,則所述查詢語句所要查詢之資料為第一次查詢。若操作指令集表中包含所述用戶端2之會話表的序號,則在所述會話表中,則根據所要查詢之資料確定所述資料對應之資料項目索引,並在會話表中查找是否包含所述資料項目索引,若不包含,則所述資料項目索引為第一次查詢。例如在表1操作指令集表中,會話表的序號一欄中之每個序號對應一個用戶端,判斷模組102對於接受到之查詢語句首先在操作指令集表中查找是否存在與所述用戶端對應之會話表的序號。又如表2中所示,表2為會話表6中記錄之內容,所述會話表6用於記錄用戶端之查詢記錄,其中記錄了用戶端更新過之資料資訊為:資料項目索引4,同步時間201906290925,同步結果為成功。若所述會話表中存在此次查詢資料對應之資料項目索引,則所要查詢之資料非第一次查詢,若不存在,則所要查詢之資料是第一次查詢。 For example, the judgment module 102 searches the operation instruction set table to see whether the sequence number of the session table of the client 2 is included. The session table is used to record the query record of the client 2. The content of the session table Contains one or more of the data item index, synchronization time, and synchronization results of the query data. If the operation instruction set table does not contain the serial number of the session table of the client 2, the data to be queried by the query statement is the first query. If the operation instruction set table contains the serial number of the session table of the client 2, then in the session table, determine the data item index corresponding to the data according to the data to be queried, and search in the session table whether it contains If the data item index is not included, the data item index is the first query. For example, in the operation instruction set table in Table 1, each serial number in the sequence number column of the session table corresponds to a client. For the received query statement, the judgment module 102 first searches the operation instruction set table to see whether there is a link with the user. The serial number of the session table corresponding to the end. As shown in Table 2, Table 2 is the content recorded in the session table 6. The session table 6 is used to record the query records of the client. The data information updated by the client is recorded as: data item index 4, The synchronization time is 201906290925, and the synchronization result is successful. If the data item index corresponding to the query data exists in the session table, the data to be queried is not the first query. If it does not exist, the data to be queried is the first query.

Figure 108131975-A0305-02-0015-6
Figure 108131975-A0305-02-0015-6

第一執行模組103用於當所述查詢之資料為第一次查詢時,則並輸出資料查詢結果。 The first execution module 103 is used to output data query results when the data being queried is the first query.

若所述查詢之資料為第一次查詢,所述步驟還可以包括:將所述 查詢之資料之資料項目索引和所述查詢語句對應之操作類型添加到所述會話表中。 If the data being queried is the first query, the steps may also include: converting the The data item index of the queried data and the operation type corresponding to the query statement are added to the session table.

舉例而言,判斷模組103經過判斷所述所要查詢之資料是第一次查詢,則第一執行模組103輸出資料查詢結果,並將所要查詢之資料之資料項目索引添加到所述用戶端2對應之會話表中,並在會話表中記錄此次同步資料之時間和同步結果。 For example, after the judgment module 103 determines that the data to be queried is the first query, the first execution module 103 outputs the data query result and adds the data item index of the data to be queried to the client. 2 in the corresponding session table, and record the time and synchronization result of this synchronization data in the session table.

在本發明又一實施方式中,電腦裝置1經過判斷所述所要查詢之資料是第一次查詢,則輸出資料查詢結果,並將查詢之資料對應之資料項目索引一同發送給用戶端2。用戶端2接收所述查詢資料及所述資料之資料項目索引,並根據所述資料項目索引創建同步資訊狀態表;所述同步資訊狀態表包括:資料項目索引、同步時間、同步結果中之一項或多項。 In another embodiment of the present invention, after determining that the data to be queried is the first query, the computer device 1 outputs the data query results and sends the data item index corresponding to the queried data to the client 2 together. The client 2 receives the query data and the data item index of the data, and creates a synchronization information status table based on the data item index; the synchronization information status table includes one of: data item index, synchronization time, and synchronization result. item or multiple items.

用戶端2接收電腦裝置1發送之資料查詢結果,並將所述資料查詢結果更新在用戶端2之資料系統中。 The client 2 receives the data query results sent by the computer device 1, and updates the data query results in the data system of the client 2.

第二執行模組104用於當所述查詢之資料非第一次查詢時,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 The second execution module 104 is used to search the last synchronization time of the data item index in the session table when the queried data is not queried for the first time, and determine the data item index according to the synchronization time. Index corresponding to at least one operation instruction, and output the operation instruction.

在本發明一實施方式中,若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令之步驟包括:根據所述同步時間在所述操作指令集表中之預設範圍中查找與所述資料項目索引對應之至少一條操作指令,其中所述預設範圍是指從所述同步時間到當前查詢時間之間與所述資料項目索引對應之操作指令;若所述資料項目索引對應之操作指令為一條,則將所述操作指令發送至用戶端;若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理 合併後發送至用戶端。 In an embodiment of the present invention, if the queried data is not queried for the first time, the last synchronization time of the data item index is searched in the session table, and the data item index is determined based on the synchronization time. Corresponding to at least one operation instruction, and the step of outputting the operation instruction includes: searching for at least one operation instruction corresponding to the data item index in a preset range in the operation instruction set table according to the synchronization time, wherein The preset range refers to the operation instruction corresponding to the data item index from the synchronization time to the current query time; if there is one operation instruction corresponding to the data item index, the operation instruction is sent to Client; if there are multiple operation instructions corresponding to the data item index, organize the operation instructions Combined and sent to the client.

其中,若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併之步驟可以包括:提取與所述資料項目索引對應之多條操作指令,將所述多條操作指令按照時間順序進行排序;按照時間先後順序,將相鄰兩項操作類型相同之操作指令進行合併,所述操作類型包括刪除、添加、修改中之一項或多項。 Wherein, if there are multiple operation instructions corresponding to the data item index, the step of sorting and merging the operation instructions may include: extracting multiple operation instructions corresponding to the data item index, and combining the multiple operation instructions. The instructions are sorted in chronological order; two adjacent operation instructions with the same operation type are merged in chronological order, and the operation type includes one or more of deletion, addition, and modification.

一實施方式中,電腦裝置1解析結構化查詢語句之後判斷所述結構化查詢語句中查詢之資料為第二次查詢,根據所述查詢資料對應之資料項目索引在會話表中查找所述用戶端2上一次同步所述資料項目索引之同步時間,根據所述同步時間在操作指令集表中之資料項目索引中查詢所述資料項目索引自上一次同步時間到當前查詢時間之所有操作指令。例如電腦裝置1根據用戶端2所要查詢之資料項目索引3非第一次查詢,則在會話表中查詢所述資料項目索引3上次之同步時間為201905091008,則在操作指令集表中查找從2019年5月9日10點08分到當前查詢時間資料項目索引3對應之所有操作指令,所述資料項目索引3對應之操作指令如表3所示,並將所述操作時間按照時間順序進行排列,並對相同之操作類型之操作指令進行合併,例如在表3中,有兩條操作類型為“添加”之“操作指令”,將這兩條操作指令合併成一條。對所述資料項目索引對應之操作指令整理合併完成之後,然後按照時間順序將所述操作指令和操作類型發送給用戶端。 In one embodiment, after parsing the structured query statement, the computer device 1 determines that the data queried in the structured query statement is the second query, and searches the client in the session table according to the data item index corresponding to the query data. 2. The synchronization time of the last synchronization of the data item index, and query all the operation instructions of the data item index from the last synchronization time to the current query time in the data item index in the operation instruction set table according to the synchronization time. For example, according to the data item index 3 that the client 2 wants to query, the computer device 1 queries the data item index 3 in the session table. The last synchronization time is 201905091008, and then searches the operation instruction set table from All operation instructions corresponding to data item index 3 from 10:08 on May 9, 2019 to the current query time. The operation instructions corresponding to data item index 3 are as shown in Table 3, and the operation times are performed in chronological order. Arrange and merge operation instructions of the same operation type. For example, in Table 3, there are two "operation instructions" with the operation type "add". Merge these two operation instructions into one. After the operation instructions corresponding to the data item index are sorted and merged, the operation instructions and operation types are then sent to the user terminal in chronological order.

Figure 108131975-A0305-02-0017-7
Figure 108131975-A0305-02-0017-7
Figure 108131975-A0305-02-0018-8
Figure 108131975-A0305-02-0018-8

所述用戶端2接收電腦裝置1發送之所述合併整理後之一個或多個操作指令,並按照操作時間順序在用戶端2執行所述一個或多個操作指令,完成用戶端2中資料資訊之同步更新。 The user terminal 2 receives the merged and sorted one or more operation instructions sent by the computer device 1, and executes the one or more operation instructions in the user terminal 2 according to the operation time sequence to complete the data information in the user terminal 2 synchronized updates.

圖4為本發明電腦裝置較佳實施例之示意圖。 Figure 4 is a schematic diagram of a preferred embodiment of the computer device of the present invention.

所述電腦裝置1包括記憶體20、處理器30以及存儲在所述記憶體20中並可在所述處理器30上運行之電腦程式40,例如資料同步查詢程式。所述處理器30執行所述電腦程式40時實現上述資料同步查詢方法實施例中之步驟,例如圖2所示之步驟S1~S4。或者,所述處理器30執行所述電腦程式40時實現上述資料同步查詢裝置實施例中各模組/單元之功能,例如圖3中之單元101-104。 The computer device 1 includes a memory 20, a processor 30, and a computer program 40 stored in the memory 20 and executable on the processor 30, such as a data synchronization query program. When the processor 30 executes the computer program 40, the steps in the above embodiment of the data synchronization query method are implemented, such as steps S1 to S4 shown in Figure 2. Alternatively, when the processor 30 executes the computer program 40, it realizes the functions of each module/unit in the above embodiment of the data synchronization query device, such as the units 101-104 in Figure 3.

示例性之,所述電腦程式40可以被分割成一個或多個模組/單元,所述一個或者多個模組/單元被存儲在所述記憶體20中,並由所述處理器30執行,以完成本發明。所述一個或多個模組/單元可以是能夠完成特定功能之一系列電腦程式指令段,所述指令段用於描述所述電腦程式40在所述電腦裝置1中之執行過程。例如,所述電腦程式40可以被分割成圖3中之接收模組101、判斷模組102、第一執行模組103、第二執行模組104。各模組具體功能參見圖2中各模組具體功能描述。 For example, the computer program 40 may be divided into one or more modules/units, and the one or more modules/units are stored in the memory 20 and executed by the processor 30 , to complete the present invention. The one or more modules/units may be a series of computer program instruction segments capable of completing specific functions. The instruction segments are used to describe the execution process of the computer program 40 in the computer device 1 . For example, the computer program 40 can be divided into the receiving module 101, the judging module 102, the first execution module 103, and the second execution module 104 in FIG. 3 . For the specific functions of each module, please refer to the specific function description of each module in Figure 2.

所述電腦裝置1可以是桌上型電腦、筆記本、掌上型電腦及雲端伺服器等計算設備。本領域技術人員可以理解,所述示意圖僅僅是電腦裝置1之示例,並不構成對電腦裝置1之限定,可以包括比圖示更多或更少之部件,或者組合某些部件,或者不同之部件,例如所述電腦裝置1還可以包括輸入輸出設備、網路接入設備、匯流排等。 The computer device 1 may be a desktop computer, a notebook, a palmtop computer, a cloud server and other computing devices. Those skilled in the art can understand that the schematic diagram is only an example of the computer device 1 and does not constitute a limitation on the computer device 1. It may include more or less components than shown in the figure, or some components may be combined or different. Components, for example, the computer device 1 may also include input and output devices, network access devices, buses, etc.

所稱處理器30可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、 專用積體電路(Application Specific Integrated Circuit,ASIC)、現成可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者所述處理器30也可以是任何常規之處理器等,所述處理器30是所述電腦裝置1之控制中心,利用各種介面和線路連接整個電腦裝置1之各個部分。 The so-called processor 30 can be a central processing unit (Central Processing Unit, CPU), or other general-purpose processor, digital signal processor (Digital Signal Processor, DSP), Application Specific Integrated Circuit (ASIC), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general processor may be a microprocessor or the processor 30 may also be any conventional processor, etc. The processor 30 is the control center of the computer device 1 and is connected to the entire computer device 1 using various interfaces and lines. various parts.

所述記憶體20可用於存儲所述電腦程式40和/或模組/單元,所述處理器30通過運行或執行存儲在所述記憶體20內之電腦程式和/或模組/單元,以及調用存儲在記憶體20內之資料,實現所述電腦裝置1之各種功能。所述記憶體20可主要包括存儲程式區和存儲資料區,其中,存儲程式區可存儲作業系統、至少一個功能所需之應用程式(比如聲音播放功能、圖像播放功能等)等;存儲資料區可存儲根據電腦裝置1之使用所創建之資料(比如音訊資料、電話本等)等。此外,記憶體20可以包括高速隨機存取記憶體,還可以包括非易失性記憶體,例如硬碟、記憶體、插接式硬碟,智慧存儲卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃記憶體卡(Flash Card)、至少一個磁碟記憶體件、快閃記憶體器件、或其他易失性固態記憶體件。 The memory 20 can be used to store the computer program 40 and/or module/unit, and the processor 30 runs or executes the computer program and/or module/unit stored in the memory 20, and The data stored in the memory 20 is called to realize various functions of the computer device 1 . The memory 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; and a storage data area. The area can store data created based on the use of the computer device 1 (such as audio data, phone books, etc.). In addition, the memory 20 may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), at least one disk memory device, flash memory device, or other volatile solid-state memory device.

所述電腦裝置1集成之模組/單元如果以軟體功能單元之形式實現並作為獨立之產品銷售或使用時,可以存儲在一個電腦可讀取存儲介質中。基於這樣之理解,本發明實現上述實施例方法中之全部或部分流程,也可以通過電腦程式來指令相關之硬體來完成,所述之電腦程式可存儲於一電腦可讀存儲介質中,所述電腦程式在被處理器執行時,可實現上述各個方法實施例之步驟。其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可執行檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼之任何實體或裝置、記錄介質、U盤、移動硬碟、磁碟、光碟、電腦記憶體、唯讀記憶體(ROM,Read-Only Memory)、隨機存取記憶體(RAM,Random Access Memory)、電載波信號、電信信號 以及軟體分發介質等。需要說明之是,所述電腦可讀介質包含之內容可以根據司法管轄區內立法和專利實踐之要求進行適當之增減,例如在某些司法管轄區,根據立法和專利實踐,電腦可讀介質不包括電載波信號和電信信號。 If the integrated modules/units of the computer device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the above embodiment methods by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, so When the computer program is executed by the processor, the steps of each of the above method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in the form of original program code, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, mobile hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-only memory). Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunications signal and software distribution media, etc. It should be noted that the content contained in the computer-readable medium can be appropriately added or deleted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium Excludes electrical carrier signals and telecommunications signals.

在本發明所提供之幾個實施例中,應所述理解到,所揭露之電腦裝置和方法,可以通過其它之方式實現。例如,以上所描述之電腦裝置實施例僅僅是示意性之,例如,所述單元之劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外之劃分方式。 In the several embodiments provided by the present invention, it should be understood that the disclosed computer device and method can be implemented in other ways. For example, the computer device embodiments described above are only illustrative. For example, the division of units is only a logical function division, and there may be other division methods in actual implementation.

另外,在本發明各個實施例中之各功能單元可以集成在相同處理單元中,也可以是各個單元單獨物理存在,也可以兩個或兩個以上單元集成在相同單元中。上述集成之單元既可以採用硬體之形式實現,也可以採用硬體加軟體功能模組之形式實現。 In addition, each functional unit in various embodiments of the present invention can be integrated in the same processing unit, or each unit can exist physically alone, or two or more units can be integrated in the same unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of hardware plus software function modules.

對於本領域技術人員而言,顯然本發明不限於上述示範性實施例之細節,而且在不背離本發明之精神或基本特徵之情況下,能夠以其他之具體形式實現本發明。因此,無論從哪一點來看,均應將實施例看作是示範性之,而且是非限制性之,本發明之範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項之等同要件之含義和範圍內之所有變化涵括在本發明內。不應將請求項中之任何附圖標記視為限制所涉及之請求項。此外,顯然“包括”一詞不排除其他單元或步驟,單數不排除複數。電腦裝置請求項中陳述之多個單元或電腦裝置也可以由同一個單元或電腦裝置通過軟體或者硬體來實現。第一,第二等詞語用來表示名稱,而並不表示任何特定之順序。 It is obvious to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, from any point of view, the embodiments should be regarded as illustrative and non-restrictive. The scope of the present invention is defined by the appended claims rather than the above description, and it is therefore intended that those falling within the claims All changes within the meaning and scope of the equivalent elements are included in the present invention. Any reference signs in a claim shall not be construed as limiting the claim involved. Furthermore, it is clear that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Multiple units or computer devices stated in the computer device request may also be implemented by the same unit or computer device through software or hardware. Words such as first and second are used to indicate names and do not indicate any specific order.

最後應說明之是,以上實施例僅用以說明本發明之技術方案而非限制,儘管參照較佳實施例對本發明進行了詳細說明,本領域之普通技術人員應當理解,可以對本發明之技術方案進行修改或等同替換,而不脫離本發明技術方案之精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not limiting. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art will understand that the technical solutions of the present invention can be modified. Modifications or equivalent substitutions may be made without departing from the spirit and scope of the technical solution of the present invention.

Claims (8)

一種資料同步查詢方法,應用於資料同步查詢裝置中,所述資料同步查詢裝置為資料庫中之資料創建資料項目索引以及操作指令集表,所述操作指令集表包括:資料項目索引、操作時間、操作類型、操作指令、會話表的序號,所述方法包括:接收用戶端發送之資料查詢語句;基於所述會話表的序號,判斷所述查詢語句所要查詢之資料是否為第一次查詢,其中,所述會話表用於存儲用戶端之同步查詢記錄;所述會話表之內容包括:資料項目索引、同步時間、同步結果中之一項或多項;所述基於所述會話表的序號,判斷所述查詢語句所要查詢之資料是否為第一次查詢之方法包括如下任意一種方式:在所述操作指令集表中查找是否包含所述用戶端同步查詢記錄之會話表的序號;若不包含所述用戶端同步查詢記錄之會話表的序號,則判定所述查詢語句為第一次查詢;若包含所述用戶端同步查詢記錄之會話表的序號,在所述會話表中查找是否包含所要查詢是資料之資料項目索引,若不包含,則判定所述查詢語句為第一次查詢;若所述查詢之資料為第一次查詢,則輸出資料查詢結果;及若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 A data synchronization query method is applied to a data synchronization query device. The data synchronization query device creates a data item index and an operation instruction set table for the data in the database. The operation instruction set table includes: data item index, operation time , operation type, operation instruction, and the serial number of the session table. The method includes: receiving the data query statement sent by the client; based on the serial number of the session table, judging whether the data to be queried by the query statement is the first query, Wherein, the session table is used to store synchronization query records of the user end; the content of the session table includes: one or more of data item index, synchronization time, and synchronization results; the sequence number based on the session table, The method for determining whether the data to be queried by the query statement is the first query includes any of the following methods: searching in the operation instruction set table whether the serial number of the session table containing the user-end synchronization query record is included; if it does not include If the serial number of the session table recorded by the client's synchronous query is determined, the query statement is determined to be the first query; if the serial number of the session table recorded by the client's synchronous query is included, the session table is searched to see whether it contains the desired query. The query is the data item index of the data. If it is not included, it is determined that the query statement is the first query; if the data queried is the first query, the data query results are output; and if the data queried is not In the first query, the last synchronization time of the data item index is searched in the session table, at least one operation instruction corresponding to the data item index is determined based on the synchronization time, and the operation instruction is output. 如請求項1所述之資料同步查詢方法,其中,所述方法還包括:當所述資料庫中之資料有更新時,以所述資料之資料項目索引、操作類型、操作指令、操作時間生成一條更新記錄並添加到所述資料操作指令集表中。 The data synchronization query method as described in request item 1, wherein the method also includes: when the data in the database is updated, generate a data based on the data item index, operation type, operation instruction, and operation time of the data. An update record is added to the data operation instruction set table. 如請求項1所述之資料同步查詢方法,其中,若所述查詢之資料為第一次查詢,所述步驟還包括: 將所述查詢之資料之資料項目索引和所述查詢語句對應之操作類型添加到所述會話表中。 The data synchronization query method as described in request item 1, wherein if the data being queried is the first query, the steps further include: Add the data item index of the queried data and the operation type corresponding to the query statement to the session table. 如請求項1所述之資料同步查詢方法,其中,若所述查詢之資料非第一次查詢,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令之步驟包括:根據所述同步時間在所述操作指令集表中之預設範圍中查找與所述資料項目索引對應之至少一條操作指令,其中所述預設範圍是指從所述同步時間到當前查詢時間之間與所述資料項目索引對應之操作指令;若所述資料項目索引對應之操作指令為一條,則將所述操作指令發送至用戶端;及若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併後發送至用戶端。 The data synchronization query method as described in request item 1, wherein if the data being queried is not the first query, the last synchronization time of the data item index is searched in the session table, and is determined based on the synchronization time. At least one operation instruction corresponding to the data item index, and the step of outputting the operation instruction includes: searching for an operation instruction corresponding to the data item index in a preset range in the operation instruction set table according to the synchronization time. At least one operation instruction, wherein the preset range refers to the operation instruction corresponding to the data item index from the synchronization time to the current query time; if there is one operation instruction corresponding to the data item index, then The operation instructions are sent to the user terminal; and if there are multiple operation instructions corresponding to the data item index, the operation instructions are sorted and merged and then sent to the user terminal. 如請求項4所述之資料同步查詢方法,其中,若所述資料項目索引對應之操作指令為多條,則將所述操作指令進行整理合併之步驟包括:提取與所述資料項目索引對應之多條操作指令,將所述多條操作指令按照時間順序進行排序;按照時間先後順序,將相鄰兩項操作類型相同之操作指令進行合併,所述操作類型包括刪除、添加、修改中之一項或多項。 The data synchronization query method described in claim 4, wherein if there are multiple operation instructions corresponding to the data item index, the step of sorting and merging the operation instructions includes: extracting the operation instructions corresponding to the data item index. Multiple operation instructions are sorted in chronological order; two adjacent operation instructions with the same operation type are merged in chronological order, and the operation type includes one of deletion, addition, and modification. item or multiple items. 一種資料同步查詢裝置,所述裝置包括:接收模組,用於接收用戶端發送之資料查詢語句;判斷模組,用於基於所述會話表的序號,判斷所述查詢語句所要查詢之資料是否為第一次查詢,其中,所述會話表用於存儲用戶端之同步查詢記錄;所述會話表之內容包括:資料項目索引、同步時間、同步結果中之一項或多項; 所述基於所述會話表的序號,判斷所述查詢語句所要查詢之資料是否為第一次查詢之方法包括如下任意一種方式:在所述操作指令集表中查找是否包含所述用戶端同步查詢記錄之會話表的序號;若不包含所述用戶端同步查詢記錄之會話表的序號,則判定所述查詢語句為第一次查詢;若包含所述用戶端同步查詢記錄之會話表的序號,在所述會話表中查找是否包含所要查詢是資料之資料項目索引,若不包含,則判定所述查詢語句為第一次查詢;第一執行模組,用於當所述查詢之資料為第一次查詢時,則並輸出資料查詢結果;及第二執行模組,用於當所述查詢之資料非第一次查詢時,則在會話表中查找所述資料項目索引上一次之同步時間,及根據所述同步時間確定與所述資料項目索引對應之至少一條操作指令,並輸出所述操作指令。 A data synchronization query device, the device includes: a receiving module, used to receive a data query sentence sent by the client; a judgment module, used to judge whether the data to be queried by the query sentence is based on the serial number of the session table It is the first query, wherein the session table is used to store the synchronization query record of the client; the content of the session table includes: one or more of data item index, synchronization time, and synchronization result; The method of determining whether the data to be queried by the query statement is the first query based on the serial number of the session table includes any of the following methods: searching in the operation instruction set table whether the client synchronization query is included The serial number of the recorded session table; if it does not contain the serial number of the session table recorded by the client's synchronous query, then it is determined that the query statement is the first query; if it contains the serial number of the session table recorded by the client's synchronous query, Search the session table to see whether the data item index of the data to be queried is included. If not, determine that the query statement is the first query; the first execution module is used when the data of the query is the first query. When querying once, the data query results are output; and the second execution module is used to search the last synchronization time of the data item index in the session table when the data being queried is not the first query. , and determine at least one operation instruction corresponding to the data item index according to the synchronization time, and output the operation instruction. 一種電腦裝置,其中所述電腦裝置包括處理器及記憶體,所述處理器用於執行記憶體中存儲之電腦程式時實現如請求項1至5任一項所述之資料同步查詢方法。 A computer device, wherein the computer device includes a processor and a memory, and the processor is used to implement the data synchronization query method described in any one of claims 1 to 5 when executing a computer program stored in the memory. 一種電腦存儲介質,其上存儲有電腦程式,其中所述電腦程式被處理器執行時實現如請求項1至5中任一項所述之資料同步查詢方法。 A computer storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the data synchronization query method described in any one of claims 1 to 5 is implemented.
TW108131975A 2019-08-22 2019-09-04 Data synchronous query method, device, computer device and storage medium TWI816875B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910780749.5A CN112416924A (en) 2019-08-22 2019-08-22 Data synchronous query method and device, computer device and storage medium
CN201910780749.5 2019-08-22

Publications (2)

Publication Number Publication Date
TW202109307A TW202109307A (en) 2021-03-01
TWI816875B true TWI816875B (en) 2023-10-01

Family

ID=74779494

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108131975A TWI816875B (en) 2019-08-22 2019-09-04 Data synchronous query method, device, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN112416924A (en)
TW (1) TWI816875B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199881A (en) * 2014-08-21 2014-12-10 广州华多网络科技有限公司 Database cluster, data query method and data synchronism method and device
CN104488248B (en) * 2014-04-15 2017-09-08 华为技术有限公司 A kind of file synchronisation method, server and terminal
TW201804346A (en) * 2016-07-04 2018-02-01 阿里巴巴集團服務有限公司 Data modification request processing method and apparatus for database
US20180225353A1 (en) * 2015-11-26 2018-08-09 Huawei Technologies Co., Ltd. Distributed Database Processing Method and Device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104488248B (en) * 2014-04-15 2017-09-08 华为技术有限公司 A kind of file synchronisation method, server and terminal
CN104199881A (en) * 2014-08-21 2014-12-10 广州华多网络科技有限公司 Database cluster, data query method and data synchronism method and device
US20180225353A1 (en) * 2015-11-26 2018-08-09 Huawei Technologies Co., Ltd. Distributed Database Processing Method and Device
TW201804346A (en) * 2016-07-04 2018-02-01 阿里巴巴集團服務有限公司 Data modification request processing method and apparatus for database

Also Published As

Publication number Publication date
TW202109307A (en) 2021-03-01
CN112416924A (en) 2021-02-26

Similar Documents

Publication Publication Date Title
US10482067B2 (en) Synchronization of shared folders and files
US20200356624A1 (en) Collaborative document editing system and method
TWI472934B (en) Method, article, and apparatus for cross-synchronization of data
US9563679B2 (en) Adaptive warehouse data validation tool
CN108334609B (en) Method, device, equipment and storage medium for realizing JSON format data access in Oracle
US20140372369A1 (en) Managing Changes to Shared Electronic Documents Using Change History
CN111143382B (en) Data processing method, system and computer readable storage medium
CN109902114B (en) ES cluster data multiplexing method, system, computer device and storage medium
US20100076937A1 (en) Feed processing
CN111562885A (en) Data processing method and device, computer equipment and storage medium
CN111752939A (en) Data processing method, device, computer system and medium for multiple systems
CN112559913B (en) Data processing method, device, computing equipment and readable storage medium
CN102737082A (en) Method and system for dynamically updating file data indexes
TWI816875B (en) Data synchronous query method, device, computer device and storage medium
CN107562790B (en) Method and system for realizing batch warehousing of data processing
CN115113989B (en) Transaction execution method, device, computing equipment and storage medium
CN111324614B (en) Table configuration method and device, terminal equipment and storage medium
CN114253922A (en) Resource directory management method, resource management method, device, equipment and medium
US20210141791A1 (en) Method and system for generating a hybrid data model
CN113268483A (en) Request processing method and device, electronic equipment and storage medium
CN112307061A (en) Method and device for querying data
CN113190236B (en) HQL script verification method and device
CN114510534B (en) Data synchronization method, device, equipment and storage medium
CN113760860B (en) Data reading method and device
CN109635172B (en) Online document retrieval method and device and electronic equipment