Database updating method and system
By obtaining the database update mapping table and using the mapping relationship for data querying and asynchronous thread updates, the problem of low database update efficiency during business platform system upgrades is solved, achieving more efficient data updates and system upgrades.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- 广域铭岛数字科技有限公司
- Filing Date
- 2023-08-03
- Publication Date
- 2026-05-19
AI Technical Summary
During the system upgrade of the business platform, especially when it involves the upgrade of functional interfaces and data algorithms, the existing technology requires a lot of manpower and time to organize the database tables and table fields, resulting in low data update efficiency and failure to meet the timeliness requirements of system upgrades.
By obtaining the update mapping table of the original database, the original data text is used as a query variable to perform data querying using the mapping relationship, generating a database update statement, replacing the original data text of the data to be updated with the target data text, and performing data update in an asynchronous thread manner.
This shortened the time required to organize the database tables and table field update locations before the system upgrade, improved data update efficiency, and thus enhanced the system upgrade efficiency of the business platform.
Smart Images

Figure CN116860771B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data update technology, and in particular to a database update method and system. Background Technology
[0002] When upgrading a business platform, if the upgrade targets functional interfaces or data algorithms, the upgrade content may lead to incompatibility issues in the platform's data calls. Therefore, it's necessary to update or synchronize the platform's database according to the upgrade content before the upgrade. Typically, before updating the data, it's necessary to organize the database tables and fields to be upgraded, and then use this organized data as the data update target to create an upgrade script. The upgrade script is then used to update and synchronize the platform's database.
[0003] However, when the business platform has a large amount of data and spans multiple business platforms, organizing specific data update targets such as database tables and table fields requires a lot of manpower and time, resulting in long preparation time for data updates and low data update efficiency. Consequently, the system upgrade efficiency of the business platform is low, and it cannot meet the timeliness requirements of system upgrades. Summary of the Invention
[0004] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.
[0005] In view of the shortcomings of the prior art described above, the present invention discloses a database update method and system to improve the data update efficiency before system upgrade.
[0006] This invention provides a database update method, comprising: obtaining an update mapping table corresponding to an original database, wherein the update mapping table includes a mapping relationship between original data text and target data text; querying the original database using the original data text as a query variable to obtain data to be updated containing the original data text; generating a database update statement using the target data text and the data to be updated as update variables, and updating the data to be updated by executing the database update statement to replace the original data text of the data to be updated with the target data text.
[0007] Optionally, the original data text is used as a query variable to query the original database to obtain the data to be updated containing the original data text, including: setting up a temporary data table in advance; using the original data text as a query variable, traversing and querying the original database using a cursor to obtain query records; determining the data to be updated containing the original data text from the original database based on the query records, and adding the data to be updated to the temporary data table.
[0008] Optionally, after adding the data to be updated to the temporary data table and before generating a database update statement using the target data text and the data to be updated as update variables, the method further includes: generating a database query statement based on the data to be updated in the temporary data table; sending the database query statement to a preset user terminal, so that the user can query the temporary data table using the database query statement on the user terminal; and updating the data to be updated according to the user selection instruction if a user selection instruction corresponding to the data to be updated is received from the user terminal.
[0009] Optionally, the original data text of the data to be updated can be replaced with the target data text by the following method: pre-setting the target data type and default data text of the original data text; obtaining the current data type of the original data text; if the current data type belongs to the target data type, then replacing the original data text of the data to be updated with the target data text; if the current data type does not belong to the target data type, then replacing the original data text of the data to be updated with the default data text.
[0010] Optionally, the method further includes: obtaining the database table where the data to be updated is located; if the amount of data in the database table is greater than or equal to a preset amount of data, generating a main thread and an asynchronous thread, wherein the main thread is used to manage the database table, and the asynchronous thread is used to update the data to be updated in the database table according to the target data text; if the asynchronous thread completes execution, the update result corresponding to the data to be updated is determined as the data update being completed.
[0011] Optionally, the method further includes: if there are multiple original data texts, assigning value weights to each original data text; establishing update threads for each original data text to simultaneously update the data to be updated corresponding to the original data text to the target data text corresponding to the original data text through each update thread; if any data to be updated includes multiple original data texts, executing the update threads corresponding to the data to be updated sequentially according to the value weights to sequentially replace each original data text in the data to be updated with the target data text.
[0012] Optionally, obtaining the update mapping table corresponding to the original database includes: obtaining the associated data group of the original database, wherein the associated data group includes the original data text and the associated data corresponding to the original data text; synchronizing data with a preset target database according to the associated data, so that the target database, after synchronizing the associated data, returns the target data text corresponding to the original data text; establishing a mapping relationship between the original data text and the target data text to obtain the update mapping table.
[0013] Optionally, data synchronization of a preset target database based on the associated data includes: the associated data including identifier data and data to be synchronized; querying the target database based on the identifier data to obtain a query result; if the query result indicates existence, updating the queried database data to the data to be synchronized, so that the target database generates target data text based on the updated data to be synchronized; if the query result indicates non-existence, synchronizing the data to be synchronized to the target database, so that the target database generates target data text based on the synchronized data to be synchronized.
[0014] Optionally, the method further includes: after replacing the original data text of the data to be updated with the target data text by executing the database update statement, synchronizing the preset target database again based on the updated data to be updated.
[0015] This invention provides a database update system, comprising: an acquisition module for acquiring an update mapping table corresponding to an original database, wherein the update mapping table includes a mapping relationship between original data text and target data text; a query module for querying the original database using the original data text as a query variable to obtain data to be updated containing the original data text; and an update module for generating a database update statement using the target data text and the data to be updated as update variables, and updating the data to be updated by executing the database update statement to replace the original data text of the data to be updated with the target data text.
[0016] The beneficial effects of this invention are:
[0017] By obtaining the mapping relationship between the original data text and the target data text, the original database is queried based on the original data text to obtain the data to be updated containing the original data text. Then, a database update statement is executed to replace the original data text of the data to be updated with the target data text, thus completing the data update. In this way, by searching for the data to be updated in the database through text and then replacing the text of the data to be updated, the update is completed. Compared to organizing the database tables and fields that need to be updated, this shortens the time spent organizing the database tables and fields to be updated before the system upgrade, improves the efficiency of data updates, and thus improves the system upgrade efficiency of the business platform. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of the structure of an application environment for implementing a database update method in an embodiment of the present invention;
[0019] Figure 2 This is a flowchart illustrating a database update method in an embodiment of the present invention;
[0020] Figure 3 This is a flowchart illustrating a method for obtaining an updated mapping table in an embodiment of the present invention;
[0021] Figure 4 This is a flowchart illustrating another database update method in an embodiment of the present invention;
[0022] Figure 5 This is a flowchart illustrating another database update method in an embodiment of the present invention;
[0023] Figure 6 This is a schematic diagram of the structure of a database update system in an embodiment of the present invention. Detailed Implementation
[0024] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and sub-samples in the embodiments can be combined with each other.
[0025] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0026] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.
[0027] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.
[0028] Unless otherwise stated, the term "multiple" means two or more.
[0029] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.
[0030] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.
[0031] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be interpreted as follows.
[0032] Database updates involve updating tables, which are crucial objects in a database and the basic units for storing data. Once the table structure is created, the process involves inserting new data and modifying or deleting existing data. Data updates can be implemented using either Object Explorer or T-SQL statements. In other words, a data update is the process of replacing corresponding old data items or records in a data file or database with new data items or records, achieved through operations such as deletion, modification, and re-insertion.
[0033] SQL (Structured Query Language) is a special-purpose programming language, a database query and programming language used to access, query, update, and manage relational database systems. It is a high-level, non-procedural programming language that allows users to work on high-level data structures. It does not require users to specify how data is stored, nor does it require users to understand the specific data storage methods. Therefore, different database systems with completely different underlying structures can use the same SQL as an interface for data input and management. SQL statements can be nested, giving it great flexibility and powerful functionality.
[0034] A cursor is a pointer to a specific row in the results of a database query. The pointer can move from one row to the next, and depending on the cursor type, it can also move to the previous row. In simpler terms, the SQL result is like a bag containing multiple database rows, but not any single row can be stored alone; a cursor is like a pair of tweezers, grabbing a specific database row from the bag and moving it to the next row.
[0035] Combination Figure 1 As shown in the embodiments of this disclosure, an application environment is provided for implementing a database update method, including a client and a server, wherein the client communicates with the server via a network. The server can receive user instructions through the client, and the user instructions include at least one of the following: obtaining an update mapping table corresponding to the original database, wherein the update mapping table includes a mapping relationship between original data text and target data text; querying the original database using the original data text as a query variable to obtain data to be updated containing the original data text; generating a database update statement using the target data text and the data to be updated as update variables, and replacing the original data text of the data to be updated with the target data text by executing the database update statement to update the data to be updated.
[0036] Combination Figure 2 As shown, this disclosure provides a database update method, including:
[0037] Step S201: Obtain the update mapping table corresponding to the original database;
[0038] The update mapping table includes the mapping relationship between the original data text and the target data text.
[0039] In some embodiments, business platform A connects to business platform B, requiring a system upgrade for business platform A to utilize the services provided by business platform B. Business platform A generates a large amount of business data within its own platform system, such as user information, account information, tenant information, department information, and employee information, and stores this data in its database using a first ID (identity document, abbreviation for various proprietary terms such as ID card number, account number, unique code, exclusive number, industrial design, country abbreviation, legal terminology, general account, decoder, software company, etc.). Business platform A synchronizes business data with business platform B, causing business platform B to generate a second ID corresponding to each piece of business data during the synchronization process. When business platform A receives the second ID from business platform B, it needs to update its first ID based on the second ID. If an upgrade script is created, it is necessary to identify the database, database table, database field, and field type of the first ID, which is difficult and time-consuming, and cannot guarantee comprehensive data coverage.
[0040] In some embodiments, updating the mapping table includes not only text-based mapping relationships, but also mapping relationships in the form of field values, data values, etc.
[0041] Combination Figure 3 As shown, the update mapping table corresponding to the original database is obtained, including:
[0042] Step S301: Obtain the associated data group of the original database;
[0043] Among them, the associated data group includes the original data text and the associated data corresponding to the original data text;
[0044] The associated data includes identification data and data to be synchronized;
[0045] Step S302: Synchronize the data of the preset target database according to the associated data, so that after the target database synchronizes the associated data, it returns the target data text corresponding to the original data text.
[0046] Step S303: Establish the mapping relationship between the original data text and the target data text to obtain the updated mapping table.
[0047] Optionally, before synchronizing data with the preset target database based on the associated data, the associated data is validated, and data is repaired based on the validation results. The validation includes checking whether the data is empty, whether the data is duplicated, and whether the data is missing.
[0048] Combination Figure 3As shown, data synchronization is performed on a preset target database based on associated data, including:
[0049] Step S3021: Perform a data query on the target database based on the identification data to obtain the query results;
[0050] Step S3022: If the query result is found, the queried database data is updated to the data to be synchronized, so that the target database generates the target data text based on the updated data to be synchronized.
[0051] In step S3023, if the query result is not found, the data to be synchronized is synchronized to the target database, so that the target database generates target data text based on the synchronized data to be synchronized.
[0052] In some embodiments, the first ID of business platform A is used as the original data text, and the second ID of business platform B is used as the target data text. A mapping relationship between the first ID and the second ID is established to obtain an updated mapping table.
[0053] In some embodiments, the process involves querying employee information and the corresponding first ID of business platform A, where employee information is used as associated data and the corresponding first ID is used as raw data text. Data is assembled based on the associated data to obtain data to be synchronized with business platform B, including employee account, employee department, employee part-time department, employee gender, employee ID, and employee login password. The unique employee account is used as identifier data, and the database of business platform B is queried based on the identifier data to obtain the query result. If the employee account exists in the database of business platform B, the employee information in business platform B is updated according to the employee information corresponding to the employee account in business platform A, and the second ID is received from business platform B after successful update. If the employee account does not exist in the database of business platform B, the employee information corresponding to the employee account in business platform A is added to the database of business platform B, and the second ID is received from business platform B after successful addition. The second ID of business platform B is used as target data text to establish a mapping relationship between the first ID and the second ID, resulting in an update mapping table.
[0054] In some embodiments, an update mapping table for IDs corresponding to business data such as user information, account information, tenant information, and department information is obtained by generating the update mapping table for IDs corresponding to employee information according to the above-described method for generating update mapping tables for IDs corresponding to employee information.
[0055] In some embodiments, since business platform A uses mobile phone numbers as employee accounts while business platform B does not support using mobile phone numbers as employee accounts, upon receiving a query failure message from business platform B, the identifier data is modified to any other arbitrary data, and the data query and data synchronization are performed again.
[0056] Optionally, the method further includes: after replacing the original data text of the data to be updated with the target data text by executing a database update statement, synchronizing the preset target database again based on the updated data to be updated.
[0057] In some embodiments, in the database of business platform B, the supervisor information column of employee A is employee B. At the same time, after updating employee A's employee information, employee B's employee information is updated, and after employee B's employee information is updated, employee A's employee information is updated again based on employee B's employee information.
[0058] Step S202: Use the original data text as a query variable to query the original database and obtain the data to be updated containing the original data text.
[0059] Optionally, the original data text is used as a query variable to query the original database to obtain the data to be updated containing the original data text. This includes: setting up a temporary data table in advance; using the original data text as a query variable, traversing and querying the original database using a cursor to obtain query records; determining the data to be updated containing the original data text from the original database based on the query records, and adding the data to be updated to the temporary data table.
[0060] Optionally, after adding the data to be updated to the temporary data table and before generating a database update statement using the target data text and the data to be updated as update variables, the method further includes: generating a database query statement based on the data to be updated in the temporary data table; sending the database query statement to a preset user terminal, enabling the user to query the temporary data table using the database query statement on the user terminal; and updating the data to be updated according to the user selection instruction if a user selection instruction corresponding to the data to be updated is received from the user terminal.
[0061] In some embodiments, an SQL query statement is generated based on the data to be updated in the temporary data table and sent to the user terminal, so that the user can easily query and select the data to be updated through the generated SQL query statement, thereby confirming the final data to be updated according to the user's selection instruction.
[0062] Step S203: Generate a database update statement by using the target data text and the data to be updated as update variables, and replace the original data text of the data to be updated with the target data text by executing the database update statement to update the data to be updated.
[0063] In some embodiments, the mapping relationship between the first ID (e.g., "100314782") of business platform A and the second ID (e.g., "23562") of business platform B is obtained; then, by executing the SQL statement (call `auto_replace`('database','100314782','23562') ;), "100314782" in the database of business platform A is replaced with "23562", thereby completing the update of the first ID in business platform A.
[0064] Optionally, the original data text of the data to be updated can be replaced with the target data text using the following method: pre-set the target data type and default data text of the original data text; obtain the current data type of the original data text; if the current data type belongs to the target data type, then replace the original data text of the data to be updated with the target data text; if the current data type does not belong to the target data type, then replace the original data text of the data to be updated with the default data text.
[0065] Optionally, the method further includes: pre-setting exception handling rules; generating data update results after updating the data to be updated; if the data update result is an update exception, then feeding back the data update result to the user and executing the preset exception handling rules.
[0066] Optionally, the method further includes: obtaining the database table where the data to be updated is located; if the amount of data in the database table is greater than or equal to a preset amount of data, generating a main thread and an asynchronous thread, wherein the main thread is used to manage the database table, and the asynchronous thread is used to update the data to be updated in the database table according to the target data text; if the asynchronous thread completes execution, the update result corresponding to the data to be updated is determined as the data update being completed.
[0067] In some embodiments, such as database tables containing a large amount of data, the database table is updated asynchronously using threads. The asynchronous thread is executed after the main thread has finished executing, and the data update is confirmed to be complete after the asynchronous thread has finished executing.
[0068] In this way, by using asynchronous threads, we can ensure data synchronization in the database while avoiding thread congestion and improving data update efficiency.
[0069] Optionally, the method further includes: if there are multiple original data texts, assigning value weights to each original data text; establishing update threads for each original data text to simultaneously update the data to be updated to the target data text corresponding to the original data text through each update thread; if any data to be updated includes multiple original data texts, executing the update threads corresponding to the data to be updated sequentially according to the value weights to sequentially replace each original data text in the data to be updated with the target data text.
[0070] In some embodiments, if employee C's supervisor is employee D, then employee C's employee information includes two pieces of data to be updated: employee C's employee number and employee D's employee number. In this case, update threads are created for the two employee numbers respectively. If the update weight of the employee is set to be greater than that of the supervisor, then the update thread corresponding to employee D will update the data of employee D after the update thread corresponding to employee C has completed.
[0071] In this way, by establishing multiple text update threads to complete the update of different data, when there are multiple texts that need to be updated in a set of data to be updated, the data updates are performed sequentially according to their value weights, which ensures the efficiency of data updates while avoiding data update errors.
[0072] The database update method provided in this disclosure obtains the mapping relationship between the original data text and the target data text, queries the original database based on the original data text to obtain the data to be updated containing the original data text, and replaces the original data text of the data to be updated with the target data text by executing a database update statement, thereby completing the data update. This method has the following advantages:
[0073] First, by searching the database for the data to be updated through text, and then replacing the text of the data to be updated, the update of the data to be updated is completed. Compared with organizing the database tables and fields that need to be updated, this shortens the time spent organizing the database tables and fields to be updated before the system upgrade, improves the efficiency of data updates, and thus improves the system upgrade efficiency of the business platform.
[0074] Second, by using asynchronous threads, we can ensure data synchronization in the database while avoiding thread congestion and improving data update efficiency.
[0075] Third, by establishing multiple text update threads to complete the updates of different data, when there are multiple texts that need to be updated in a set of data to be updated, the data updates are performed sequentially according to their value weights, which ensures the efficiency of data updates while avoiding data update errors.
[0076] Combination Figure 4As shown, this disclosure provides a database update method, including:
[0077] Step S401: Obtain the update mapping table corresponding to the original database;
[0078] The update mapping table includes the mapping relationship between the original data text and the target data text;
[0079] Step S402: Declare variables based on the original database and the updated mapping table;
[0080] The original data text is used as the query variable.
[0081] The target data text is used as the update variable.
[0082] Step S403: Declare a cursor and use the cursor to query the original database to obtain the query records;
[0083] Step S404: Based on the query records, determine the data to be updated from the original database that has the original data text, and add the data to be updated to the temporary data table;
[0084] Step S405: Generate an SQL update statement based on the data to be updated in the temporary data table;
[0085] Step S406: Execute the SQL update statement to replace the original data text of the data to be updated with the target data text to update the data to be updated.
[0086] The database update method provided in this disclosure involves obtaining the mapping relationship between the original data text and the target data text, querying the original database based on the original data text to obtain the data to be updated containing the original data text, and then replacing the original data text with the target data text by executing a database update statement, thereby completing the data update. In this way, by searching for the data to be updated in the database using text and then replacing the text of the data to be updated, the update is completed. Compared to organizing the database tables and fields that need to be updated, this method shortens the time spent organizing the database tables and fields to be updated before system upgrades, improves the efficiency of data updates, and thus improves the system upgrade efficiency of the business platform.
[0087] Combination Figure 5 As shown, this disclosure provides a database update method, including:
[0088] Step S501: Obtain a temporary data table;
[0089] The temporary data table stores data that needs to be updated.
[0090] Step S502: Determine whether there is any unprocessed data to be updated in the temporary data table. If yes, proceed to step S503; otherwise, proceed to step S507.
[0091] Step S503: Extract unprocessed data to be updated from the temporary data table;
[0092] Step S504: Generate an SQL update statement based on the extracted data to be updated;
[0093] Step S505: Execute the SQL update statement to replace the original data text of the data to be updated with the target data text to update the data to be updated. Then proceed to steps S502 and S506 respectively.
[0094] Step S506: Synchronize the updated data to be updated.
[0095] Step S507: Data update complete.
[0096] The database update method provided in this disclosure involves obtaining the mapping relationship between the original data text and the target data text, querying the original database based on the original data text to obtain the data to be updated containing the original data text, and then replacing the original data text with the target data text by executing a database update statement, thereby completing the data update. In this way, by searching for the data to be updated in the database using text and then replacing the text of the data to be updated, the update is completed. Compared to organizing the database tables and fields that need to be updated, this method shortens the time spent organizing the database tables and fields to be updated before system upgrades, improves the efficiency of data updates, and thus improves the system upgrade efficiency of the business platform.
[0097] Combination Figure 6 As shown, this embodiment of the disclosure provides a database update system, including an acquisition module 601, a query module 602, and an update module 603.
[0098] The acquisition module 601 is used to acquire the update mapping table corresponding to the original database, wherein the update mapping table includes the mapping relationship between the original data text and the target data text.
[0099] The query module 602 is used to query the original database using the original data text as a query variable to obtain the data to be updated containing the original data text.
[0100] The update module 603 is used to generate a database update statement by taking the target data text and the data to be updated as update variables, and to update the data to be updated by executing the database update statement to replace the original data text of the data to be updated with the target data text.
[0101] The database update system provided in this disclosure obtains the mapping relationship between the original data text and the target data text, queries the original database based on the original data text to obtain the data to be updated containing the original data text, and replaces the original data text of the data to be updated with the target data text by executing a database update statement, thereby completing the data update. In this way, by searching for the data to be updated in the database through text and then replacing the text of the data to be updated, the update is completed. Compared to organizing the database tables and table fields that need to be updated, this shortens the time spent organizing the database tables and table fields for update before system upgrades, improves the efficiency of data updates, and thus improves the system upgrade efficiency of the business platform.
[0102] The foregoing description and accompanying drawings fully illustrate embodiments of this disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and subsamples of some embodiments may be included in or replace parts and subsamples of other embodiments. Moreover, the terminology used in this application is for describing embodiments only and is not intended to limit the claims. As used in the description of embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used herein means including one or more of the associated listed items and all possible combinations thereof. Additionally, when used in this application, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated subsamples, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other subsamples, wholes, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprising a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes the element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, the relevant parts can be referred to the description of the method section.
[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0104] The methods and products (including but not limited to devices and equipment) disclosed in the embodiments herein can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units may be merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some sub-samples may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms. Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to implement this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0105] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than that shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. In the descriptions corresponding to the flowcharts and block diagrams in the accompanying drawings, the operations or steps corresponding to different blocks may also occur in a different order than disclosed in the description, and sometimes there is no specific order between different operations or steps. For example, two consecutive operations or steps may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. Each block in a block diagram and / or flowchart, and combinations of blocks in a block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
Claims
1. A database update method, characterized in that, include: Obtain the update mapping table corresponding to the original database, wherein the update mapping table includes the mapping relationship between the original data text and the target data text; Obtaining the update mapping table corresponding to the original database includes: obtaining the associated data group of the original database, wherein the associated data group includes the original data text and the associated data corresponding to the original data text; synchronizing data with a preset target database according to the associated data, so that the target database returns the target data text corresponding to the original data text after synchronizing the associated data; and establishing a mapping relationship between the original data text and the target data text to obtain the update mapping table. The original data text is used as a query variable to query the original database, and the data to be updated containing the original data text is obtained. The target data text and the data to be updated are used as update variables to generate a database update statement. The original data text of the data to be updated is replaced with the target data text by executing the database update statement to update the data to be updated.
2. The method according to claim 1, characterized in that, Using the original data text as a query variable, a data query is performed on the original database to obtain the data to be updated containing the original data text, including: Pre-set up a temporary data table; Using the original data text as a query variable, the original database is traversed and queried using a cursor to obtain the query records; Based on the query records, determine the data to be updated from the original database that contains the original data text, and add the data to be updated to the temporary data table.
3. The method according to claim 2, characterized in that, After adding the data to be updated to the temporary data table and before generating a database update statement using the target data text and the data to be updated as update variables, the method further includes: Generate a database query statement based on the data to be updated in the temporary data table; The database query statement is sent to a preset user terminal, so that the user can query the temporary data table through the database query statement on the user terminal; If a user selection instruction corresponding to the data to be updated is received from the user terminal, the data to be updated is updated according to the user selection instruction.
4. The method according to claim 1, characterized in that, The original data text of the data to be updated is replaced with the target data text using the following method: Pre-set the target data type and default data text of the original data text; Obtain the current data type of the original data text; If the current data type belongs to the target data type, then the original data text of the data to be updated is replaced with the target data text; If the current data type does not belong to the target data type, the original data text of the data to be updated will be replaced with the default data text.
5. The method according to claim 1, characterized in that, The method further includes: Obtain the database table containing the data to be updated; If the amount of data in the database table is greater than or equal to a preset amount of data, a main thread and an asynchronous thread are generated. The main thread is used to manage the database table, and the asynchronous thread is used to update the data to be updated in the database table according to the target data text. If the asynchronous thread completes its execution, the update result corresponding to the data to be updated is determined as the data update being complete.
6. The method according to claim 1, characterized in that, The method further includes: If there are multiple original data texts, then assign a value weight to each original data text. Each original data text is updated with an update thread, so that the data to be updated corresponding to the original data text is updated to the target data text corresponding to the original data text simultaneously through each update thread. If any data to be updated includes multiple original data texts, then the update thread corresponding to the data to be updated is executed sequentially according to the value weight, so as to replace each original data text in the data to be updated with the target data text in turn.
7. The method according to claim 1, characterized in that, Data synchronization with a preset target database based on the associated data includes: The associated data includes identification data and data to be synchronized; The target database is queried based on the identification data to obtain the query results; If the query result is found, the queried database data is updated to the data to be synchronized, so that the target database generates target data text based on the updated data to be synchronized. If the query result is not found, the data to be synchronized is synchronized to the target database, so that the target database generates target data text based on the synchronized data to be synchronized.
8. The method according to claim 1, characterized in that, The method further includes: After replacing the original data text of the data to be updated with the target data text by executing the database update statement, the preset target database is synchronized again based on the updated data to be updated.
9. A database update system, characterized in that, include: The acquisition module is used to acquire the update mapping table corresponding to the original database, wherein the update mapping table includes the mapping relationship between the original data text and the target data text; The acquisition module acquires the update mapping table corresponding to the original database in the following ways: acquiring the associated data group of the original database, wherein the associated data group includes the original data text and the associated data corresponding to the original data text; synchronizing data with a preset target database according to the associated data, so that the target database returns the target data text corresponding to the original data text after synchronizing the associated data; and establishing a mapping relationship between the original data text and the target data text to obtain the update mapping table. The query module is used to query the original database using the original data text as a query variable to obtain the data to be updated containing the original data text. The update module is used to generate a database update statement by using the target data text and the data to be updated as update variables, and to update the data to be updated by executing the database update statement to replace the original data text of the data to be updated with the target data text.