Method and device for realizing configuration information consistency in test environment
By updating configuration information in the benchmark database in real time and converting database operation statements using bytecode injection technology, the problem of low synchronization and timeliness of configuration information in multiple test environments is solved, and configuration information consistency and testing efficiency are improved.
Patent Information
- Application Number
- CN202411102210.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2024-12-13
AI Technical Summary
In multiple test environments, the synchronization of configuration information in the prior art is low, resulting in delayed update of the configuration tables of the benchmark database and the test environment, affecting the smooth progress of the test work and the reliability of the results.
By updating configuration information in the benchmark database in real time, and using bytecode injection technology to identify and convert database operation statements, the operation of the configuration table is directly performed in the benchmark database to ensure the latest status of the configuration table.
It improves the accuracy of configuration tables in the benchmark database, reduces the time for configuration information consistency checks, improves the consistency efficiency of configuration information in the test environment, and reduces the resource requirements of synchronization tools.
Smart Images

Figure CN119127668A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of database technology, and in particular to a method and device for achieving configuration information consistency in a test environment. Background Art
[0002] In the modern agile development model, multiple test environments are usually required for testing new versions. In order to ensure the consistency of software behavior in multiple test environments, the consistency of configuration information in each test environment becomes crucial. Currently, the method to ensure the consistency of configuration information in multiple test environments is to use a benchmark database solution.
[0003] In the existing method, each test environment has a local configuration table, and the content in the local configuration table is synchronized to the configuration table of the benchmark database through a synchronization tool, and then the content in the configuration table of the benchmark database is synchronized to other test environments through a synchronization tool. However, since synchronization takes a certain amount of time, the synchronization timeliness is low, and the content in the configuration table of the benchmark database is delayed in updating, which affects the smooth progress of the test work and the reliability of the results. Summary of the invention
[0004] The present application provides a method and device for achieving consistency of configuration information in a test environment, which are used to update the changes of configuration information in each test environment in a benchmark database in real time, thereby improving the accuracy of the configuration table in the benchmark database.
[0005] In a first aspect, an embodiment of the present application provides a method for achieving configuration information consistency in a test environment, the method being applicable to multiple test environments, each test environment having a business database corresponding to its own business system; the configuration information in any business database originates from a corresponding reference database in the operating environment; the method can be executed by a device for configuration information consistency, the method comprising: for a first database operation statement triggered on any business system in any test environment, determining whether the first database operation statement is an operation on a configuration table in the business database; if so, converting the first database operation statement into a second database operation statement and executing the second database operation statement through the reference database; the configuration table records each configuration information.
[0006] By adopting the above method, if the first database operation statement is identified as an operation on the configuration table in the business database, the first database operation statement is converted into a second database operation statement, and the second database operation statement is executed through the reference database. In this way, when it comes to operating the configuration table in the business database, the business database is switched to the reference database, and the operation on the configuration table in the business database is switched to the operation on the configuration table in the reference database. In addition, the configuration table in the reference database can be updated in real time according to the first database operation statement, so that the configuration table in the reference database is kept up to date.
[0007] In a possible implementation manner, the method further includes: if the first database operation statement does not operate a configuration table in the business database, executing the first database operation statement in the business database.
[0008] By adopting the above method, if the first database operation statement does not operate the configuration table in the business database, the first database operation statement can be directly executed through the business database of the test environment without switching the database.
[0009] In a possible implementation, converting the first database operation statement into a second database operation statement includes: replacing the table name of the first data table in the first database operation statement with the table name of the second data table in the reference database to obtain the second database operation statement.
[0010] In a possible implementation, the table name of any configuration table in the reference database is generated according to the database name of the business database and the table name of the configuration table in the business database.
[0011] Using the above method, the configuration table in the benchmark database is named based on the library name of the business database and the table name of the configuration table in the business database. In this way, based on the table name of the first data table and the business database where the first data table is located, it can be quickly determined whether the first data table is a configuration table.
[0012] In a possible implementation, determining whether the first database operation statement is an operation on a configuration table in the business database includes: determining a first data table in the business database corresponding to the first database operation statement; determining whether the first data table is a configuration table in which various configuration information is set; if it is a configuration table, the first database operation statement is an operation on the configuration table in the business database.
[0013] By adopting the above method, the first data table is determined according to the first database operation statement, and whether the first data table is a configuration table is determined according to whether the first data table is provided with configuration information. In this way, it can be determined by the content of the first data table whether the first database operation statement is an operation on the configuration table in the business database.
[0014] In a possible implementation, determining whether the first database operation statement is for operating a configuration table in the business database includes: performing calculations according to preset rules on the business database operation statements except for a parameter part in the first database operation statement to obtain an identification value corresponding to the first database operation statement; and determining whether the first database operation statement is for operating the configuration table in the business database based on whether the identification value is recorded in a mapping relationship; wherein the mapping relationship includes a correspondence between the business database operation statement, the identification value, and the benchmark database operation statement.
[0015] By adopting the above method, the identification value is obtained by calculating the business database operation statement except the parameter part in the first database operation statement. If the identification value exists in the mapping relationship, it is determined that the first database operation statement is to operate the configuration table in the business database. Since the time taken to calculate the identification value for the business database operation statement and to query whether the identification value exists in the mapping relationship is short, it is more efficient to determine whether the first database operation statement is to operate the configuration table in the business database by this method, thereby improving the efficiency of achieving configuration information consistency in the test environment.
[0016] In a possible implementation, converting the first database operation statement into a second database operation statement includes: determining a benchmark database operation statement corresponding to the identification value through the mapping relationship; and constructing a second database operation statement according to the benchmark database operation statement corresponding to the identification value and the parameter part.
[0017] With the above method, since the mapping relationship includes the business database operation statement, the identification value and the benchmark database operation statement, the second database operation statement can be quickly constructed according to the benchmark database operation statement corresponding to the first database operation statement and the parameters included in the first database operation statement.
[0018] In a possible implementation, the mapping relationship is obtained in the following manner, including: obtaining an SQL statement of any business system; for any SQL statement, determining whether the SQL statement is an operation on a configuration table of the business system; if so, performing a calculation according to a preset rule on the business database operation statement except for a parameter part in the SQL statement to obtain a corresponding identification value; changing the table name of the configuration table of the business system in the SQL statement to the table name of the configuration table of the base database to obtain a benchmark database operation statement; and constructing a correspondence between the business database operation statement, the identification value, and the benchmark database operation statement.
[0019] By adopting the above method, the corresponding relationship between the business database operation statement, the identification value and the reference database operation statement is determined by calculating the identification value of the SQL statement that operates the configuration table in the business database and determining the reference database operation statement corresponding to the SQL statement. When the first database operation statement is triggered, the identification value of the business database excluding the parameter part in the first database operation statement can be calculated, and then the reference database operation statement can be quickly determined according to the identification value.
[0020] In a second aspect, an embodiment of the present application provides a device for achieving consistency of configuration information in a test environment, the device comprising: a determination module for determining, for a first database operation statement triggered on any business system under any test environment, whether the first database operation statement is an operation on a configuration table in the business database; a processing module for, if so, converting the first database operation statement into a second database operation statement and executing the second database operation statement through the benchmark database; the configuration table records various configuration information.
[0021] In a possible implementation, the processing module is further configured to, if the first database operation statement does not operate a configuration table in the business database, execute the first database operation statement in the business database.
[0022] In a possible implementation, the device further includes a modification module, and the modification module is used to replace the table name of the first data table in the first database operation statement with the table name of the second data table in the reference database to obtain a second database operation statement.
[0023] In a possible implementation, the determination module is specifically used to determine a first data table corresponding to the first database operation statement in the business database; and determine whether the first data table is a configuration table in which various configuration information is set.
[0024] In a possible implementation, the device also includes a calculation module, which is used to perform calculations according to preset rules on the business database operation statements except the parameter part in the first database operation statement to obtain an identification value corresponding to the first database operation statement; the determination module is also used to determine whether the first database operation statement is an operation on a configuration table in the business database according to whether the identification value is recorded in a mapping relationship; wherein the mapping relationship includes a correspondence between the business database operation statement, the identification value and the benchmark database operation statement.
[0025] In a possible implementation, the determination module is also specifically used to determine the benchmark database operation statement corresponding to the identification value through the mapping relationship; the device also includes a construction module, which is used to construct a second database operation statement based on the benchmark database operation statement corresponding to the identification value and the parameter part.
[0026] In a possible implementation, the device also includes an acquisition module, which is used to acquire an SQL statement of any business system; the determination module is also used to determine, for any SQL statement, whether the SQL statement is an operation on a configuration table of the business system; the calculation module is also used to, if so, perform a calculation according to a preset rule on the business database operation statement except for the parameter part in the SQL statement to obtain a corresponding identification value; the change module is used to change the table name of the configuration table of the business system in the SQL statement to the table name of the configuration table of the base database to obtain a benchmark database operation statement; the construction module is also used to construct a correspondence between the business database operation statement, the identification value and the benchmark database operation statement.
[0027] In a third aspect, an embodiment of the present application further provides a device for implementing consistency of configuration information, the device comprising a memory and a processor, the memory being used to store computer programs or instructions; the processor being used to call the computer programs or instructions stored in the memory to execute a method as in any possible implementation of the first aspect.
[0028] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When a computer reads and executes the instructions, the computer executes a method in any possible implementation of the first aspect.
[0029] In a fifth aspect, an embodiment of the present application provides a computer program product, wherein instructions are stored in the computer program product. When a computer reads and executes the instructions, the computer executes the method in any possible implementation of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0031] Figure 1 A flowchart corresponding to a method for achieving configuration information consistency in a test environment provided in an embodiment of the present application;
[0032] Figure 2 A schematic diagram of the relationship between a configuration table in a test environment and a configuration table in a reference database provided in an embodiment of the present application;
[0033] Figure 3 A schematic diagram of internal modules of an apparatus 3000 for achieving consistency of configuration information provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of the structure of a device 4000 for implementing configuration information consistency provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0036] In the agile development model, the development team needs to frequently deliver new versions of the software in a short period of time. In order to ensure the smooth development of the new version, multiple test environments are usually required. The software behavior in multiple test environments needs to be consistent, so the consistency of database configuration tables in multiple test environments becomes crucial. These configuration tables usually include key environment setting information, connection parameters, and other necessary configuration information.
[0037] In the prior art, a common method for ensuring the consistency of database configuration tables in multiple test environments is to adopt a benchmark database solution, and the benchmark database can be used as a unified configuration standard for each test environment. Specifically, a benchmark database is created in a benchmark test environment, and the benchmark database contains the configuration tables required for all test environments. That is, if the database about the configuration table in the local of test environment A includes database 1, database 2 and database 3, database 1 includes configuration table 1, configuration table 2 and configuration table 3, database 2 includes configuration table 4, and database 3 includes configuration table 5, then the benchmark test environment also has three benchmark databases, namely benchmark database 1, benchmark database 2 and benchmark database 3. Similarly, benchmark database 1 includes configuration table 1, configuration table 2 and configuration table 3, benchmark database 2 includes configuration table 4, and benchmark database 3 includes configuration table 5. The configuration tables in other test environments are also the same as those in test environment A.
[0038] When the configuration table of the test environment needs to be changed, the local configuration table of the test environment will change. There is a synchronization tool in the prior art. The synchronization tool can synchronize the local configuration table of the test environment to the benchmark database at regular intervals. In addition, other test environments can also synchronize the configuration table from the benchmark database to the local configuration table corresponding to each test environment at regular intervals. In this way, by regularly synchronizing the local configuration table of each test environment to the benchmark database and regularly synchronizing the benchmark database to the local configuration table of the test environment, the benchmark database in the benchmark test environment and the local configuration table of each test environment are synchronized. However, since there is a time interval for synchronization of the synchronization tool, and the synchronization of the configuration table also takes time, the benchmark database in the benchmark test environment cannot always be kept the same as the local configuration table of the test environment, and the synchronization timeliness is low, which may cause the local configuration table in the test environment and the configuration table in the benchmark database to have an inconsistent window period, thereby affecting the smooth progress of the test work and the reliability of the results. In addition, in the prior art, since the benchmark database and the local database are synchronized by the synchronization tool, the number of benchmark databases needs to be consistent with the number of local databases, and creating a database requires a lot of resources, which may put forward high requirements on the infrastructure and operation and maintenance capabilities of the enterprise, and the cost is high.
[0039] Based on this, an embodiment of the present application provides a method for achieving consistency of configuration information in a test environment, which is used to update changes in configuration information in each test environment in a benchmark database in real time, thereby improving the accuracy of the configuration table in the benchmark database.
[0040] Figure 1 The flowchart of the method for achieving configuration information consistency in a test environment provided in an embodiment of the present application can be executed by a device for achieving configuration information consistency in a test environment (hereinafter referred to as a device for achieving configuration information consistency). Figure 1As shown, the process includes the following steps:
[0041] Step 101 , the apparatus for achieving consistency of configuration information determines, for a first database operation statement triggered on any business system in any test environment, whether the first database operation statement is an operation on a configuration table in a business database.
[0042] Specifically, the method is applicable to multiple test environments, each test environment has one or more business systems, each business system has a corresponding business database, the business database includes a business data table and a configuration table, and the configuration information of the configuration table in any business database comes from the corresponding benchmark database in the operating environment.
[0043] For example, Figure 2 A schematic diagram of the relationship between a configuration table in a test environment and a configuration table in a reference database provided in an embodiment of the present application, Figure 2 Only one test environment is used as an example for illustration, and the embodiment of the present application does not limit the number of test environments. Figure 2 As shown, there are three business systems in the test environment, and the three business systems correspond to database 1, database 2 and database 3 respectively. Database 1 includes configuration table 1, configuration table 2 and configuration table 3, database 2 includes configuration table 4, and database 3 includes configuration table 5. As for other databases under the business system, the embodiments of the present application do not impose any restrictions.
[0044] The test environment also includes a benchmark library identification module, which includes a bytecode injection component. Bytecode injection is a technology that dynamically modifies the bytecode of a program at runtime. Through bytecode injection, additional code can be inserted during program runtime to intercept and process specific operations, such as executing Structured Query Language (SQL). SQL is a standardized language for managing and operating relational databases. SQL statements can be used to query, update, insert, and delete data in a database.
[0045] The bytecode injection component can identify database operation statements triggered on the business system, and for the first database operation statement triggered on any business system, determine whether the first database operation statement is an operation on a configuration table in the business database.
[0046] Specifically, before the bytecode injection component identifies the database operation statement triggered on the business system, it can perform an initialization operation on the database operation statement on the business system. The initialization operation is used to build a correspondence between the business database operation statement, the identification value, and the benchmark database operation statement. Exemplarily, an SQL statement of any business system is obtained, and for any SQL statement, it is determined whether the SQL statement is an operation on the configuration table of the business system. If so, the business database operation statement except the parameter part in the SQL statement is calculated according to the preset rules to obtain the corresponding identification value. The table name of the configuration table of the business system in the SQL statement is changed to the table name of the configuration table of the benchmark database, the benchmark database operation statement is obtained, and the correspondence between the business database operation statement, the identification value, and the benchmark database operation statement is built.
[0047] For example, usually SQL statements will exist in the system code in the form of a certain resource file, optionally, it can be in the form of a Mybatis resource file. Get the SQL statement of any business system. The SQL statement has no parameters before execution (initialization stage), such as SELECT value FROM t_aWHERE name=hua, hua is the parameter of the SQL statement. When it is actually executed, the SQL statement has the assigned parameter hua. Before the actual execution, the SQL statement has no parameters, which is SELECT value FROM t_a WHERE name=. To determine whether the SQL statement is an operation on the configuration table of the business system, the table name t_a of the data table corresponding to the SQL statement can be parsed. The name of the configuration table in the business system of the test environment has a mapping relationship with the table name of the configuration table in the benchmark database. If the table name t_a of the data table exists in the mapping relationship, the data table is a configuration table, and then the SQL statement is an operation on the configuration table of the business system. Regarding the method of determining a data table from an SQL statement, this application does not make specific restrictions.
[0048] Optionally, the table name of any configuration table in the benchmark database in the mapping relationship can be generated according to the database name of the business database and the table name of the configuration table in the business database, that is, if the configuration table in the benchmark database corresponds to the configuration table t_a in the business system 1, and the business database corresponding to the business system 1 is the database DB_1, then the table name of the configuration table in the benchmark database is DB_1_t_a. Therefore, when the table name of the data table corresponding to the SQL statement is obtained as t_a, combined with the fact that the SQL statement is an SQL statement under the business system 1, it can be determined that the table name corresponding to the data table in the SQL statement is DB_1_t_a. If there is a configuration table DB_1_t_a in the benchmark database, it can be determined that the data table in the SQL statement is a configuration table.
[0049] If the data table in the SQL statement is a configuration table, the business database operation statement in the SQL statement except the parameter part is calculated according to the preset rule to obtain the corresponding identification value. The preset rule can be a preset function. This application uses the md5 algorithm to calculate the hash value of the business database operation statement. This application does not specifically limit the preset rule. The exemplary business database operation statement and the corresponding hash value are shown in Table 1:
[0050] Table 1
[0051]
[0052] Further, the business database operation statement is saved in the memory, and the table name of the configuration table of the business system in the business database operation statement is changed to the table name of the configuration table of the benchmark database, to obtain the benchmark database operation statement, and according to the mapping relationship between the name of the configuration table in the business system and the table name of the configuration table in the benchmark database, the table name of the configuration table of the benchmark database corresponding to the table name of the configuration table of the business system can be determined. Exemplarily, the business database operation statement and the benchmark database operation statement are shown in Table 2:
[0053] Table 2
[0054]
[0055] In this way, according to Table 1 and Table 2, the correspondence between the business database operation statement, the identification value and the benchmark database operation statement can be constructed. The business database operation statement, the identification value and the benchmark database operation statement are stored in the memory, so that when the database operation statement is executed, the benchmark database operation statement can be determined according to the mapping relationship between the three stored in the memory.
[0056] After the initialization is completed, in the actual execution stage, the bytecode injection component identifies the first database operation statement triggered on the business system. The first database operation statement includes parameters, and the business database operation statement in the first database operation statement except the parameter part is calculated according to the preset rules. The preset rules should be consistent with the preset rules in the initialization stage, that is, the present application also uses the md5 algorithm to calculate the business database operation statement in the execution stage to obtain the identification value corresponding to the first database operation statement. According to the mapping relationship between the business database operation statement, the identification value and the benchmark database operation statement stored in the memory, it is determined whether the identification value corresponding to the first database operation statement is recorded in the mapping relationship. If it exists, the first database operation statement operates the configuration table in the business database. If it does not exist, the first database operation statement does not operate the configuration table in the business database.
[0057] Step 102: If yes, convert the first database operation statement into a second database operation statement and execute the second database operation statement through the reference database.
[0058] Specifically, the benchmark database operation statement corresponding to the identification value is determined through the mapping relationship between the business database operation statement, the identification value and the benchmark database operation statement stored in the memory. The second database operation statement is constructed according to the parameters included in the first database operation statement and the benchmark database operation statement. For example, the first database operation statement is SELECT value FROM t_a WHERE name=hua, the parameter included in the first database operation statement is hua, the business database operation statement of the first database operation statement excluding the parameter part is SELECT value FROM t_a WHEREname=, and the identification value of the business database operation statement is the identification value corresponding to the first database operation statement. According to the identification value, the benchmark database operation statement corresponding to the business database operation statement can be determined, that is, SELECT value FROM t_aWHERE name= corresponds to SELECT value FROM DB_1_t_a WHERE name= , Then, based on the parameter hua and the benchmark database operation statement SELECT value FROM DB_1_t_a WHERE name=, construct the second database operation statement SELECT value FROM DB_1_t_a WHERE name=hua. After constructing the second database operation statement, execute the second database operation statement through the benchmark database, so that the configuration table in the benchmark database can be updated in real time, so that the configuration table in the benchmark database remains up to date. When a database operation statement is triggered on a business system in other test environments, if the database operation statement is to operate on the configuration table in the business system, the corresponding operation is performed through the configuration table in the benchmark database.
[0059] It is understandable that when the configuration table in the benchmark database changes, the change information needs to be recorded at the same time so that the change information can be pushed to the test staff in the test environment so that the test staff can perceive the change of the configuration table in time. The method of the present application can realize the real-time update of the configuration table in the benchmark database, and the test staff can also obtain the update of the configuration table in the first time.
[0060] If the first database operation statement is not an operation on a configuration table in a business database, the first database operation statement is executed in the business database of the test environment.
[0061] In a possible implementation, the bytecode injection component may not perform initialization operations on the database operation statement before identifying the database operation statement triggered on the business system, that is, in the execution stage of the first database operation statement, determine whether the first database operation statement is an operation on the configuration table in the business database. Specifically, for the first database operation statement triggered on any business system, determine the first data table corresponding to the first database operation statement in the business database, and determine whether the first data table is a configuration table with various configuration information. If it is a configuration table, the first database operation statement is an operation on the configuration table in the business database. Further, replace the table name of the first data table in the first database operation statement with the table name of the second data table in the benchmark database to obtain the second database operation statement, and the second data table is the configuration table in the benchmark database corresponding to the first data table. Determine the table name of the second data table in the benchmark database according to the table name of the first data table as described above, which will not be repeated here. Then execute the second database operation statement through the benchmark database to update the configuration table in the benchmark database.
[0062] In the embodiment of the present application, since there is no need to use a synchronization tool to synchronize the configuration table of the database in the test environment with the configuration table in the benchmark database, the number of benchmark databases can be different from the number of databases in the test environment. Building a database consumes a lot of resources, so optionally, in the embodiment of the present application, the number of benchmark databases is one to save database creation costs.
[0063] Figure 3 A schematic diagram of the internal modules of an apparatus 3000 for achieving consistency of configuration information provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, the device may include: a determination module 301, a processing module 302, a change module 303, a calculation module 304, a construction module 305, and an acquisition module 306. Optionally, it also includes a storage module, and the storage module is used to store computer instructions or programs. The processing module 302 can call the computer instructions or programs in the storage module.
[0064] Among them, the determination module 301 is used to determine whether the first database operation statement triggered on any business system under any test environment is an operation on the configuration table in the business database; the processing module 302 is used to, if so, convert the first database operation statement into a second database operation statement and execute the second database operation statement through the benchmark database; the configuration table records various configuration information.
[0065] In a possible implementation, the processing module 302 is further configured to execute the first database operation statement in the business database if the first database operation statement does not operate a configuration table in the business database.
[0066] In a possible implementation, the device further includes a modification module 303, and the modification module 303 is used to replace the table name of the first data table in the first database operation statement with the table name of the second data table in the reference database to obtain a second database operation statement.
[0067] In a possible implementation, the determination module 301 is specifically used to determine a first data table corresponding to the first database operation statement in the business database; and determine whether the first data table is a configuration table in which various configuration information is set.
[0068] In a possible implementation, the device also includes a calculation module 304, and the calculation module 304 is used to perform a preset rule calculation on the business database operation statement except the parameter part in the first database operation statement to obtain an identification value corresponding to the first database operation statement; the determination module 301 is also used to determine whether the first database operation statement is an operation on the configuration table in the business database according to whether the identification value is recorded in the mapping relationship; wherein the mapping relationship includes the correspondence between the business database operation statement, the identification value and the benchmark database operation statement.
[0069] In a possible implementation, the determination module 301 is also specifically used to determine the benchmark database operation statement corresponding to the identification value through the mapping relationship; the device also includes a construction module 305, and the construction module 305 is used to construct a second database operation statement based on the benchmark database operation statement corresponding to the identification value and the parameter part.
[0070] In a possible implementation, the device further includes an acquisition module 306, and the acquisition module 306 is used to acquire an SQL statement of any business system.
[0071] The determination module 301 is also used to determine, for any SQL statement, whether the SQL statement is an operation on the configuration table of the business system; the calculation module 304 is also used to, if so, perform a calculation according to a preset rule on the business database operation statement in the SQL statement except for the parameter part to obtain a corresponding identification value; the device also includes a change module 303, and the change module 303 is used to change the table name of the configuration table of the business system in the SQL statement to the table name of the configuration table of the base database to obtain a benchmark database operation statement; the construction module 305 is also used to construct a correspondence between the business database operation statement, the identification value and the benchmark database operation statement.
[0072] Figure 4 A schematic diagram of a structure of a device 4000 for implementing configuration information consistency provided in an embodiment of the present application. Figure 4 As shown, it includes at least one processor 401 and a memory 402 connected to the at least one processor 401. The specific connection medium between the processor 401 and the memory 402 is not limited in the embodiment of the present application. Figure 4 For example, the processor 401 and the memory 402 are connected via a bus. The bus can be divided into an address bus, a data bus, a control bus, etc.
[0073] In the embodiment of the present application, the memory 402 stores instructions that can be executed by at least one processor 401. The at least one processor 401 can implement the steps of the method for achieving configuration information consistency in the above-mentioned test environment by executing the instructions stored in the memory 402.
[0074] The processor 401 is the control center of the computer device, and can use various interfaces and lines to connect various parts of the computer device, and perform resource settings by running or executing instructions stored in the memory 402 and calling data stored in the memory 402. Optionally, the processor 401 may include one or more processing units, and the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401. In some embodiments, the processor 401 and the memory 402 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.
[0075] Processor 401 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware processor for execution, or can be executed by a combination of hardware and software modules in the processor.
[0076] The memory 402 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 402 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 402 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 402 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.
[0077] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0078] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0079] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0080] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0081] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for achieving configuration information consistency in a test environment, characterized in that: The method is applicable to multiple test environments, each of which has a business database corresponding to its own business system; the configuration information in any business database is derived from the corresponding benchmark database in the operating environment; For a first database operation statement triggered on any business system under any test environment, determine whether the first database operation statement is an operation on a configuration table in the business database; if so, convert the first database operation statement into a second database operation statement and execute the second database operation statement through the benchmark database; the configuration table records various configuration information.
2. The method according to claim 1, characterized in that: The method further comprises: If the first database operation statement does not operate the configuration table in the business database, the first database operation statement is executed in the business database.
3. The method according to claim 1, characterized in that Converting the first database operation statement into a second database operation statement includes: The table name of the first data table in the first database operation statement is replaced with the table name of the second data table in the reference database to obtain the second database operation statement.
4. The method according to claim 1, characterized in that: The table name of any configuration table in the reference database is generated according to the database name of the business database and the table name of the configuration table in the business database.
5. The method according to any one of claims 1 to 4, characterized in that Determining whether the first database operation statement is to operate a configuration table in the business database includes: Determine a first data table corresponding to the first database operation statement in the business database; Determine whether the first data table is a configuration table in which various configuration information is set; If it is a configuration table, the first database operation statement is to operate the configuration table in the business database.
6. The method according to any one of claims 1 to 4, characterized in that Determining whether the first database operation statement is to operate a configuration table in the business database includes: Performing calculation according to a preset rule on the business database operation statement except the parameter part in the first database operation statement to obtain an identification value corresponding to the first database operation statement; According to whether the identification value is recorded in the mapping relationship, it is determined whether the first database operation statement is to operate the configuration table in the business database; wherein the mapping relationship includes the correspondence between the business database operation statement, the identification value and the benchmark database operation statement.
7. The method according to claim 4, characterized in that Converting the first database operation statement into a second database operation statement includes: Determine the reference database operation statement corresponding to the identification value through the mapping relationship; A second database operation statement is constructed according to the reference database operation statement corresponding to the identification value and the parameter part.
8. The method according to claim 4, characterized in that The mapping relationship is obtained by the following method, including: Get the SQL statement of any business system; For any SQL statement, determine whether the SQL statement is an operation on the configuration table of the business system; if so, calculate the business database operation statement in the SQL statement except the parameter part according to the preset rules to obtain the corresponding identification value; Changing the table name of the configuration table of the business system in the SQL statement to the table name of the configuration table of the benchmark database, to obtain a benchmark database operation statement; Construct the correspondence between business database operation statements, identification values and benchmark database operation statements.
9. A device for achieving configuration information consistency in a test environment, characterized in that: include: A determination module, configured to determine, for a first database operation statement triggered on any business system under any test environment, whether the first database operation statement is an operation on a configuration table in the business database; The processing module is used for, if yes, converting the first database operation statement into a second database operation statement and executing the second database operation statement through the reference database; the configuration table records various configuration information.
10. A device for achieving configuration information consistency in a test environment, characterized in that: include: Memory, used to store computer programs or instructions; A processor, configured to call a computer program or instruction stored in the memory to execute the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when a computer reads and executes the instructions, the computer executes the method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product stores instructions, and when a computer reads and executes the instructions, the computer executes the method according to any one of claims 1 to 8.
Citation Information
Cited By
Database management method and device, equipment, storage medium and program product
CN121579444A
