Data updating method and device, computer device, and storage medium

By creating an operation log table in the database and using triggers to monitor data table operations, the problem of database system updates depending on multiple tools and complex deployments under specific conditions is solved, enabling real-time updates and adjustments of database data.

CN116701422BActive Publication Date: 2026-07-31SHENZHEN FULIN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN FULIN TECH CO LTD
Filing Date
2023-06-19
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Database systems require specific conditions to update data and rely on multiple tools, resulting in complex deployment and inconvenient operation.

Method used

By creating an operation log table with the same structure as the source data table and adding an information record column to the operation log table, triggers are used to monitor the operation behavior of the data table, detect inactive time, obtain and write operation information, and realize real-time data updates.

Benefits of technology

Data updates and adjustments were achieved without stopping the database, eliminating the need to read operation logs and call synchronization tools, thus simplifying the deployment process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116701422B_ABST
    Figure CN116701422B_ABST
Patent Text Reader

Abstract

This application belongs to the field of data processing and relates to a data update method, including: obtaining a source data table; creating an operation log table with the same structure as the source data table and adding an information record column to the operation log table; obtaining a data identifier corresponding to the source data table; extracting data from the source data table based on the data identifier to obtain initial data; monitoring the operation behavior of the source data table according to a preset trigger and writing the monitored operation information into the operation log table; obtaining the no-operation time when no operation information is written to the operation log table and detecting whether the no-operation time is greater than or equal to a preset judgment value; and if the no-operation time is greater than or equal to the judgment value, reading the operation information from the operation log table and performing corresponding data operations on the initial data according to the operation information to obtain real-time data. This application also provides a data update device, equipment, and storage medium. This application can conveniently and effectively update data in a database.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a data updating method, apparatus, computer equipment, and storage medium. Background Technology

[0002] In software development, responding to rapidly changing business requirements inevitably involves frequent adjustments to the business model. These adjustments lead to frequent updates to the database table structure and even recalculation of data. When the data format or structure in the data source changes, it is necessary to update the data table structure and data to ensure proper data storage and processing.

[0003] In databases, adjustments to business models are typically achieved through data insertion, deletion, and modification operations. First, the target data table needs to be obtained. Then, a synchronization table is created based on the target data table, and the data from the target data table is extracted into the synchronization table. Next, the operation logs of the target data table are retrieved, and the corresponding operations are performed on the data in the synchronization table based on the operation information recorded in the logs to complete the data adjustment and update of the target data table.

[0004] However, the aforementioned data adjustment and update processes can only be performed with the database service stopped. Furthermore, they require reading the operation logs automatically generated by the database when operations are performed on the target table and rely on specific synchronization tools. For example, in the DM database, the DMHS tool is required to synchronize the target table with the target table. In short, the above data adjustment and update processes involve complex deployment, numerous dependent tools, and the need to be completed under specific conditions, causing inconvenience to the operation of the database system. Summary of the Invention

[0005] The purpose of this application is to propose a data update method, apparatus, computer equipment, and storage medium to solve the problems of database systems needing to be updated under specific conditions, relying on too many tools, and having complex deployment.

[0006] To address the aforementioned technical problems, this application provides a data update method, employing the following technical solution:

[0007] Obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table;

[0008] Obtain the data identifier corresponding to the source data table, and extract data from the source data table based on the data identifier to obtain the initial data;

[0009] The operation behavior of the source data table is monitored according to a preset trigger, and the operation information obtained by the monitoring is written into the operation log table;

[0010] Obtain the no-operation time when the operation information is not written to the operation log table, and detect whether the no-operation time is greater than or equal to a preset judgment value;

[0011] If the inactivity time is greater than or equal to the judgment value, then the operation information in the operation log table is read, and corresponding data operations are performed on the initial data according to the operation information to obtain real-time data; and

[0012] If the inactivity time is less than the judgment value, the operation information is continuously acquired and written into the information record column until the inactivity time is greater than or equal to the judgment value or the trigger stops listening.

[0013] Furthermore, the information record column includes: a data identifier column, an operation type column, and an auto-increment column. The steps of obtaining the source data table, creating an operation log table with the same structure as the source data table, and adding information record columns to the operation log table specifically include:

[0014] The source data table is retrieved from the database using a query statement;

[0015] Obtain the attribute information of the source data table, and create the operation log table based on the attribute information; and

[0016] Insert the data identifier column, the operation type column, and the auto-increment column into the predetermined positions in the operation log table.

[0017] Furthermore, the data identifier is ROWID. The step of obtaining the data identifier corresponding to the source data table and extracting data from the source data table based on the data identifier to obtain the initial data specifically includes:

[0018] Query all source data and their corresponding ROWIDs in the source data table;

[0019] Obtain the recording time of the ROWID, and sort the source data according to the order of the recording time to generate a data sorting table; and

[0020] Select all source data in the data sorting table and extract the selected source data to obtain the initial data.

[0021] Furthermore, after the steps of obtaining the record time of the ROWID and sorting the source data according to the record time to generate a data sorting table, the following steps are also included:

[0022] Select the last data point in the data sorting table that is closest to the current time, and record the last data point as the data extraction point;

[0023] Obtain the time information corresponding to the data extraction point, and save the data extraction point and the time information to a predetermined archive location in the database.

[0024] Furthermore, the operation log table includes: a data column and an information record column. The step of monitoring the operation behavior of the source data table according to a preset trigger and writing the monitored operation information into the operation log table specifically includes:

[0025] Obtain preset setting information, and set the execution logic of the trigger according to the setting information;

[0026] Add the trigger to the source data table and obtain the trigger event information recorded by the trigger in real time;

[0027] Based on the trigger event information, corresponding operation information is obtained, wherein the operation information includes: operation data, operation behavior type, and operation data identifier; and

[0028] The operation behavior type and the operation data identifier are recorded in the information record column, and the operation data is written into the data column.

[0029] Furthermore, the step of obtaining the no-operation time when the operation information is not written to the operation log table specifically includes:

[0030] Detect whether the operation information is continuously written to the operation log table;

[0031] If the operation information is not continuously written to the operation log table, then the time during which the operation information is not written to the operation log table is recorded, and this time is taken as the no-operation time, until the operation information starts being written to the operation log table again or the trigger stops listening.

[0032] If the operation information is continuously written to the operation log table, then confirm whether the operation information has been successfully written, until the operation information is no longer continuously written to the operation log table or the trigger stops listening.

[0033] Furthermore, the operation information includes: operation data, operation behavior type, and operation data identifier. The step of performing corresponding data operations on the initial data according to the operation information specifically includes:

[0034] Identify the operation behavior type corresponding to the operation information, wherein the operation behavior type includes: data addition, data deletion, and data update;

[0035] Obtain the operation data and the operation data identifier; compare the initial data with the operation data and the operation data identifier to obtain a comparison result; and

[0036] Based on the comparison results, perform data operations corresponding to the data addition, data deletion, and data update on the initial data.

[0037] To address the aforementioned technical problems, embodiments of this application also provide a data updating device, comprising:

[0038] The log table creation module is used to obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table;

[0039] The data extraction module is used to obtain the data identifier corresponding to the source data table, and extract data from the source data table according to the data identifier to obtain initial data;

[0040] An operation monitoring module is used to monitor the operation behavior of the source data table according to a preset trigger, and write the operation information obtained by the monitoring into the operation log table;

[0041] The change detection module is used to obtain the no-operation time when the operation information is not written to the operation log table, and to detect whether the no-operation time is greater than or equal to a preset judgment value.

[0042] The first operation execution module is configured to, if the inactivity time is greater than or equal to the judgment value, read the operation information from the operation log table, perform corresponding data operations on the initial data according to the operation information, and obtain real-time data; and

[0043] The second operation execution module is used to continuously acquire the operation information and write it into the information record column if the no-operation time is less than the judgment value, until the no-operation time is greater than or equal to the judgment value or the trigger stops listening.

[0044] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution:

[0045] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data update method described above.

[0046] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below:

[0047] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the data update method described above.

[0048] Compared with the prior art, the embodiments of this application have the following main advantages:

[0049] This application creates an operation log table with the same structure as the source data table, adds an information record column to the operation log table, and obtains the data identifier corresponding to the source data in the source data table. This allows for effective data extraction from the source data table to obtain initial data with the same content as the source data table in its current state. Triggers are set to monitor the operation behavior of the source data table, effectively acquiring operation information and writing it to the data and information record columns of the operation log table. The inactivity time before operation information is written to the operation log table is detected to determine whether the current operation information has been extracted. When the operation information extraction is complete, corresponding data operations are performed on the initial data based on the operation information, thereby completing the data adjustment and update to obtain real-time data. This application effectively enables data updates and adjustments to the database without stopping database operation, and without reading the data table's operation log or calling database synchronization tools. Attached Figure Description

[0050] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0051] Figure 1 A flowchart of an embodiment of the data update method according to this application;

[0052] Figure 2 yes Figure 1 A flowchart of a specific implementation of step S10;

[0053] Figure 3 yes Figure 1 A flowchart of a specific implementation of step S20;

[0054] Figure 4 yes Figure 1 A flowchart of a specific implementation of step S30;

[0055] Figure 5 yes Figure 1 A flowchart of a specific implementation of step S40;

[0056] Figure 6 yes Figure 1 A flowchart of a specific implementation of step S50;

[0057] Figure 7 This is a schematic diagram of one embodiment of the data update apparatus according to this application;

[0058] Figure 8 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation

[0059] 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 application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.

[0060] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0061] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0062] refer to Figure 1 A flowchart of an embodiment of the data update method according to this application is shown. The data update method includes the following steps:

[0063] Step S10: Obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table;

[0064] Step S20: Obtain the data identifier corresponding to the source data table, and extract data from the source data table according to the data identifier to obtain initial data;

[0065] Step S30: Monitor the operation behavior of the source data table according to the preset trigger, and write the monitored operation information into the operation log table;

[0066] Step S40: Obtain the no-operation time when the operation information is not written to the operation log table, and detect whether the no-operation time is greater than or equal to a preset judgment value;

[0067] Step S50: If the inactivity time is greater than or equal to the judgment value, then read the operation information from the operation log table, and perform corresponding data operations on the initial data according to the operation information to obtain real-time data; and

[0068] Step S60: If the no-operation time is less than the judgment value, the operation information is continuously acquired and written into the information record column until the no-operation time is greater than or equal to the judgment value or the trigger stops listening.

[0069] In this embodiment, when data updates are no longer required, the corresponding trigger can be deleted to stop the trigger from listening. This indicates that the system has stopped updating data and therefore no longer continuously writes operation information into the information record column.

[0070] This embodiment creates an operation log table with the same structure as the source data table, adds an information record column to the operation log table, and obtains the data identifier corresponding to the source data in the source data table. This effectively extracts data from the source data table to obtain initial data with the same content as the source data table in the current state. Triggers are set to monitor the operation behavior of the source data table, thereby effectively obtaining operation information and writing it into the data columns and information record columns of the operation log table. The system detects the inactivity time when operation information is not written to the operation log table to identify whether the current operation information has been extracted. When the operation information extraction is complete, corresponding data operations are performed on the initial data according to the operation information, thereby completing the data adjustment and update to obtain real-time data. This embodiment can be applied to the DMHS database, effectively enabling data updates and adjustments to the database without stopping database operation or reading the data table's operation log or calling the DMHS tool.

[0071] In this embodiment, since the data objects extracted from the database are different each time during implementation, the corresponding source data table is also different. The source data table is queried using SQL statements. After querying the source data table, this embodiment creates an operation log table with the same structure as the source data table using a query-based table creation method. Custom information record columns, including data identifier columns, operation type columns, and auto-increment columns, are added to the operation log table according to preset addition columns. This facilitates the effective extraction of data identifier data and operation type data during subsequent operations. Furthermore, the auto-increment column allows for customized limitation of the data objects extracted and updated, thereby effectively controlling system memory usage.

[0072] This embodiment is primarily applied to the DM database, but can also be applied to Oracle databases. In these databases, the source data table consists of several basic data tables stored in the database. These basic data tables contain data categorized according to table attributes. For example, a sales data record table might contain columns such as sales amount, customer name, customer gender, customer marital status, and customer contact information. The sales data record table contains columns with fixed formats and data content, while rows are distinguished by numbers or column numbers. In this embodiment, the format and table attributes of the source data table are copied through a query-based table creation method. A DML log table is then generated to record data insertion, deletion, and updates in the source data table. This DML log table is monitored by triggers that record the operation behavior. The information record columns are mainly added to the last few columns of the attribute columns in this DML table.

[0073] In this embodiment, the data identifier is ROWID in the DM database. ROWID is a unique identifier for a physical record row in the DM database base table; it is incrementing and will not be repeated. When a record is added to table A and then deleted, the ROWID corresponding to that record will not be used by other record rows. It can be queried and used as a WHERE condition when updating record rows, but it cannot be updated or deleted. Since ROWID is a pseudo-column, the column containing ROWID will not appear in the data table. In this embodiment, the ROWID in the source data table is mainly obtained by monitoring the source data table through a custom trigger. By monitoring the trigger, the ROWID corresponding to the data can be queried and obtained when the data in the source data table changes, thus preventing errors when updating the data accordingly and improving the reliability of the method.

[0074] A trigger is defined as an action the database should take when certain database-related events occur. These events include data insertion, deletion, and update operations on global objects, a specific schema within the database, and a source table within that schema. When these operations occur on the monitored source table, the trigger is automatically and implicitly activated by the server. Therefore, regardless of whether the operation is completed, the trigger automatically generates corresponding operation information. Triggers are categorized into table triggers, event triggers, and time triggers. Table triggers are triggered by operations on data within a table; event triggers are triggered by operations on database objects; and time triggers are a special type of event trigger. In this embodiment, a table trigger is used.

[0075] Continue to refer to Figure 2 The flowchart of a specific embodiment of step S10 is shown, which includes the following steps:

[0076] Step S101: Query the source data table in the database using a query statement;

[0077] Step S102: Obtain the attribute information of the source data table, and create the operation log table based on the attribute information; and

[0078] Step S103: Insert the data identifier column, the operation type column, and the auto-increment column into the predetermined positions in the operation log table.

[0079] This embodiment creates an operation log table by querying the source data table and based on its attribute information. This creates an operation log table with the same format and table attributes as the source data table. Custom information record columns are then added to this operation log table to facilitate subsequent viewing of the data and operation types corresponding to the information recorded in the information record columns.

[0080] In this embodiment, the data identifier is ROWID. Since ROWID is a pseudo-column, it can only be used for querying and cannot be inserted, updated, or deleted. The data identifier ROWID is used to identify the unique key value of each record in the database base table, identifying the exact storage location of the data record. ROWID consists of 18 characters: "4-digit site number + 6-digit partition number + 8-digit physical row number". For a single-machine table, the 4-digit site number is AAAA, i.e., 0. For a non-partitioned table, the 6-digit partition number is AAAAAA, i.e., 0. When querying ROWID, if a FOR UPDATE statement is added, the data row will be locked to prevent other users from modifying the data, ensuring consistency between queries and updates.

[0081] In this embodiment, the auto-increment column is mainly used to restrict the data in the operation log table. The DM database provides two auto-increment methods: IDENTITY auto-increment column and AUTO_INCREMENT auto-increment column. This embodiment uses the IDENTITY auto-increment column. The IDENTITY auto-increment column includes a seed and an increment. Before using this auto-increment column, both the seed value and the increment value must be specified for it to execute effectively. When neither the seed value nor the increment value is specified, both the seed value and the increment value default to 1. The seed value and increment value cannot be decimals; if decimals are present, an error will occur, and the auto-increment column will not execute.

[0082] When the seed value and increment value of the auto-increment column are determined, the maximum and minimum values ​​of the auto-increment column must also be set. When the value of the auto-increment column exceeds the maximum value, the auto-increment column will no longer be automatically generated, and an error will be reported. For example, if the seed value of the auto-increment column is 1, it means that when the first data record is recorded, the numbering will start from 1. If the increment value is 2, it means that the corresponding number for the next data record will be 1+2, i.e., number 3, and the next data record will be number 5, and so on. If the maximum value is set to 100, when the numbering reaches 99, the auto-increment column cannot be generated when the next data is recorded, and an error will be reported, preventing the recording of the next column of data. At the same time, once the auto-increment column is generated, users are not allowed to update it to ensure the validity of the auto-increment column. By setting the auto-increment column, the amount of data acquired can be effectively limited. In this embodiment, the values ​​related to the auto-increment column can be adjusted according to the actual situation.

[0083] Continue to refer to Figure 3 The flowchart illustrates a specific embodiment of step S20, which includes the following steps:

[0084] Step S201: Query all source data and the corresponding ROWID in the source data table;

[0085] Step S202: Obtain the recording time of the ROWID, and sort the source data according to the order of the recording time to generate a data sorting table; and

[0086] Step S203: Select all source data in the data sorting table and extract the selected source data to obtain initial data.

[0087] This embodiment queries all source data and their corresponding ROWIDs in the source data table, sorts the source data according to the record time of the ROWIDs, thereby effectively obtaining a data sorting table of the source data regarding the data update time, and effectively extracting the data based on this data sorting table to obtain the initial data.

[0088] In this embodiment, querying all source data and their corresponding ROWIDs in the source data table is performed using SQL queries. In this embodiment, when data is inserted or updated, a new ROWID is generated. By sorting the source data according to the record time of the ROWID, the latest ROWID can be used as the data cutoff point, and the source data corresponding to the ROWIDs before the cutoff point can be obtained, using this portion of source data as the initial data. In this embodiment, the aforementioned data cutoff point can be customized to a specific time, thereby obtaining all source data before that time. For example, setting the data cutoff point to 3:56 means that during searching and sorting, only source data before 3:56 will be retrieved, and source data after 3:56 will not be retrieved. By setting the data cutoff point to a specific time, it is convenient to perform customized and accurate extraction of source data.

[0089] In an optional embodiment of this example, after step S202, the following step is further included:

[0090] Select the last data point in the data sorting table that is closest to the current time, and record the last data point as the data extraction point;

[0091] Obtain the time information corresponding to the data extraction point, and save the data extraction point and the time information to a predetermined archive location in the database.

[0092] This embodiment records data extraction points and the corresponding time information, making it convenient for users to obtain the data extracted at a specific point in time, thus facilitating subsequent error correction.

[0093] In this embodiment, the time information corresponding to the data extraction point can be recorded as a specific hour and minute, or even accurate to the second. When the time information corresponding to the data extraction point is obtained, it needs to be recorded in the predetermined archiving location in the database according to the time sequence and saved in the form of a report. For example, the time of the first data extraction is 3:56, the time of the second data extraction is 4:01, and the time of the third data extraction is 4:07. By recording the specific time of data extraction, it is convenient for backend personnel to call the extraction process for viewing, thereby facilitating subsequent error correction of the extracted data.

[0094] Continue to refer to Figure 4 The flowchart of a specific embodiment of step S30 is shown, which includes the following steps:

[0095] Step S301: Obtain preset setting information, and set the execution logic of the trigger according to the setting information;

[0096] Step S302: Add the trigger to the source data table and obtain the trigger event information recorded by the trigger in real time;

[0097] Step S303: Obtain corresponding operation information based on the trigger event information, wherein the operation information includes: operation data, operation behavior type, and operation data identifier; and

[0098] Step S304: Write the operation behavior type and the operation data identifier into the information record column, and write the operation data into the data column.

[0099] This embodiment effectively obtains trigger event information generated when data in the source data table changes by setting the execution logic of the trigger. Based on the trigger event information, the corresponding operation data, operation behavior type, and operation data identifier are obtained, and the above-mentioned operation data, operation behavior type, and operation data identifier are written into the corresponding column of the operation log table.

[0100] In this embodiment, the defined trigger records the corresponding operation data, operation behavior type, and operation data identifier in the operation log table when a delete, insert, or update operation is performed on the source data table. The recorded operation behavior types include adding data, deleting data, updating old data, and updating new data.

[0101] When updating initial data, if it's an insert operation, the newly added row of data from the source data table will be inserted into the operation log table, and the value of the operation type column will be set to insert. If it's a delete operation, the deleted row of data from the source data table will be inserted into the operation log table, and the value of the operation type column will be set to delete. If it's an update operation, two rows of data will be inserted. The first row will be the data before the update, inserted into the operation log table, and the value of the operation type column will be set to update: old data. The second row will be the data after the update, inserted into the operation log table, and the value of the operation type column will be set to update: new data.

[0102] Continue to refer to Figure 5 The flowchart of a specific embodiment of step S40 is shown, which includes the following steps:

[0103] Step S401: Detect whether the operation information is continuously written to the operation log table;

[0104] Step S402: If the operation information is not continuously written to the operation log table, then start recording the time during which the operation information is not written to the operation log table, and use this time as the no-operation time, until the operation information starts being written to the operation log table again or the trigger stops listening; and

[0105] Step S403: If the operation information is continuously written to the operation log table, then confirm whether the operation information has been successfully written, until the operation information is no longer continuously written to the operation log table or the trigger stops listening.

[0106] In this embodiment, to effectively determine whether the update operation of the source data table has been triggered and completed, it is necessary to detect whether the operation information is continuously written to the operation log table. When the operation information is not written to the operation log table, it may be due to a delay in the acquisition of data update information in the current system. To avoid this situation, it is necessary to further calculate the time during which the operation information is not written to the operation log table and compare the calculated no-operation time with a preset judgment value. When the operation information is written to the operation log, it is necessary to confirm whether the operation information has been written successfully to ensure data reliability.

[0107] When the inactivity period begins, it continuously monitors whether operation information is written back to the operation log table. If the operation information is written back to the corresponding operation log table, the inactivity period is output and compared with a preset judgment value to confirm whether the source data table has completed the data update operation. This update refers to data update behaviors including data insertion, data deletion, and data updating. In this embodiment, the preset judgment value is 10 seconds. When the inactivity period is greater than or equal to 10 seconds, it indicates that the update operation of the source data table has been completed. The above judgment value can be adjusted according to the actual situation.

[0108] Continue to refer to Figure 6 The flowchart of a specific embodiment of step S50 is shown, which includes the following steps:

[0109] Step S501: Identify the operation behavior type corresponding to the operation information, wherein the operation behavior type includes: data addition, data deletion, and data update;

[0110] Step S502: Obtain the operation data and the operation data identifier; compare the initial data with the operation data and the operation data identifier to obtain a comparison result; and

[0111] Step S503: Perform data operations corresponding to the data addition, data deletion, and data update on the initial data based on the comparison results.

[0112] This embodiment compares and searches the initial data based on the operation behavior type and data operation identifier, and then performs corresponding update operations on the searched data to finally obtain the updated real-time data.

[0113] In this embodiment, the process of performing data operations corresponding to data addition, data deletion, and data update on the initial data based on the comparison results is as follows:

[0114] Depending on the type of operation, replaying the data changes on the initial data will yield data consistent with the updated source data table.

[0115] For insert operations, if the ROWID in the newly added table record already exists in the initial data, it means that this record was already extracted during the initial data extraction process. We have already extracted all column data and mapping relationships for the newly added record row from the operation log table. Combined with the table structure, we construct the insert statement and execute it in the initial data to apply the changes to the newly added table.

[0116] For deletion operations, if the ROWID in the newly added table record does not exist in the initial data, it means that this record was already deleted from the data retrieved during the initial data extraction. Otherwise, the SQL statement is constructed using ROWID as the query condition to delete the corresponding data row.

[0117] For update operations, the operation log table records the data before and after the update. Therefore, by using ROWID as the query condition to construct an update statement and executing the update, data consistency can be guaranteed.

[0118] In this embodiment, the data update operation is performed after the initial data extraction is completed and the operation information is recorded in the operation log table. The data update can be performed in real-time or at set intervals. When updating data at set intervals, a predetermined recording time can be set. For example, if the initial data extraction time is 3:56 and the predetermined recording time is 5 minutes, then the time for the operation information monitored by the trigger to be written to the operation log table is also 5 minutes. That is, the real-time data after the data update is the data at 4:01. If there are 8000 data entries at 3:56 and the operation information is to delete 1000 entries, then at 4:01, the updated real-time data will have 7000 entries. The above recording time can be adjusted according to the actual situation.

[0119] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0120] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0121] Further reference Figure 7 As a response to the above Figure 1 To implement the method shown, this application provides an embodiment of a data update device, which is similar to... Figure 1 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0122] like Figure 7 As shown, the data update device 7 described in this embodiment includes: a log table creation module 701, a data extraction module 702, an operation monitoring module 703, a change detection module 704, a first operation execution module 705, and a second operation execution module 706. Wherein:

[0123] The log table creation module 701 is used to obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table;

[0124] Data extraction module 702 is used to obtain the data identifier corresponding to the source data table, and extract data from the source data table according to the data identifier to obtain initial data;

[0125] The operation monitoring module 703 is used to monitor the operation behavior of the source data table according to a preset trigger, and write the operation information obtained by the monitoring into the operation log table.

[0126] The change detection module 704 is used to obtain the no-operation time when the operation information is not written to the operation log table, and to detect whether the no-operation time is greater than or equal to a preset judgment value.

[0127] The first operation execution module 705 is configured to, if the inactivity time is greater than or equal to the judgment value, read the operation information from the operation log table, perform corresponding data operations on the initial data according to the operation information, and obtain real-time data; and

[0128] The second operation execution module 706 is used to continuously acquire the operation information and write it into the information record column if the no-operation time is less than the judgment value, until the no-operation time is greater than or equal to the judgment value or the trigger stops listening.

[0129] This embodiment solves the problems of databases needing to be updated under specific conditions and relying on too many tools with complex deployments by setting up a device module corresponding to the data update method, thus achieving convenient and effective data updates for the database.

[0130] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 7 , Figure 7 This is a basic structural block diagram of the computer device in this embodiment.

[0131] The computer device 8 includes a memory 81, a processor 82, and a network interface 83 that are interconnected via a system bus. It should be noted that only the computer device 8 with components 81-83 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0132] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.

[0133] The memory 81 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 81 may be an internal storage unit of the computer device 8, such as the hard disk or memory of the computer device 8. In other embodiments, the memory 81 may also be an external storage device of the computer device 8, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 8. Of course, the memory 81 may include both the internal storage unit and its external storage device of the computer device 8. In this embodiment, the memory 81 is typically used to store the operating system and various application software installed on the computer device 8, such as program code for data update methods. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or will be output.

[0134] In some embodiments, the processor 82 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 82 is typically used to control the overall operation of the computer device 8. In this embodiment, the processor 82 is used to run program code stored in the memory 81 or process data, for example, to run the program code for the data update method.

[0135] The network interface 83 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 8 and other electronic devices.

[0136] This embodiment solves the problems of databases needing to be updated under specific conditions and relying on too many tools with complex deployments by setting up computer equipment corresponding to the data update method, thus enabling convenient and effective updates to database data.

[0137] This application also provides another embodiment, namely, a computer-readable storage medium storing a data update program that can be executed by at least one processor to cause the at least one processor to perform the steps of the data update method as described above.

[0138] This embodiment solves the problems of databases needing to be updated under specific conditions and relying on too many tools with complex deployments by setting up a computer-readable storage medium corresponding to the data update method, thus enabling convenient and effective updates to database data.

[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0140] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.

Claims

1. A data update method, characterized in that, Includes the following steps: Obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table; Obtain the data identifier corresponding to the source data table, and extract data from the source data table based on the data identifier to obtain the initial data; The operation behavior of the source data table is monitored according to a preset trigger, and the operation information obtained by the monitoring is written into the operation log table; Obtain the no-operation time when the operation information is not written to the operation log table, and detect whether the no-operation time is greater than or equal to a preset judgment value; If the inactive time is greater than or equal to the judgment value, then read the operation information from the operation log table, and perform corresponding data operations on the initial data according to the operation information to obtain real-time data; and If the inactivity time is less than the judgment value, the operation information is continuously acquired and written into the information record column until the inactivity time is greater than or equal to the judgment value or the trigger stops listening. Wherein, the data identifier is ROWID, and the step of obtaining the data identifier corresponding to the source data table, and extracting data from the source data table according to the data identifier to obtain the initial data specifically includes: Query all source data and their corresponding ROWIDs in the source data table; Obtain the recording time of the ROWID, and sort the source data according to the order of the recording time to generate a data sorting table; and Select all source data in the data sorting table and extract the selected source data to obtain the initial data.

2. The data update method according to claim 1, characterized in that, The information record columns include: a data identifier column, an operation type column, and an auto-increment column. The steps of obtaining the source data table, creating an operation log table with the same structure as the source data table, and adding information record columns to the operation log table specifically include: The source data table is retrieved from the database using a query statement; Obtain the attribute information of the source data table, and create the operation log table based on the attribute information; and Insert the data identifier column, the operation type column, and the auto-increment column into the predetermined positions in the operation log table.

3. The data update method according to claim 1, characterized in that, After the steps of obtaining the record time of the ROWID, sorting the source data according to the record time order, and generating a data sorting table, the following steps are also included: Select the last data point in the data sorting table that is closest to the current time, and record the last data point as the data extraction point; Obtain the time information corresponding to the data extraction point, and save the data extraction point and the time information to a predetermined archive location in the database.

4. The data update method according to claim 1, characterized in that, The operation log table includes: data columns and information record columns. The step of monitoring the operation behavior of the source data table according to a preset trigger and writing the monitored operation information into the operation log table specifically includes: Obtain preset setting information, and set the execution logic of the trigger according to the setting information; Add the trigger to the source data table and obtain the trigger event information recorded by the trigger in real time; Based on the trigger event information, corresponding operation information is obtained, wherein the operation information includes: operation data, operation behavior type, and operation data identifier; and The operation behavior type and the operation data identifier are recorded in the information record column, and the operation data is written into the data column.

5. The data update method according to claim 1, characterized in that, The step of obtaining the no-operation time when the operation information is not written to the operation log table specifically includes: Detect whether the operation information is continuously written to the operation log table; If the operation information is not continuously written to the operation log table, then the time during which the operation information is not written to the operation log table is recorded, and this time is taken as the no-operation time, until the operation information starts being written to the operation log table again or the trigger stops listening. If the operation information is continuously written to the operation log table, then confirm whether the operation information has been successfully written, until the operation information is no longer continuously written to the operation log table or the trigger stops listening.

6. The data update method according to claim 1, characterized in that, The operation information includes: operation data, operation behavior type, and operation data identifier. The step of performing corresponding data operations on the initial data based on the operation information specifically includes: Identify the operation behavior type corresponding to the operation information, wherein the operation behavior type includes: data addition, data deletion, and data update; Obtain the operation data and the operation data identifier; compare the initial data with the operation data and the operation data identifier to obtain a comparison result; and Based on the comparison results, perform data operations corresponding to the data addition, data deletion, and data update on the initial data.

7. A data update device, characterized in that, include: The log table creation module is used to obtain the source data table, create an operation log table with the same structure as the source data table, and add an information record column to the operation log table; The data extraction module is used to obtain the data identifier corresponding to the source data table, and extract data from the source data table according to the data identifier to obtain initial data; An operation monitoring module is used to monitor the operation behavior of the source data table according to a preset trigger, and write the operation information obtained by the monitoring into the operation log table; The change detection module is used to obtain the no-operation time when the operation information is not written to the operation log table, and to detect whether the no-operation time is greater than or equal to a preset judgment value. The first operation execution module is used to read the operation information of the operation log table if the no-operation time is greater than or equal to the judgment value, and perform corresponding data operations on the initial data according to the operation information to obtain real-time data; and The second operation execution module is used to continuously acquire the operation information and write it into the information record column if the no-operation time is less than the judgment value, until the no-operation time is greater than or equal to the judgment value or the trigger stops the listening action. The data identifier is ROWID. The data extraction module is also used to query all source data and the corresponding ROWID in the source data table; obtain the record time of the ROWID; and sort the source data according to the order of the record time to generate a data sorting table. Select all source data in the data sorting table and extract the selected source data to obtain the initial data.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the data update method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data update method as described in any one of claims 1 to 6.