A database version query method and device
By determining the version information of database objects in a commercial bank testing environment and utilizing version information query methods for defined classes and program classes, the problem of inaccurate database version queries was solved, improving accuracy and efficiency. Furthermore, a difference report was provided to support database governance and testing.
Patent Information
- Application Number
- CN202310967813.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-08-02
AI Technical Summary
In the commercial bank's testing environment, the existing database version query method results in inaccurate database version information due to network transmission, manual operation, and inaccurate timestamps, making it impossible to accurately identify the database version.
By identifying the objects and object types related to version information in the database to be queried, the version information of each object is obtained. The version information of defined class objects and program class objects is used for accurate querying. Combined with summary calculation and difference report generation, the accuracy of version information is improved.
It enables accurate determination of database versions in commercial bank testing environments, reduces data processing volume, improves query efficiency, and provides difference reports to support database governance and test verification.
Smart Images

Figure CN117435635B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence, particularly to the financial field, and can be used in the field of software testing. In particular, it relates to a database version query method and apparatus. Background Technology
[0002] Commercial bank testing environments provide the necessary system application environment for product verification before launch. Unstable software versions are frequently deployed in testing environments, with database versions being a typical example. Identifying the database version in the testing environment helps determine whether the testing environment has the necessary program functionalities to meet testing requirements.
[0003] Existing bank testing environments have the following characteristics:
[0004] 1) To ensure that the test environment is close to the online environment, data will be obtained from the online environment periodically, de-identified, and then imported into the test environment. At the same time, the test environment will be rebuilt using the online database program version. However, due to various factors such as network transmission, manual operation, and content storage, the actual rebuilt version may have missing elements or elements that appear to be present but are inconsistent with the online version.
[0005] 2) Database versions are usually developed separately for multiple branches corresponding to multiple release dates. Frequent delivery of test versions in their respective branches can also lead to staggered delivery. When these program versions are installed in the same test environment, the database version update history in the test environment will differ from the actual release situation.
[0006] 3) Due to the special date verification requirements of banks, the test environment date is required to be set to a non-natural day, which makes the timestamp in the system unable to accurately reflect the specific time of the database program update, thus making it impossible to accurately identify the database version.
[0007] Existing methods for querying database versions in testing environments include: assigning version numbers to individual database programs or mapping a version number to the entire database program; or determining the database version by judging the program's update time. However, due to the aforementioned three characteristics of existing testing environments, the database version information obtained through these methods is inaccurate. Summary of the Invention
[0008] To address the problems in the prior art, the database version query method and apparatus provided by this invention improve the accuracy of the retrieved database version information.
[0009] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0010] In a first aspect, the present invention provides a database version query method, the method comprising: determining objects related to version information and object types in a database to be queried; obtaining version information of each object through each object type; and determining the version information of the database to be queried based on the version information of each object.
[0011] Optionally, determining the objects and object types related to version information in the database to be queried includes: determining all objects and object types in the database to be queried; filtering out target type objects from the determined objects, wherein the target type objects include definition class objects and program class objects, the definition class objects include data record objects, and the program class objects include data processing objects.
[0012] Optionally, obtaining the version information of each object by each object type includes: determining the version query strategy for each object based on the type of each object; and obtaining the version information of each object based on the version query strategy for each object.
[0013] Optionally, if the currently read object is the defined class object, obtaining the version information of each object according to the version query strategy of each object includes: reading the definition information corresponding to each object in the defined class object to obtain the version information set of the defined class object; wherein, determining the version information of the database to be queried according to the version information of each object includes: using the version information set of the defined class object as the version information of the database to be queried.
[0014] Optionally, if the currently read object is the program class object, obtaining the version information of each object according to the version query strategy of each object includes: reading the program code corresponding to each object in the program class object; performing a digest calculation on each program code to obtain the digest information of each program code; and concatenating the digest information; wherein, determining the version information of the database to be queried according to the version information of each object includes: using the concatenated digest information as the version information of the database to be queried.
[0015] Optionally, reading the definition information corresponding to each object in the definition class object or reading the program code corresponding to each object in the program class object includes: reading the definition information corresponding to each object in the definition class object or reading the program code corresponding to each object in the program class object from the system view.
[0016] Optionally, the definition information includes object definition information and object authorization information. The object definition information includes object name, object column name, object type, object length, and object constraints.
[0017] Optionally, the database query method provided by the present invention further includes: associating and storing the version information with the database to be queried.
[0018] Optionally, the database to be queried is determined based on the query information sent by the client. The query information includes the database name, database launch time, and instance name. Associating the version information with the database to be queried includes: determining whether the database to be queried stores version information corresponding to the query information; if not, associating the currently determined version information with the database to be queried; if so, determining whether there is a difference between the currently determined version information and the stored version information; if so, updating the stored version information to the currently determined version information.
[0019] Optionally, if there is a difference between the currently determined version information and the stored version information, the database query method provided by the present invention further includes: generating a difference report based on the currently determined version information and the stored version information, and storing it.
[0020] Secondly, the present invention provides a database version query device, the device comprising: an object determination module, adapted to determine objects related to version information and object types in a database to be queried; an object version information determination module, adapted to obtain version information of each object through each object type; and a database version information determination module, adapted to determine the version information of the database to be queried based on the version information of each object.
[0021] Thirdly, the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the above-described method.
[0022] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.
[0023] As can be seen from the above description, the database version query method provided by the present invention obtains version-related objects in the database to be queried, and obtains version-related information from the objects. Since the database version information is updated, the database program must also be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the database version can be accurately determined, thereby improving the accuracy of querying the database version. Attached Figure Description
[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a schematic diagram of a database version query method in one embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram of a database version query method in another embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram illustrating the complete workflow of a database version query method in one embodiment of the present invention;
[0028] Figure 4 This is a structural block diagram of a database version query device in one embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 embodiments of the present invention, not all embodiments. 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.
[0031] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this invention all comply with the relevant provisions of national laws and regulations.
[0032] It should be noted that the database version query method and apparatus disclosed in this application can be used in the financial field, the software testing field, or any field other than the financial and software testing fields. The application field of the database version query method and apparatus disclosed in this application is not limited.
[0033] To address the technical problem that existing database version acquisition methods cannot accurately obtain database versions in test environments, embodiments of the present invention provide a database version query method and apparatus to solve the aforementioned technical problem.
[0034] This invention provides a specific implementation of a database version query method. See also... Figure 1 The method specifically includes the following:
[0035] Step 100: Determine the objects and object types related to version information in the database to be queried.
[0036] The objects mentioned here refer to database objects, which can be understood as a general term for components, serving as the carriers for data storage and reference in the database.
[0037] A database software program may typically install multiple logical databases, which are distinguished by their instance names. Therefore, the database to be queried here can actually be understood as a single logical database, or a single database instance.
[0038] It should be noted that the database to be queried is determined based on the query information sent by the client, which is the information entered by the user in the client's user interface. The query information includes the database name (i.e., the physical database name), the database's online time, and the instance name (i.e., the logical database name).
[0039] Step 200: Obtain the version information of each object by object type.
[0040] Step 300: Determine the version information of the database to be queried based on the version information of each object.
[0041] As can be seen from the above description, the database version query method provided by the present invention obtains version-related objects in the database to be queried, and obtains version-related information from the objects. Since the database version information is updated, the database program must be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the accuracy of querying the database version can be improved.
[0042] In some implementations, step 100 includes:
[0043] First, identify all objects in the database to be queried. Specifically, identify the target instance (target logical database) corresponding to the query information (i.e., database name, database launch time, and instance name). Then, identify all objects and object types under the target instance of the database. Associate each object with its object type and store the associated objects and object types as a data item in a list.
[0044] Next, target type objects related to version information are selected from the identified objects. Specifically, target type objects are searched from the object list obtained above and stored in their respective files (e.g., lists). Target type objects related to version information include definition class objects and program class objects. Therefore, searching for target type objects from the obtained list and storing them in their respective files includes: searching for definition class objects from the obtained list and outputting them to the definition class object file; and searching for program class objects from the obtained list and outputting them to the program class object file.
[0045] The defined class objects include data record objects, which can include tables, indexes, sequences, etc. Since database objects such as functions, stored procedures, and triggers are programs within the database that perform business logic processing, similar to application programs, the database program itself needs version management. Therefore, in this invention, program class objects include data processing objects, which can include functions, stored procedures, triggers, etc.
[0046] In this way, only objects that can represent version information are selected, and version-related information is extracted from them, reducing the amount of data. This improves the accuracy of the database version query while reducing the amount of data processing and increasing the efficiency of database version query.
[0047] In some implementations, a connection needs to be established between the logical database and the physical database before determining the database to be queried. Specifically, the configuration information of the physical database is read based on the query information, and the logical database is connected to the physical database based on the configuration information, so that only the name of the logical database is displayed externally. The configuration information includes username, password, database IP address, and port.
[0048] In some implementations, step 200 includes: first, determining a version query strategy for each object based on its type; then, obtaining version information for each object based on the version query strategy. Specifically:
[0049] If the object being read is a definition class object, the version query strategy is as follows: read the definition information corresponding to each object one by one from the definition class object file until the definition information of each object in the definition class object list is read, thus obtaining the definition information set of the definition class object. Further, the definition information corresponding to each object in the definition class object can be read from the system view, thereby obtaining the definition information set of the definition class object, and outputting it to the definition class record file of the target instance.
[0050] At this point, step 300 includes: using the set of version information of the definition class objects in the definition class record file as the version information of the database to be queried.
[0051] In this embodiment, the definition information includes object definition information and object authorization information. The object definition information includes the object name, object column name, object type, object length, and object constraints. The object authorization information includes the authorized object, the object owner, the object type, the user who granted the permissions, and the owner's permissions. Therefore, this invention can be understood as excluding statistical information in the definition and retaining only relatively fixed definition information as a key factor for version checking. The following uses an object as an example; the object definition is shown in Table 1.
[0052] Table 1 Example of object definition
[0053] table_name column_name type length precision scale TRAN_LOG LOG_ID NUMBER 18 2 0 TRAN_LOG TRAN_ID VARCHAR2 100 TRAN_LOG BEGIN_TIME NUMBER 22 13 0 TRAN_LOG END_TIME NUMBER 22 13 0 TRAN_LOG TX_RESULT NUMBER 18 1 0 TRAN_LOG ERR_NO VARCHAR2 30
[0054] In Table 1, table_name represents the object name, column_name represents the column name, type represents the object type, length represents the object length, precision and scale both represent constraints. Furthermore, precision represents the maximum number of digits in the value of a numeric parameter or field object, and scalex represents the scale factor in the x-direction.
[0055] The following example also uses objects as tables, and the object authorization information is shown in Table 2.
[0056] Table 2 Example of Object Authorization Information
[0057]
[0058]
[0059] In Table 2, GRANTEE represents the authorized object, OWNER represents the object's owner, TABLE represents the object type, GRANTOR represents the user who grants permissions, and PRIVILEGE represents the owner's permissions.
[0060] If the object being read is a program class object, the version lookup strategy is as follows: Read the program code corresponding to each object from the program class object file one by one. Then, concatenate the segmented code of the same object to obtain a set of program code. Next, perform a digest calculation on each piece of program code to obtain its digest information. Finally, concatenate these digests to obtain the concatenated digest information. For example, if the program class object is a stored procedure (pkg_log_clean), the resulting digest information could be 4a5a6f6bea31ab5f4ee310f398efeac9 pkg_log_clean.
[0061] Furthermore, the program code corresponding to each object in the program class object list can be read from the system view to obtain the program code set of the program class objects, which is then output to the program class record file corresponding to the target instance for aggregation. Next, a digest calculation is performed on each program code in the program class record file to obtain digest information for each program code. This digest information is then concatenated to obtain a concatenated digest. Here, the digest information of each program code can be concatenated according to the storage order of the program code in the program class record file. Step 300 then includes using the concatenated digest information as the version information of the database to be queried.
[0062] This does not limit the method of digest calculation. For example, digest information of each program code can be calculated by using MD5. This method of digesting digest information of each program code is an existing technology and will not be elaborated here.
[0063] In some embodiments, see Figure 2 The method further includes:
[0064] Step 400: Associate and store the version information with the database to be queried.
[0065] Specifically: Determine whether the database to be queried stores version information corresponding to the queried information. If not, associate and store the currently determined version information with the database to be queried. If yes, determine whether there is a difference between the currently determined version information and the stored version information. If there is a difference, update the stored version information to the currently determined version information and obtain a difference report. If there is no difference, end the execution of the program.
[0066] When a discrepancy is determined between the currently identified version information and the stored version information, a difference report is generated and stored based on the two information. Furthermore, if the object is a definition class, the difference report contains the comparison result of the definition information; if the object is a program class, the difference report contains the comparison result of the summary information.
[0067] This allows for timely updates to the database version information. Matching the version information of release branches (i.e., each instance in the database) enables more accurate identification of the version information after multi-branch version interleaving deployment in the test environment, providing necessary reference for database governance and testing. Furthermore, the specific differences between versions can be identified based on the difference report, further providing necessary reference for database governance and testing.
[0068] The following example illustrates the complete workflow of a database version query method, using the example of a newly built test database for a bank credit card system and verifying the database version of the newly built environment from other databases requiring version checks. The complete workflow of the database version query method provided in this embodiment is as follows: Figure 3 As shown, the steps include:
[0069] Step 301: Receive query information sent by the client. The query information includes the physical database name, the database launch time, and the instance name (i.e., the logical database name). For example, the physical database name is Beijing area credit card test database, the database launch time is March 1st, and the instance name is CreditCard.
[0070] Step 302: Read the configuration information of the physical database based on the physical database name in the query information.
[0071] Step 303: Establish a connection between the logical database and the physical database based on the configuration information.
[0072] Step 304: Determine the target logical database in the physical database based on the query information, and use it as the database to be queried.
[0073] Step 305: Determine the objects related to version information and their types in the database to be queried.
[0074] Step 306: Determine the version query strategy for each object based on its type.
[0075] Step 307: Obtain the version information of each object according to the version query strategy of each object.
[0076] Specifically, if the object being read is a definition class object, the version query strategy is as follows: read the definition information corresponding to each object in the definition class object list from the system view until the definition information of each object in the definition class object list is read, obtain the definition information set of the definition class object, and output it to the definition class record file of the target instance.
[0077] If the object being read is a program class object, the version lookup strategy is as follows: The program code corresponding to each object in the program class object list is read sequentially from the system view to obtain a collection of program code for each program class object. This collection is then output to the program class record file corresponding to the target instance for aggregation. Next, a digest is calculated for each piece of code in the program class record file to obtain digest information for each piece of code. The digest information of each piece of code is then concatenated according to the storage order of the code in the program class record file to obtain the concatenated digest information.
[0078] Step 308: Determine the version information of the database to be queried based on the version information of each object. That is, use the set of version information of the definition class objects in the definition class record file as the version information of the database to be queried, or use the concatenated summary information as the version information of the database to be queried.
[0079] Step 309: Determine whether the database to be queried stores version information corresponding to the query information. If not, proceed to step 310; if yes, proceed to step 311.
[0080] Step 310: Associate and store the currently determined version information with the database to be queried.
[0081] Step 311: Determine if there is a difference between the currently determined version information and the stored version information. If yes, proceed to step 312; otherwise, end the program execution and complete the database version query.
[0082] Step 312: Update the stored version information to the currently determined version information.
[0083] Step 313: Generate a difference report based on the currently determined version information and the stored version information, and store it.
[0084] As described above, the database version query method provided by this invention obtains version-related objects in the database to be queried, and extracts version-related information from the objects. Since the database version information is updated, the database program must also be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the database version can be accurately determined, thereby improving the accuracy of querying the database version.
[0085] Furthermore, this invention only filters out objects that can characterize version information and extracts version-related information from them, thereby reducing the amount of data. This improves the accuracy of the retrieved database version while reducing the amount of data processing and increasing the efficiency of database version queries.
[0086] Furthermore, this invention addresses the background of frequent changes in the database version of a commercial bank's test environment. It performs version checks using different strategies at the database object granularity and summarizes the results into database-level version information associated with the release branch. This achieves the effect of effective version checks under conditions of frequent database changes and inaccurate time, thus calibrating the foundation for verification in the test environment.
[0087] Based on the same inventive concept, this application also provides a database version query device, which can be used to implement the method described in the above embodiments, as shown in the following embodiments. Since the principle by which the database version query device solves the problem is similar to that of the database version query method, the implementation of the database version query device can refer to the implementation of the database version query method, and repeated details will not be elaborated further. As used below, the terms "unit" or "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0088] An embodiment of the present invention provides a specific implementation of a database version query device, see below. Figure 4 The database version query device specifically includes the following components:
[0089] The object determination module 10 is suitable for determining the objects and object types related to version information in the database to be queried.
[0090] The object version information determination module 20 is suitable for obtaining the version information of each object through each object type.
[0091] The database version information determination module 30 is adapted to determine the version information of the database to be queried based on the version information of each object.
[0092] As can be seen from the above description, the database version query device provided in this embodiment of the invention obtains version-related objects in the database to be queried, and obtains version-related information from the objects. Since the database version information is updated, the database program must be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the database version can be accurately determined, thereby improving the accuracy of querying the database version.
[0093] This application also provides a specific implementation of an electronic device capable of implementing all steps of the database version query method in the above embodiments, see [link to implementation details]. Figure 5 The electronic devices specifically include the following:
[0094] Processor 501, memory 502, communications interface 503, and bus 504;
[0095] The processor 501, memory 502, and communication interface 503 communicate with each other via bus 504; the communication interface 503 is used to realize information transmission between server-side devices, parameter acquisition devices, and client-side devices.
[0096] The processor 501 is used to call the computer program in the memory 502. When the processor executes the computer program, it implements all the steps in the database version query method in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:
[0097] Step 100: Determine the objects and object types related to version information in the database to be queried.
[0098] Step 200: Obtain the version information of each object by object type.
[0099] Step 300: Determine the version information of the database to be queried based on the version information of each object.
[0100] As can be seen from the above description, the database version query method provided by the present invention obtains version-related objects in the database to be queried, and obtains version-related information from the objects. Since the database version information is updated, the database program must also be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the database version can be accurately determined, thereby improving the accuracy of querying the database version.
[0101] Embodiments of this application also provide a computer-readable storage medium capable of implementing all steps of the database version query method in the above embodiments. The computer-readable storage medium stores a computer program that, when executed by a processor, implements all steps of the database version query method in the above embodiments. For example, when the processor executes the computer program, it implements the following steps:
[0102] Step 100: Determine the objects and object types related to version information in the database to be queried.
[0103] Step 200: Obtain the version information of each object by object type.
[0104] Step 300: Determine the version information of the database to be queried based on the version information of each object.
[0105] As can be seen from the above description, the database version query method provided by the present invention obtains version-related objects in the database to be queried, and obtains version-related information from the objects. Since the database version information is updated, the database program must also be updated. The version-related information obtained from the objects can effectively explain the version status. Therefore, by obtaining the version-related information of the objects in the database to be queried, the database version can be accurately determined, thereby improving the accuracy of querying the database version.
[0106] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on its differences from other embodiments. In particular, hardware + program embodiments are relatively simple in description because they are fundamentally similar to method embodiments; relevant parts can be referred to the descriptions in the method embodiments.
[0107] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0108] While this application provides method operation steps as shown in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-inventive labor. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual device or client product execution, the method can be executed sequentially as shown in the embodiments or drawings, or in parallel (e.g., in a parallel processor or multi-threaded processing environment).
[0109] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0110] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0111] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0112] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0113] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A database version query method, characterized in that, The method includes: Identify the objects related to version information and their types in the database to be queried; Retrieve version information for each object based on its type; The version information of the database to be queried is determined based on the version information of each object; The process of determining the objects and object types related to version information in the database to be queried includes: Determine all objects and their types in the database to be queried; Associate each object with each object type, and store the associated objects and object types as a single data item in a list; Select target type objects from the identified objects, wherein the target type objects include definition class objects and program class objects, the definition class objects include data record objects, and the program class objects include data processing objects; The process of obtaining version information for each object based on its type includes: Determine the version query strategy for each object based on its type; Retrieve version information for each object based on the version query strategy for each object; If the currently read object is a defined class object, obtaining the version information of each object according to the version query strategy includes: Read the definition information corresponding to each object in the defined class object to obtain the version information set of the defined class object; The step of determining the version information of the database to be queried based on the version information of each object includes: The version information set of the defined class objects is used as the version information of the database to be queried; If the currently read object is the program class object, obtaining the version information of each object according to the version query strategy includes: Read the program code corresponding to each object in the program class object; A digest calculation is performed on each program code to obtain the digest information of each program code; The summary information is pieced together; The step of determining the version information of the database to be queried based on the version information of each object includes: The concatenated summary information is used as the version information of the database to be queried.
2. The query method as described in claim 1, characterized in that, The step of reading the definition information corresponding to each object in the definition class object or the step of reading the program code corresponding to each object in the program class object includes: Read the definition information corresponding to each object in the definition class object or read the program code corresponding to each object in the program class object from the system view.
3. The query method as described in claim 1, characterized in that, The definition information includes object definition information and object authorization information. The object definition information includes object name, object column name, object type, object length, and object constraints.
4. The query method as described in claim 1, characterized in that, The method further includes: The version information is associated with and stored in the database to be queried.
5. The query method as described in claim 4, characterized in that, The database to be queried is determined based on the query information sent by the client. The query information includes the database name, database launch time, and instance name. Associating and storing the version information with the database to be queried includes: Determine whether the database to be queried stores version information corresponding to the query information; if not, associate and store the currently determined version information with the database to be queried. If so, determine whether there is a difference between the currently determined version information and the stored version information; if so, update the stored version information to the currently determined version information.
6. The query method as described in claim 5, characterized in that, If the currently determined version information differs from the stored version information, the method further includes: A difference report is generated based on the currently determined version information and the stored version information, and then stored.
7. A database version query device, characterized in that, The device includes: The object determination module is suitable for determining the objects and object types related to version information in the database to be queried. The object version information determination module is suitable for obtaining the version information of each object based on its type. The database version information determination module is adapted to determine the version information of the database to be queried based on the version information of each object; The process of determining the objects and object types related to version information in the database to be queried includes: Determine all objects and their types in the database to be queried; Associate each object with each object type, and store the associated objects and object types as a single data item in a list; Select target type objects from the identified objects, wherein the target type objects include definition class objects and program class objects, the definition class objects include data record objects, and the program class objects include data processing objects; The process of obtaining version information for each object based on its type includes: Determine the version query strategy for each object based on its type; Retrieve version information for each object based on the version query strategy for each object; If the currently read object is a defined class object, obtaining the version information of each object according to the version query strategy includes: Read the definition information corresponding to each object in the defined class object to obtain the version information set of the defined class object; The step of determining the version information of the database to be queried based on the version information of each object includes: The version information set of the defined class objects is used as the version information of the database to be queried; If the currently read object is the program class object, obtaining the version information of each object according to the version query strategy includes: Read the program code corresponding to each object in the program class object; A digest calculation is performed on each program code to obtain the digest information of each program code; The summary information is pieced together; The step of determining the version information of the database to be queried based on the version information of each object includes: The concatenated summary information is used as the version information of the database to be queried.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the database version query method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the database version query method according to any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product is implemented on one or more computer-readable storage media containing the computer program; When the computer program is executed by a processor, it implements the steps of the database version query method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data processing method and device, computer readable storage medium and electronic equipment
CN116303831A
