Data modification method and device, computer device, and storage medium
By receiving data type selection instructions and obtaining the type field table and validation formula table, users can complete database data modification independently, solving the problems of inconvenience and low efficiency in existing technologies, and realizing self-service operation and real-time configuration data modification.
Patent Information
- Application Number
- CN202211114028.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2026-01-23
- Estimated Expiration
- 2042-09-14
AI Technical Summary
In existing technologies, database data modification relies on manual verification by users and the writing of SQL statements by operations and maintenance administrators, which leads to inconvenient operation, low modification efficiency, and negatively impacts user experience.
A data modification method and apparatus are provided, which receive a data type selection instruction, select the data type to be modified from the data modification type table, obtain the type field table and the validation formula table, perform field validation and update abnormal data, thereby realizing self-service operation and real-time configuration.
It simplifies the data modification process, saves time and manpower, improves data modification efficiency, and allows users to complete data verification and modification independently without the need for operation and maintenance administrators to intervene.
Smart Images

Figure CN115357598B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and more particularly to a data modification method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Structured Query Language (SQL) is a database query and programming language used to access, query, update, and manage relational database systems. People's learning and daily lives are inseparable from various application software, which inevitably produce data errors during use. It is necessary to investigate and correct abnormal data in the SQL database. Currently, database modification mainly relies on users manually checking data, discovering errors, and submitting exceptions. Operations administrators then write SQL statements based on these exceptions to investigate and modify the abnormal data, adding data modification functionality for users, and finally re-releasing the application to configure the correct data.
[0003] Every time a user submits abnormal data, the operations and maintenance administrator needs to add a data modification function and reconfigure the application version to complete the modification. This makes data modification inconvenient, inefficient, and negatively impacts the user experience. Summary of the Invention
[0004] Therefore, it is necessary to provide a data modification method, apparatus, computer equipment, and storage medium to address the aforementioned technical problems, thereby resolving the issue that each data modification requires user submission and application redeployment by the operations and maintenance administrator, resulting in inconvenience and low modification efficiency.
[0005] A data modification method, comprising:
[0006] Receive a data type selection instruction, and select the data type to be modified from the data modification type table according to the data type selection instruction;
[0007] Obtain the type field table, and find the field to be modified that corresponds to the data type to be modified in the type field table;
[0008] Obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table;
[0009] The data of the field to be modified is validated according to the validation formula, and a field validation result is generated.
[0010] Based on the field validation results, abnormal data in the field to be modified is determined, and the abnormal data is updated to complete the data modification.
[0011] A data modification device, comprising:
[0012] The type selection module is used to receive a data type selection instruction and select the data type to be modified from the data modification type table according to the data type selection instruction;
[0013] The field lookup module is used to obtain a type field table and find the field to be modified that corresponds to the data type to be modified in the type field table.
[0014] The formula lookup module is used to obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table.
[0015] The formula validation module is used to validate the data of the field to be modified according to the validation formula and generate the field validation result.
[0016] The data modification module is used to determine the abnormal data of the field to be modified based on the field verification result, and update the abnormal data to complete the data modification.
[0017] A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the data modification method described above when executing the computer-readable instructions.
[0018] One or more readable storage media storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the data modification method described above.
[0019] The aforementioned data modification method, apparatus, computer equipment, and storage medium, by receiving a data type selection instruction, selecting the data type to be modified from a data modification type table according to the instruction; obtaining a type field table and finding the field to be modified corresponding to the data type to be modified; obtaining a verification formula table and finding the verification formula corresponding to the field to be modified; verifying the data of the field to be modified according to the verification formula and generating a field verification result; determining abnormal data of the field to be modified based on the field verification result, and updating the abnormal data to complete the data modification. The data modification method provided by this invention can integrate different data modification types through a data modification type table, facilitating user selection; the correspondence between the data modification type table, type field table, and verification formula table enables self-service verification of abnormal data, eliminating the need for users to provide feedback to the operations and maintenance administrator, simplifying the data modification process, and saving significant time and manpower; simultaneously, data modification can be configured in real time, eliminating the need for operations and maintenance administrators to modify code and redeploy application versions, thus improving data modification efficiency. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating a data modification method in one embodiment of the present invention;
[0022] Figure 2 This is a schematic diagram of a data modification device in one embodiment of the present invention;
[0023] Figure 3 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0025] In one embodiment, such as Figure 1 As shown, a data modification method is provided, including the following steps S10-S50.
[0026] S10. Receive a data type selection instruction, and select the data type to be modified from the data modification type table according to the data type selection instruction.
[0027] Understandably, the data modification method provided in this embodiment is used by ordinary users (non-administrators) to modify data in the database. A database is a collection of tables, which are the basic elements of a database and, in relational databases, database objects used to store data. A database contains one or more tables, and these tables can be modeled as relational tables. A table consists of columns, each of which must have a corresponding data type and a type field. The data type contains table name information, and the type field contains column name information. These columns store data objects according to the defined data type, with each column corresponding to one data object per row. SQL database data types include: integer type, floating-point type, string data type, and boolean type.
[0028] In this embodiment, all modifiable data modification types in the database are collected into a data modification type table. When a user wants to modify a data object, they must first select the data modification type on the front-end page. The database backend receives the data type selection instruction and selects the data type to be modified from the data modification type table according to the data type selection instruction.
[0029] S20. Obtain the type field table and find the field to be modified that corresponds to the data type to be modified in the type field table.
[0030] Understandably, a type field is a field or name that a data type needs to display. One data type corresponds to multiple type fields. In this embodiment, the type display fields corresponding to all modifiable data types in the database are collected into a type field table. After selecting the data type to be modified, the database backend automatically finds the field to be modified corresponding to the data type to be modified from the type field table.
[0031] For example, Table 1 below shows the configuration table for the rental contract on the user page:
[0032] Table 1 Rental Contract Form
[0033] ID Name Telephone Contract amount 101 Zhang San 12345678910 1000 102 Li Si 12345678911 1100 103 Wang Wu 12345678912 1200 104 Zhao Liu 12345678914 1300
[0034] The ID in Table 1 is a unique identifier for each row of data and cannot be repeated. It defaults to automatic numbering and is used to uniquely identify the corresponding data object based on the type field of each column and the ID of each row. In this embodiment, the user selects an integer type as the data type to be modified in the data modification type table corresponding to the rental contract table. Therefore, the fields to be modified for this data type are the ID field, the phone number field, and the contract amount field.
[0035] S30. Obtain the verification formula table and find the verification formula corresponding to the field to be modified in the verification formula table.
[0036] Understandably, validation formulas are used to validate each data object in each row of a column of type fields, with one validation formula corresponding to each type field column. In this embodiment, the validation formulas corresponding to all modifiable type fields in the database are collected into a validation formula table. After finding the field to be modified, the database backend automatically retrieves the validation formula corresponding to the field from the validation formula table. In this embodiment, the fields to be modified are the ID field, the phone number field, and the contract amount field; therefore, the validation formulas corresponding to the fields to be modified are the ID validation formula, the phone number validation formula, and the contract amount validation formula.
[0037] S40. Verify the data of the field to be modified according to the verification formula, and generate the field verification result.
[0038] Understandably, each column of fields to be modified contains multiple data objects. After finding the corresponding validation formula for the field to be modified, the data objects in each column of fields to be modified are validated row by row using the corresponding validation formula. Data objects that satisfy the validation formula are marked as normal data, and data objects that do not satisfy the validation formula are marked as abnormal data. For example, in this embodiment, the data objects ("12345678910", "12345678911", "12345678912", and "12345678914") in the column corresponding to the telephone field are validated row by row according to the telephone validation formula to obtain normal telephone data ("12345678910", "12345678911", "12345678912") and abnormal telephone data ("12345678914"), and a validation result is generated.
[0039] S50. Determine the abnormal data of the field to be modified based on the field verification result, and update the abnormal data to complete the data modification.
[0040] Understandably, field validation results include two types: valid and invalid. Data objects with valid validation require no modification, while invalid data requires modification. For example, in this embodiment, based on the field validation results, no operation is performed on valid phone data ("12345678910", "12345678911", "12345678912"), while invalid phone data ("12345678914") is updated to correct data ("12345678913"). After entering the correct data, the data modification is complete.
[0041] This embodiment receives a data type selection instruction, selects the data type to be modified from the data modification type table according to the instruction; obtains the type field table, and finds the field to be modified corresponding to the data type to be modified; obtains the validation formula table, and finds the validation formula corresponding to the field to be modified; validates the data of the field to be modified according to the validation formula, and generates a field validation result; identifies abnormal data in the field to be modified based on the field validation result, and updates the abnormal data to complete the data modification. This embodiment integrates different data modification types together through the data modification type table, making it convenient for users to select; it enables self-service operation validation through the correspondence between the data modification type table, type field table, and validation formula table, eliminating the need for users to provide feedback to the operations and maintenance administrator, simplifying the data modification process and saving a significant amount of time and manpower; at the same time, data modification can be configured in real time, without requiring the operations and maintenance administrator to modify the code and redeploy the application version, improving the efficiency of data modification.
[0042] Optionally, step S20, i.e., before obtaining the type field table and finding the field to be modified corresponding to the data type to be modified in the type field table, includes:
[0043] S201. Generate the query SQL statement corresponding to the field to be modified according to the first preset format;
[0044] S202. Add the query SQL statement to the preset query SQL table to generate the query SQL table; the preset query SQL table is used to configure the query SQL statement corresponding to the specified field;
[0045] S203. Obtain multiple source data of the field to be modified, and generate multiple modification SQL statements corresponding to the multiple source data according to the second preset format;
[0046] S204. Add the multiple modification SQL statements to a preset modification SQL table to generate a modification SQL table; the preset modification SQL table is used to configure the modification SQL statements corresponding to the specified source data.
[0047] Understandably, application software needs to use SQL statements to operate on SQL databases. The basic operations of SQL databases include: insert, delete, update, and select. After finding the field to be modified corresponding to the data type in the type field table, a query operation needs to be performed on the SQL database to obtain all data objects contained in the field to be modified. The first preset format is a general format for query SQL statements, such as: select column_name from table_name, where "column_name" corresponds to the field to be modified, and "table_name" is included in the information of the data type to be modified. The query SQL statement parameters are generated based on the field to be modified, namely the column_name parameter and the table_name parameter. Substituting the column_name parameter and the table_name parameter into the first preset format generates a complete query SQL statement, that is, the query SQL statement corresponding to the field to be modified.
[0048] In SQL databases, the relation schema in the traditional relational model is called a base table. A base table is an independent table, and one relation corresponds to one base table. Before searching for the field to be modified in the type field table, the query SQL statement corresponding to the field to be modified is configured on a base table, resulting in a preset query SQL table. This table is used to configure the query SQL statement corresponding to a specified field. The preset query SQL table is the base table before adding the query SQL statement for the field to be modified; the generated query SQL table is the base table after adding the complete query SQL statement.
[0049] When field validation results contain abnormal data, the SQL database needs to be modified to obtain the correct data object. The second preset format is a general format for modifying SQL statements, for example: `update table_name set column_name = correct_data where column_name = data_value`. Here, `update table_name set column_name` is the column corresponding to the field to be modified, `correct_data` is the modified data object value, and `where column_name = data_value` is the value of the data object in a specific row and column. The SQL database contains multiple tables, each storing data with source data and target data. Table 2 below shows the source data configuration table for the rental contract in the SQL database. The source data is the original data stored in the SQL database, i.e., the correct data, as shown in Table 1 above. The target data is the data on the user page, i.e., the data to be modified, essentially a mapping of the source data. Errors may occur during application software operation, generating abnormal data. The corresponding source data, i.e., the correct data, can be found based on the abnormal data. Modification SQL statement parameters are generated based on the correct data in the source data. These parameters are then substituted into the second preset format to generate a complete modification SQL statement, i.e., the modification SQL statement corresponding to the source data. Before finding the field to be modified corresponding to the data type to be modified in the type field table, the modification SQL statement is configured on a base table to obtain the preset modification SQL table. This allows the modification SQL statement corresponding to the source data to be found based on the abnormal data. The preset modification SQL table is used to configure the modification SQL statement corresponding to the specified source data. The preset modification SQL table is the base table before the modification SQL statement corresponding to the source data to be modified is added. The generated modification SQL table is the base table after the complete modification SQL statement is added.
[0050] Source data for Table 2, the rental agreement form.
[0051] ID Name Telephone Contract amount 101 Zhang San 12345678910 1000 102 Li Si 12345678911 1100 103 Wang Wu 12345678912 1200 104 Zhao Liu 12345678913 1300
[0052] This embodiment generates the query SQL statement corresponding to the field to be modified according to the first preset format and adds it to the query SQL table. It also generates the modification SQL statement corresponding to the source data according to the second preset format and adds it to the modification SQL table. This allows users to query and modify data without having to provide feedback to the operations and maintenance administrator and have the administrator write the SQL statement. This simplifies the data modification process and saves a lot of time and manpower.
[0053] Optionally, step S40, namely, validating the data of the field to be modified according to the validation formula and generating a field validation result, includes:
[0054] S401. Load the query SQL table and find the query SQL statement corresponding to the field to be modified in the query SQL table;
[0055] S402. Execute the query SQL statement to query the database and obtain the target data of the field to be modified;
[0056] S403. Verify the target data according to the verification formula and generate field verification results.
[0057] Understandably, in this embodiment, when the field to be modified is the telephone number field, the corresponding query SQL statement is found in the query SQL table as "select telephone number from rental contract table". This statement is executed to query the database, obtaining the target data ("12345678910", "12345678911", "12345678912", and "12345678914") corresponding to the telephone number field in the rental contract table. The telephone number verification formula is obtained, and the data object corresponding to the telephone number field is verified row by row according to the formula, obtaining normal telephone number data ("12345678910", "12345678911", "12345678912") and abnormal telephone number data ("12345678914"), generating the verification result.
[0058] This embodiment finds the corresponding SQL statement in the query SQL table that corresponds to the field to be modified, executes the query SQL statement to query the database to obtain the target data, and verifies the target data according to the verification formula corresponding to the field to be modified, generating the field verification result. This allows users to perform self-service query and verification without having to provide feedback to the operation and maintenance administrator, simplifying the data modification process.
[0059] Optionally, step S50, namely determining the abnormal data of the field to be modified based on the field validation result and updating the abnormal data to complete the data modification, includes:
[0060] S501. If the field validation result is abnormal, then obtain the source data of the field to be modified.
[0061] S502. Load the modified SQL table and find the modified SQL statement corresponding to the source data in the modified SQL table;
[0062] S503. Execute the modified SQL statement to modify the database, so as to write the source data into the field to be modified.
[0063] Understandably, in this embodiment, based on the field validation results, no operation is performed on normal phone data ("12345678910", "12345678911", "12345678912"), while for abnormal phone data ("12345678914"), the correct data ("12345678913") corresponding to the phone number field in the source data is obtained, and the corresponding modification SQL statement "update rental contract table set phone number = 12345678913 where ID = 104" is found in the modification SQL table. This statement is executed to modify the database, and the correct data is entered into the phone number field on the user page to complete the data modification. During the entry process, the backend will perform corresponding statement format validation on the entered correct data. After all statement format validations pass, the submitted correct data will be further checked for security issues such as SQL injection and XSS attacks. Once the detection passes, the modification of abnormal data can be completed.
[0064] This embodiment modifies the database by finding the corresponding modification SQL statement in the SQL table that corresponds to the source data of the abnormal data, and then executing the modification SQL statement to enter the source data as the correct data. This allows users to modify the data themselves without relying on the operations and maintenance administrator to modify the code and redeploy the application version, simplifying the data modification process. Format validation and security checks are performed during data entry to ensure the security of the data modification. At the same time, data modification can be configured in real time, improving the efficiency of data modification.
[0065] Optionally, step S10, that is, before selecting the data type to be modified from the data modification type table according to the data type selection instruction, includes:
[0066] S101: Receive a data modification type addition instruction, and create a data addition / modification type according to the data modification type addition instruction;
[0067] S102. Determine whether the data addition / modification type exists in the preset modification type table. The preset modification type table is used to configure the specified data modification type.
[0068] S103. If the data addition / modification type does not exist in the preset modification type table, the data addition / modification type is added to the preset modification type table to generate the data modification type table.
[0069] In essence, all modifiable data types in the database are configured onto a single base table to create a preset modification type table. This table is used to configure specified data modification types, allowing users to select the data type to be modified. Besides being used for user selection, the preset modification type table is continuously updated as data modification types in the database change. When the data types in the modification type table cannot meet the modification requirements, a new data modification type instruction can be generated and the corresponding new modification type added to the existing modification type table. The preset modification type table is the base table before the addition of the new modification type, and the generated data modification type table is the base table after the addition of the new modification type. In this embodiment, if a user wants to modify string data, a new string data modification type is created. The system checks if a new string data modification type exists in the preset modification type table. If it does not exist, the new string data modification type is added to the preset modification type table, thus generating the new data modification type table.
[0070] This embodiment uses the data modification type addition command to add and update data modification types, thereby integrating different data modification types together. The data modification type table is generated and updated before the user selects a data modification type, which facilitates user operation and ensures the efficiency of data modification.
[0071] Optionally, step S20, before obtaining the type field table and finding the field to be modified corresponding to the data type to be modified in the type field table, further includes:
[0072] S205. Parse the data addition / modification type to obtain the display field corresponding to the data addition / modification type;
[0073] S206. Add a new field according to the display field creation type;
[0074] S207. Add the new field of the type to the preset field table to generate the type field table.
[0075] Understandably, a display field is the field or name that a data type needs to display. When a new data modification type appears in the data modification type table, the new data modification type is parsed to obtain the corresponding display field. When an existing data modification type has a new column, a new type field is created based on the display field of the new column. A preset field table is used to configure the type fields corresponding to a specified data type. The type fields corresponding to the specified data modification type in the data modification type table are configured on a base table to obtain the preset field table, so that the corresponding field to be modified can be found based on the data type to be modified. Besides finding the field to be modified, the preset field table can also be continuously updated when the type fields corresponding to the data modification type change. The preset field table is the base table before adding the new type field, and the generated type field table is the base table after adding the new type field. In this embodiment, a string data modification type is added to the data modification type table. The display field corresponding to the string data modification type in Table 1 is the name field. Therefore, a new name field is created. It is checked whether the new name field exists in the preset field table. If the new name field does not exist in the preset field table, it is added to the preset field table to generate the type field table.
[0076] This embodiment creates new fields for data additions and modifications by parsing the data addition and modification types, thereby integrating the type fields corresponding to the data modification types together, making it easier to find the corresponding type fields and ensuring the efficiency of data modification.
[0077] Optionally, step S30, i.e., before obtaining the validation formula table and finding the validation formula corresponding to the field to be modified in the validation formula table, includes:
[0078] S301. Determine whether a validation formula corresponding to the newly added field of the specified type exists in the database;
[0079] S302. If it exists, obtain the verification formula corresponding to the newly added field of the type as the new verification formula; if it does not exist, create the new verification formula corresponding to the newly added field of the type according to the pre-configured verification rules.
[0080] S303. Add the newly added verification formula to the preset formula table to generate the verification formula table.
[0081] Understandably, the preset formula table is used to configure validation formulas for specified type fields. A validation formula is used to validate a column of data objects contained in a type field. The preset formula table is created by configuring the validation formulas for specified type fields in the type field table onto a base table, allowing the lookup of the corresponding validation formula based on the field to be modified. Besides finding the validation formula for the field to be modified, the preset formula table is also continuously updated as the validation formulas for type fields change. When a new type field is added to the type field table, the database is queried to determine if a validation formula exists for the new type field. If it exists, the validation formula is imported from the database according to user permissions and added as the new validation formula. If it does not exist, a new validation formula is created based on the pre-configured validation rules for the data objects in the database and added to the preset formula table. The preset formula table is the base table before adding the new validation formula, while the generated validation formula table is the base table after adding the new validation formula. In this embodiment, a name field is added to the type field table. The system checks whether a name verification formula exists in the database to create a new name verification formula. It further checks whether a new name verification formula exists in the preset formula table. If a new name verification formula does not exist in the preset formula table, the new name verification formula is added to the preset formula table to generate a verification formula table.
[0082] This embodiment determines the new validation formula corresponding to the newly added field by judging the validation formula in the database, thereby realizing the addition and updating of the new validation formula. This integrates the validation formulas corresponding to the type fields, making it easier to find the validation formula corresponding to the type fields, ensuring the accuracy of validation and the efficiency of data modification.
[0083] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0084] In one embodiment, a data modification apparatus is provided, which corresponds one-to-one with the data modification methods described in the above embodiments. For example... Figure 2 As shown, the data modification device includes a type selection module 10, a field search module 20, a formula search module 30, a formula validation module 40, and a data modification module 50. Detailed descriptions of each functional module are as follows:
[0085] Type selection module 10 is used to receive data type selection instructions and select the data type to be modified from the data modification type table according to the data type selection instructions;
[0086] The field lookup module 20 is used to obtain a type field table and find the field to be modified that corresponds to the data type to be modified in the type field table.
[0087] Formula lookup module 30 is used to obtain a verification formula table and find the verification formula corresponding to the field to be modified in the verification formula table.
[0088] Formula validation module 40 is used to validate the data of the field to be modified according to the validation formula and generate field validation results;
[0089] The data modification module 50 is used to determine the abnormal data of the field to be modified based on the field verification result, and update the abnormal data to complete the data modification.
[0090] Optionally, the field lookup module 20 includes:
[0091] The query SQL statement generation unit is used to generate the query SQL statement corresponding to the field to be modified according to the first preset format.
[0092] The query SQL table generation unit is used to add the query SQL statement to a preset query SQL table to generate the query SQL table; the preset query SQL table is used to configure the query SQL statement corresponding to a specified field.
[0093] The SQL statement generation unit is used to obtain multiple source data of the field to be modified, and generate multiple modification SQL statements corresponding to the multiple source data according to a second preset format.
[0094] The SQL table generation unit is used to add the multiple modification SQL statements to a preset modification SQL table to generate a modification SQL table; the preset modification SQL table is used to configure the modification SQL statements corresponding to specified source data.
[0095] Optionally, the formula validation module 40 includes:
[0096] The SQL statement retrieval unit is used to load the SQL table and find the SQL statement corresponding to the field to be modified in the SQL table.
[0097] The data query unit is used to execute the query SQL statement to query the database and obtain the target data of the field to be modified;
[0098] The data verification unit is used to verify the target data according to the verification formula and generate field verification results.
[0099] Optionally, the data modification module 50 includes:
[0100] The source data acquisition unit is used to acquire the source data of the field to be modified if the field validation result is abnormal.
[0101] The modified SQL statement acquisition unit is used to load the modified SQL table and find the modified SQL statement corresponding to the source data in the modified SQL table.
[0102] The data modification unit is used to execute the modification SQL statement to modify the database, so as to write the source data into the field to be modified.
[0103] Optionally, the type selection module 10 includes:
[0104] The data modification type addition unit is used to receive a data modification type addition instruction and create a data addition modification type according to the data modification type addition instruction;
[0105] The update type table judgment unit is used to determine whether the data addition / modification type exists in the preset modification type table, and the preset modification type table is used to configure the specified data modification type.
[0106] The data modification type table generation unit is used to add the data addition modification type to the preset modification type table if the data addition modification type does not exist in the preset modification type table, thereby generating the data modification type table.
[0107] Optionally, the field lookup module 20 also includes:
[0108] A new modification type parsing unit is added to parse the data addition and modification type and obtain the display field corresponding to the data addition and modification type;
[0109] The "Type Add Field Creation Unit" is used to create a new field for the type based on the displayed field.
[0110] The type field table generation unit is used to add the new type field to a preset field table to generate the type field table.
[0111] Optionally, the formula lookup module 30 includes:
[0112] The validation formula query and judgment unit is used to determine whether a validation formula corresponding to the newly added field of the specified type exists in the database.
[0113] The verification formula generation unit is used to obtain the verification formula corresponding to the newly added field of the type as the verification formula if it exists; otherwise, it creates the verification formula corresponding to the newly added field of the type according to the pre-configured verification rules.
[0114] The verification formula table generation unit is used to add the newly added verification formula to a preset formula table to generate the verification formula table.
[0115] For specific limitations regarding the data modification device, please refer to the limitations on the data modification method above, which will not be repeated here. Each module in the aforementioned data modification device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0116] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 3 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a readable storage medium and internal memory. The readable storage medium stores an operating system, computer-readable instructions, and a database. The internal memory provides an environment for the operation of the operating system and computer-readable instructions in the readable storage medium. The database stores data involved in data modification methods. The network interface communicates with external terminals via a network connection. When the computer-readable instructions are executed by the processor, a data modification method is implemented. The readable storage medium provided in this embodiment includes both non-volatile readable storage media and volatile readable storage media.
[0117] In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor performs the following steps when executing the computer-readable instructions:
[0118] Receive a data type selection instruction, and select the data type to be modified from the data modification type table according to the data type selection instruction;
[0119] Obtain the type field table, and find the field to be modified that corresponds to the data type to be modified in the type field table;
[0120] Obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table;
[0121] The data of the field to be modified is validated according to the validation formula, and a field validation result is generated.
[0122] Based on the field validation results, abnormal data in the field to be modified is determined, and the abnormal data is updated to complete the data modification.
[0123] In one embodiment, one or more computer-readable storage media storing computer-readable instructions are provided. The readable storage media provided in this embodiment include non-volatile readable storage media and volatile readable storage media. The readable storage media stores computer-readable instructions, which, when executed by one or more processors, perform the following steps:
[0124] Receive a data type selection instruction, and select the data type to be modified from the data modification type table according to the data type selection instruction;
[0125] Obtain the type field table, and find the field to be modified that corresponds to the data type to be modified in the type field table;
[0126] Obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table;
[0127] The data of the field to be modified is validated according to the validation formula, and a field validation result is generated.
[0128] Based on the field validation results, abnormal data in the field to be modified is determined, and the abnormal data is updated to complete the data modification.
[0129] 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 instructing related hardware with computer-readable instructions. These computer-readable instructions can be stored in a non-volatile readable storage medium or a volatile readable storage medium. When executed, these computer-readable instructions can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0130] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0131] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A data modification method, characterized in that, include: Receive a data type selection instruction, and select the data type to be modified from the data modification type table according to the data type selection instruction; Obtain the type field table, and find the field to be modified that corresponds to the data type to be modified in the type field table; Obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table; The data of the field to be modified is validated according to the validation formula, and a field validation result is generated. Based on the field validation results, abnormal data in the field to be modified is determined, and the abnormal data is updated to complete the data modification. The step of obtaining the type field table and searching for the field to be modified corresponding to the data type to be modified in the type field table includes: Generate the query SQL statement corresponding to the field to be modified according to the first preset format; Add the query SQL statement to the preset query SQL table to generate the query SQL table; the preset query SQL table is used to configure the query SQL statement corresponding to the specified type field. Obtain multiple source data of the field to be modified, and generate multiple modification SQL statements corresponding to the multiple source data according to the second preset format; The multiple modification SQL statements are added to a preset modification SQL table to generate the modification SQL table; the preset modification SQL table is used to configure the modification SQL statements corresponding to the specified source data. The step of validating the data of the field to be modified according to the validation formula and generating a field validation result includes: Load the query SQL table and find the query SQL statement corresponding to the field to be modified in the query SQL table; The SQL query statement is executed to query the database and obtain the target data of the field to be modified. The target data is validated according to the validation formula to generate field validation results.
2. The data modification method as described in claim 1, characterized in that, The step of determining abnormal data in the field to be modified based on the field validation result, and updating the abnormal data to complete the data modification, includes: If the field validation result is abnormal, then obtain the source data of the field to be modified; Load the modified SQL table and find the modified SQL statement corresponding to the source data in the modified SQL table; The modified SQL statement is executed to modify the database, so as to write the source data into the field to be modified.
3. The data modification method as described in claim 1, characterized in that, Before selecting the data type to be modified from the data modification type table according to the data type selection instruction, the process includes: Receive a data modification type addition instruction, and create a data addition / modification type according to the data modification type addition instruction; Determine whether the data addition / modification type exists in the preset modification type table, where the preset modification type table is used to configure specified data types; If the data addition / modification type does not exist in the preset modification type table, then the data addition / modification type is added to the preset modification type table to generate the data modification type table.
4. The data modification method as described in claim 3, characterized in that, Before obtaining the type field table and finding the field to be modified corresponding to the data type to be modified in the type field table, the method further includes: The data addition / modification type is parsed to obtain the display field corresponding to the data addition / modification type; Add a new field based on the type of the displayed field; Add the new field of the specified type to the preset field table to generate the field table of the specified type.
5. The data modification method as described in claim 4, characterized in that, Before obtaining the validation formula table and finding the validation formula corresponding to the field to be modified in the validation formula table, the process includes: Determine if a validation formula corresponding to the newly added field of the specified type exists in the database; If it exists, the validation formula corresponding to the newly added field of the type is obtained as the new validation formula; if it does not exist, the new validation formula corresponding to the newly added field of the type is created according to the pre-configured validation rules. The newly added verification formula is added to the preset formula table to generate the verification formula table.
6. A data modification device, characterized in that, include: The type selection module is used to receive a data type selection instruction and select the data type to be modified from the data modification type table according to the data type selection instruction; The field lookup module is used to obtain a type field table and find the field to be modified that corresponds to the data type to be modified in the type field table. The formula lookup module is used to obtain the validation formula table and find the validation formula corresponding to the field to be modified in the validation formula table. The formula validation module is used to validate the data of the field to be modified according to the validation formula and generate the field validation result. The data modification module is used to determine the abnormal data of the field to be modified based on the field verification result, and update the abnormal data to complete the data modification; The field lookup module includes: The query SQL statement generation unit is used to generate the query SQL statement corresponding to the field to be modified according to the first preset format. The query SQL table generation unit is used to add the query SQL statement to a preset query SQL table to generate the query SQL table; the preset query SQL table is used to configure the query SQL statement corresponding to a specified field. The SQL statement generation unit is used to obtain multiple source data of the field to be modified, and generate multiple modification SQL statements corresponding to the multiple source data according to a second preset format. The SQL table generation unit is used to add the multiple modification SQL statements to a preset modification SQL table to generate a modification SQL table; the preset modification SQL table is used to configure the modification SQL statements corresponding to specified source data. The formula verification module includes: The SQL statement retrieval unit is used to load the SQL table and find the SQL statement corresponding to the field to be modified in the SQL table. The data query unit is used to execute the query SQL statement to query the database and obtain the target data of the field to be modified; The data verification unit is used to verify the target data according to the verification formula and generate field verification results.
7. A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, characterized in that, When the processor executes the computer-readable instructions, it implements the data modification method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, the one or more processors cause the data modification method as described in any one of claims 1 to 5 to be performed.
Citation Information
Patent Citations
An SQLServer database field batch modification method and device
CN113157672A
Data storage method and device, electronic equipment and computer readable medium
CN114428815A