Database initialization method and device, electronic equipment and storage medium
By receiving the target system table version number input by the user, querying the mapping table to determine the target row number and initializing the database, the backward incompatibility problem caused by changes in system table content during database version upgrades is resolved, improving ease of operation and efficiency.
Patent Information
- Application Number
- CN202111656206.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-30
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2041-12-30
AI Technical Summary
During database version upgrades, backward incompatibility issues arise due to changes in system table content. Existing technologies require users to configure multiple parameters, which is complex and inefficient.
By receiving the target system table version number input by the user, querying the preset mapping table, determining the target number of rows in the target system table, and initializing the database based on this, the correspondence between the system table version number and the number of rows is realized.
It simplifies user operations, improves the speed and efficiency of backward compatibility processing of the database, and allows users to select the appropriate system table version for initialization according to their needs.
Smart Images

Figure CN114356887B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of database application, in particular to a database initialization method and device, electronic equipment and storage medium, and specifically relates to a scheme for flexibly configuring database downward compatibility in a system table driven database. BACKGROUND
[0002] With the continuous upgrading of database versions, most functions in new database versions can be downward compatible, but there are still some incompatible phenomena. In the processing of the database, the reason why it cannot be downward compatible is generally divided into three categories: one is that the SQL (Structured Query Language) execution statement is different; two is that the meaning represented by the SQL statement after semantic analysis is different; three is that the execution result is different. For different reasons, the current processing methods are also different.
[0003] For the incompatible problem caused by the above first reason, the current processing method is to introduce new SQL statements to realize new forms, and the original SQL retains the original form; for the incompatible problem caused by the above second and third reasons, the current processing method is to use different configuration parameters for control, and different results are output according to different values of the configuration parameters.
[0004] However, for the above second processing method, when there are many incompatible processes, multiple parameters need to be used for control, which in actual deployment requires users to configure different values of multiple parameters according to different application adaptation situations, and the user configuration situation is complex, the operation difficulty is large, and the processing efficiency is low. SUMMARY
[0005] In order to solve the above technical problems, the present application provides a database initialization method, device, electronic equipment and storage medium.
[0006] According to a first aspect of the present application, a database initialization method is provided, which comprises:
[0007] receiving a target system table version number input by a user;
[0008] According to the target system table version number, querying a preset mapping relationship table to determine a target row number of a target system table corresponding to the target system table version number, wherein the mapping relationship table records the row numbers of the system tables corresponding to different system table version numbers respectively;
[0009] Based on the target row number of the target system table, initializing the database.
[0010] According to a second aspect of the present application, a database initialization device is provided, which comprises:
[0011] receiving a target system table version number input by a user;
[0012] determining a target row number of a target system table corresponding to the target system table version number according to the target system table version number by querying a preset mapping relationship table, wherein the mapping relationship table records row numbers of system tables corresponding to different system table version numbers respectively;
[0013] initializing the database based on the target row number of the target system table.
[0014] According to a third aspect of the present application, an electronic device is provided, comprising: a processor configured to execute a computer program stored in a memory, wherein the computer program is configured to implement the steps of the database initialization method according to the first aspect when executed by the processor.
[0015] According to a fourth aspect of the present application, a computer readable storage medium is provided, wherein the computer readable storage medium stores a computer program, and the computer program is configured to implement the steps of the database initialization method according to the first aspect when executed by a processor.
[0016] According to a fifth aspect of the present application, a computer program product is provided, wherein the computer program product, when executed on a computer, causes the computer to perform the database initialization method according to the first aspect.
[0017] The technical scheme provided by the embodiments of the present application has the following advantages compared with the prior art:
[0018] By receiving a target system table version number input by a user, a target row number of a target system table corresponding to the target system table version number is determined according to the target system table version number by querying a preset mapping relationship table, wherein the mapping relationship table records row numbers of system tables corresponding to different system table version numbers respectively, and then the database is initialized based on the target row number of the target system table. By setting the row numbers of system tables corresponding to different system table version numbers, the content of the system table in different versions is controlled according to the system table version number, and then the target row number of the target system table corresponding to the target system table version number input by the user is determined for initializing the database, so that the user can select a suitable system table version according to the demand to solve the problem of database downward incompatibility, which is simple and convenient to operate and can improve the processing speed and efficiency of the incompatibility problem. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those skilled in the field, other drawings can also be obtained based on these drawings without any creative effort.
[0021] Figure 1 A flowchart of a database initialization method provided by an embodiment of the present application is shown in FIG. 1.
[0022] Figure 2 A flowchart of a database initialization method provided by an embodiment of the present application is shown in FIG. 1.
[0023] Figure 3 A structure diagram of a database initialization device provided by an embodiment of the present application is shown in FIG. 2.
[0024] Figure 4 A structure diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 3. DETAILED DESCRIPTION
[0025] The embodiments of the present application will be described in detail with reference to the drawings. Although some embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms, and should not be interpreted as being limited to the embodiments set forth herein, but rather, these embodiments are provided to make the present application more thorough and complete. It should be understood that the drawings and embodiments of the present application are only for exemplary purposes, and are not intended to limit the scope of protection of the present application.
[0026] It should be understood that each step described in the method embodiments of the present application can be executed in different order and / or in parallel. In addition, the method embodiments can include additional steps and / or omit the execution of the steps shown. The scope of the present application is not limited in this respect.
[0027] The term "comprising" and its variants are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Related definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present application are only used to distinguish different devices, modules or units, and do not limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modification of "one", "multiple" mentioned in the present application is illustrative but not restrictive, and those skilled in the art should understand that unless otherwise explicitly indicated in the context, it should be understood as "one or more".
[0029] Before a detailed description of the initialization method, device, electronic equipment and storage medium of the database provided by the present application, the professional terms that may be involved in the present application are explained as follows:
[0030] Application downward compatibility: input the same SQL statement, get the same result.
[0031] For the incompatibility problem caused by the different meanings represented by the SQL statement after semantic analysis and the different execution results, the reason is that in the system table driven database, the essence is that the change of the content of the system table leads to the change of the content of the system table, including the increase of the stored data type, the increase of the data type conversion rule, the increase of the function, the increase of the configuration parameter, etc. These changes will affect the semantic analysis of SQL statement, thereby affecting the execution of SQL, which is easy to cause the execution result of the same SQL statement and the execution result of the previous version to be inconsistent, thereby causing the application downward incompatibility.
[0032] For the above problems, the present application provides an initialization method of a database, which is initialized using a system table version definition, and is compatible with different state database servers based on different system table versions. Specifically, by receiving a target system table version number input by a user, a target row number of a target system table corresponding to the target system table version number is determined by querying a preset mapping relationship table according to the target system table version number, wherein the mapping relationship table records the row numbers of the system tables corresponding to different system table version numbers, and then the database is initialized based on the target row number of the target system table. By adopting the above technical solution, by setting the row numbers of the system tables corresponding to different system table version numbers, the content of the system table in different versions is controlled according to the system table version number, and then the target row number of the corresponding target system table is determined according to the target system table version number input by the user for initializing the database, so that the user can select the appropriate system table version according to the demand to solve the downward incompatibility problem caused by the different contents of the system table, which is simple and convenient to operate, and can improve the processing speed and efficiency of the incompatibility problem.
[0033] Figure 1 The flowchart of the initialization method of the database provided by an embodiment of the present application, which can be executed by the initialization device of the database provided by the embodiment of the present application, wherein the device can be realized by software and / or hardware, and can be integrated in an electronic equipment such as a database.
[0034] As Figure 1As shown, the initialization method of the database can include the following steps:
[0035] Step 101, receiving a target system table version number input by a user.
[0036] In the embodiment of the present application, when initializing the database, the user can specify the required system table version number, and input the target system table version number through the operation interface of the database, and then the database can receive the target system table version number input by the user.
[0037] In an optional embodiment of the present application, the database can send a prompt message to the user when it checks the incompatibility, and the prompt message is used to prompt the user to input the target system table version number corresponding to the system table required for initializing the database.
[0038] For example, assuming that the version of the database is upgraded from version 1 to version 3, it is considered that there is incompatibility, and when the upgrade is completed and initialized, a prompt message of "the version has been upgraded, please specify the required system table version before initialization" is sent to the user, for example, the prompt message can be displayed on the operation interface of the database. Then, the user inputs the specified target system table version number on the operation interface under the prompt of the prompt message.
[0039] Since the content of the system table of the database is also changing with the upgrade of the database version, the system table version number gradually increases, and it is very difficult and not practical for the user to remember each system table version number and the content of the corresponding system table, therefore, in the embodiment of the present application, when the prompt message is sent to the user, a view about different system table version numbers and the number of rows of all corresponding system tables can also be displayed to the user, and the user finds the required system table version number, i.e. the target system table version number, through the view, and inputs the determined target system table version number. Of course, the view can also be provided to the user in the form of a manual, and the manual can be an electronic document or a paper document, and the present application does not limit this.
[0040] In the embodiment of the present application, the target system table version number input by the user is prompted by sending a prompt message to the user, which realizes the operation guidance to the user, is conducive to ensuring the normal initialization of the database, and reduces the probability of the downward incompatibility problem of the database.
[0041] Step 102, according to the target system table version number, querying a preset mapping relationship table to determine the target number of rows of the target system table corresponding to the target system table version number.
[0042] In the mapping relationship table, the number of rows of the system table corresponding to different system table version numbers is recorded.
[0043] In an optional embodiment of the present application, the system table version number is monotonically increasing.
[0044] Illustratively, the system table version number can be numbered in sequence, and the version number of the initial version of the system table is 1. Each time the system table of the database is modified, the version number of the system table is sequentially increased as the new system table version number.
[0045] Illustratively, the system table version number can be determined according to the time of performing the modification operation on the system table, and the modification operation is to add a row, including adding a function, adding a constraint type, adding a built-in data type, adding a built-in type conversion rule, and adding a system table.
[0046] When each version of the database is released, if the system table is modified during the development process of the current version, the version number of the system table is changed. Specifically, the current time of modifying the system table can be determined as the system table version number corresponding to the modified system table. For example, if a developer develops a new version of the database and modifies the system table on November 30, 2021, the system table version number corresponding to the modified system table can be changed to 20211130. The system table version number thus determined is also monotonically increasing.
[0047] It should be noted that the database includes multiple system tables, and performing a modification operation on the system table can be performing a modification operation on one or more system tables. Performing a modification operation on any system table will trigger a change in the system table version number.
[0048] In the embodiments of the present application, the system table version number is determined according to the time of performing the modification operation on the system table, so that the modification time of the system table of different versions is obvious at a glance, and the user can clearly know the change of the system table version.
[0049] In the embodiments of the present application, for each version of the system table, the corresponding relationship between the system table version number of all system tables of different versions and the number of rows contained in each system table can be recorded in the mapping relationship table.
[0050] For example, in the mapping relationship table, the system table version number n1 corresponds to 50 rows in the system table A and 81 rows in the system table B; the system table version number n2 corresponds to 53 rows in the system table A and 90 rows in the system table B; and the system table version number n3 corresponds to 61 rows in the system table A, 93 rows in the system table B, and 20 rows in the system table C.
[0051] The mapping relationship table can be set by the developer when developing the version of the database, or can be dynamically updated by the database when upgrading, which is not limited in the present application.
[0052] In the embodiment of the present application, after receiving the target system table version number input by the user, the target system table corresponding to the target system table version number and the target row number of the target system table can be found from the mapping relationship table by querying the preset mapping relationship table.
[0053] Continuing the above example, assuming that the target system table version number input by the user is n2, the target system table corresponding to the target system table version number n2 and the target row number can be determined by querying the preset mapping relationship table, including 53 rows in system table A and 90 rows in system table B.
[0054] In step 103, the database is initialized based on the target row number of the target system table.
[0055] In the embodiment of the present application, after determining the target row number of the target system table corresponding to the target system table version number, the database is initialized based on the target row number of the target system table.
[0056] For example, assuming that the database of version V0001 contains 10 rows in system table A, the database of version V0002 contains 20 rows in system table A, and the user specifies the system table version number of the database of version V0001 as the target system table version number when initializing the database, the system table A in the database can be initialized to 10 rows, thereby being compatible with the behavior of the database of version V0001.
[0057] In the embodiment of the present application, the database is initialized by specifying the target system table version number, which realizes different initialization of the same system table according to different system table version numbers, and has good compatibility.
[0058] In the embodiment of the present application, when the modification operation of adding rows is performed on the system table, the change of the system table version number is triggered, that is, the premise of the present application is that only the adding row operation is allowed on the system table, and the deleting and modifying operations on the existing rows in the system table are prohibited. Under this premise, only the difference of the added rows exists in the system tables of different versions, and the content of the original rows does not change, so that in an optional implementation manner of the present application, the initialization of the database based on the target row number of the target system table includes:
[0059] Obtaining target data from the starting row of the target system table to the target row number;
[0060] Initializing the database by using the target data.
[0061] In the embodiment of the present application, after the target row number of the target system table corresponding to the target system table version number is determined, the target data can be obtained from the target system table, the target data including the content from the starting row to the target row number in the target system table, and then the target data is used to initialize the database.
[0062] For example, it is assumed that the target row number of the target system table determined includes 53 rows in system table A and 90 rows in system table B, and the target data determined includes the content from the starting row to the 53rd row in system table A and the content from the starting row to the 90th row in system table B.
[0063] The method for initializing the database according to the embodiment of the present application receives the target system table version number input by the user, queries the preset mapping relationship table according to the target system table version number to determine the target row number of the target system table corresponding to the target system table version number, wherein the mapping relationship table records the row number of the system table corresponding to different system table version numbers, and then the database is initialized based on the target row number of the target system table. By setting the row number of the system table corresponding to different system table version numbers, the above technical solution realizes the control of the content of the system table in different versions according to the system table version number, and then the target row number of the corresponding target system table is determined according to the target system table version number input by the user to initialize the database, so that the user can select the appropriate system table version according to the demand to solve the problem of downward incompatibility caused by different system table contents, which is simple and convenient to operate and can improve the processing speed and efficiency of the incompatibility problem.
[0064] In an optional embodiment of the present application, the mapping relationship table can be dynamically updated, and therefore the method further includes:
[0065] obtaining the first system table version number of the current version database and the second system table version number of the previous version database;
[0066] when the first system table version number and the second system table version number are inconsistent, obtaining the row number corresponding to each first system table in the current version database;
[0067] adding the correspondence between the first system table version number and the row number corresponding to each first system table to the mapping relationship table.
[0068] In the embodiment of the present application, the mapping relationship table can be dynamically updated, and therefore the method further includes:
[0069] In the embodiment of the present application, after the upgrade of the current version of the database is completed, the first system table version number of the current version of the database and the second system table version number of the previous database are obtained, and the first system table version number and the second system table version number are compared. When the first system table version number and the second system table version number are inconsistent, the number of rows corresponding to each first system table in the current version of the database is obtained, and the corresponding relationship between the first system table version number and the number of rows corresponding to each first system table is added to the mapping relationship table.
[0070] The second system table version number can be obtained from the mapping relationship table, for example, the system table version number contained in the last row of data in the mapping relationship table can be obtained as the second system table version number, or when the system table version number is monotonically increasing, the maximum system table version number in the mapping relationship table can be obtained as the second system table version number. Alternatively, the second system table version number can also be obtained from the previous version of the database before upgrading the database version. The present application does not limit the channel for obtaining the second system table version number.
[0071] In the embodiment of the present application, by obtaining the first system table version number of the current version of the database and the second system table version number of the previous version of the database, and obtaining the number of rows corresponding to each first system table in the current version of the database when the two are inconsistent, the corresponding relationship between the first system table version number and the number of rows corresponding to each first system table is added to the mapping relationship table. Thus, the dynamic updating of the mapping relationship table is realized, the latest corresponding relationship between the system table version number and the system table row number is recorded in the dynamic relationship table, and data support is provided for accurate database initialization.
[0072] Figure 2 The flowchart of the database initialization method provided by the embodiment of the present application is shown in FIG. 1. Figure 2 When initializing, the user specifies the system table version number, and determines whether the system table initialization is completed. If it is determined that the system table initialization is not completed, the system table is initialized, and the corresponding content is initialized according to the system table version number specified by the user. If the system table initialization is completed, the view and other objects are continuously initialized, and then the process is ended. In the embodiment of the present application, different initialization work is performed on the same system table according to different system table version numbers, which has good compatibility.
[0073] Corresponding to the method embodiment, the embodiment of the present application also provides a database initialization device.
[0074] Figure 3 The structure diagram of the database initialization device provided by the embodiment of the present application is shown in FIG. 2. Figure 3As shown, the database initialization apparatus 30 can include a receiving module 310, a determining module 320 and an initialization module 330.
[0075] The receiving module 310 is configured to receive a target system table version number input by a user.
[0076] The determining module 320 is configured to query a preset mapping relationship table according to the target system table version number to determine a target row number of a target system table corresponding to the target system table version number, wherein the mapping relationship table records row numbers of system tables corresponding to different system table version numbers respectively.
[0077] The initialization module 330 is configured to initialize a database based on the target row number of the target system table.
[0078] In an optional embodiment of the present application, the database initialization apparatus 30 further includes:
[0079] A first obtaining module is configured to obtain a first system table version number of a current version database and a second system table version number of a previous version database.
[0080] A second obtaining module is configured to obtain row numbers corresponding to each first system table in the current version database when the first system table version number and the second system table version number are inconsistent.
[0081] An updating module is configured to add a corresponding relationship between the first system table version number and the row numbers corresponding to each first system table into the mapping relationship table.
[0082] In an optional embodiment of the present application, the database initialization apparatus 30 further includes:
[0083] A prompting module is configured to send a prompt message to the user when an incompatibility is detected, wherein the prompt message is used to prompt the user to input the target system table version number.
[0084] In an optional embodiment of the present application, the system table version number is monotonically increasing.
[0085] In an optional embodiment of the present application, the system table version number is determined according to a time of performing a modification operation on the system table, and the modification operation is adding a row.
[0086] In an optional embodiment of the present application, the initialization module 330 is specifically configured to:
[0087] Obtain target data from a starting row of the target system table to the target row number.
[0088] The database is initialized using the target data.
[0089] The initialization apparatus of the database provided by the embodiments of the present application can execute the initialization method of the database provided by the embodiments of the present application, and has the function modules and beneficial effects corresponding to the execution method. The contents not described in detail in the device embodiments of the present application can refer to the description in any method embodiment of the present application.
[0090] It should be noted that, although several modules or units of the device for action execution are mentioned in the foregoing detailed description, such division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into embodied by multiple modules or units.
[0091] In the exemplary embodiments of the present application, an electronic device is also provided, comprising: a processor, configured to execute a computer program stored in a memory, the computer program being executed by the processor to implement the steps of the initialization method of the database as described in the above embodiments.
[0092] Figure 4 An exemplary structure diagram of an electronic device according to an embodiment of the present application is shown in FIG. 5. It should be noted that, Figure 4 The electronic device 500 shown is only an example, and should not impose any limitation on the functions and use range of the embodiments of the present application.
[0093] As Figure 4 shown, the electronic device 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or programs loaded from a storage portion 508 to a random access memory (RAM) 503. In the RAM 503, various programs and data required for system operation are also stored. The central processing unit 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0094] The following components are connected to the I / O interface 505: an input part 506 including a keyboard, a mouse, etc.; an output part 507 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage part 508 including a hard disk, etc.; and a communication part 509 including a network interface card such as a local area network (LAN) card, a modem, etc. The communication part 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 510 as necessary, so that a computer program read out therefrom is installed in the storage part 508 as necessary.
[0095] In particular, according to embodiments of the present application, the processes described above with reference to the flowcharts can be implemented as a computer software program. For example, embodiments of the present application include a computer program product comprising a computer program carried on a computer readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network by the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit 501, various functions defined in the apparatus of the present application are executed.
[0096] In embodiments of the present application, there is also provided a computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the steps of the initialization method of the database according to the above embodiments.
[0097] It should be noted that the computer readable storage medium shown in the present application can be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or apparatus, or any suitable combination of the above. More specific examples of the computer readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device. The program code contained in the computer readable storage medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, radio frequency, etc., or any suitable combination of the above.
[0098] In the embodiments of the present application, a computer program product is also provided, which, when running on a computer, causes the computer to perform the steps of the initialization method of the database as described in the above embodiments.
[0099] It should be noted that, in this document, the terms such as "first" and "second" are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0100] The above description is merely one specific implementation of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of initializing a database, characterized by, The method comprises: receiving a target system table version number input by a user; querying a preset mapping relationship table according to the target system table version number to determine a target row number of a target system table corresponding to the target system table version number, wherein the mapping relationship table records row numbers of system tables corresponding to different system table version numbers respectively, one system table version number corresponds to at least one system table, and the row numbers of system tables corresponding to different system table version numbers are different, and the system table version number is changed when a modification operation of adding rows is performed on the system table; obtaining target data from a starting row to the target row number of the target system table; initializing the database by using the target data.
2. The method of claim 1, wherein, The method further comprises: obtaining a first system table version number of a current version database and a second system table version number of a previous version database; when the first system table version number and the second system table version number are inconsistent, obtaining a row number corresponding to each first system table in the current version database respectively; adding a corresponding relationship between the first system table version number and the row number corresponding to each first system table respectively to the mapping relationship table.
3. The method of claim 1, wherein, The method further comprises: when an incompatible phenomenon is detected, sending a prompt message to the user, wherein the prompt message is used to prompt the user to input the target system table version number.
4. The method according to any one of claims 1 to 3, characterized in that, The system table version number is monotonically increasing.
5. The method of claim 4, wherein, The system table version number is determined according to a time of performing a modification operation on the system table, and the modification operation is adding rows.
6. An apparatus for initializing a database, characterized by comprising: The apparatus comprises: a receiving module configured to receive a target system table version number input by a user; a determining module configured to query a preset mapping relationship table according to the target system table version number to determine a target row number of a target system table corresponding to the target system table version number, wherein the mapping relationship table records row numbers of system tables corresponding to different system table version numbers respectively, one system table version number corresponds to at least one system table, and the row numbers of system tables corresponding to different system table version numbers are different, and the system table version number is changed when a modification operation of adding rows is performed on the system table; an initializing module configured to obtain target data from a starting row to the target row number of the target system table and initialize the database by using the target data.
7. The apparatus of claim 6, wherein, The apparatus further comprises: a first obtaining module configured to obtain a first system table version number of a current version database and a second system table version number of a previous version database; a second obtaining module configured to, when the first system table version number and the second system table version number are inconsistent, obtain a row number corresponding to each first system table in the current version database respectively; an updating module configured to add a corresponding relationship between the first system table version number and the row number corresponding to each first system table respectively to the mapping relationship table.
8. An electronic device, comprising: The apparatus comprises: a processor configured to execute a computer program stored in a memory, wherein the computer program is executed by the processor to implement steps of the initialization method of the database according to any one of claims 1-5.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, which is executed by a processor, implements the steps of the method for initializing a database according to any one of claims 1 to 5.
Citation Information
Patent Citations
Data table management method and device
CN107908718A
Online table data processing method and device, electronic equipment and readable medium
CN111581930A
Business data processing method and device, electronic equipment and medium
CN112287658A