Method, device, computer equipment and storage medium for rapid adaptation of database scripts

By replacing the client command line tools and modifying parameters in the source database script, the target database is automatically adapted, solving the problem of time-consuming and labor-intensive script modification during database switching, and achieving efficient database switching and seamless access.

CN112417024BActive Publication Date: 2024-10-11CHINA CONSTRUCTION BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011440594.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-11
Publication Date
2024-10-11
Estimated Expiration
2040-12-11

AI Technical Summary

Technical Problem

When switching databases, the scripts of the source database are difficult to use directly in the target database due to differences in instructions and parameters, resulting in the need for manual and complex modifications, which is inefficient.

Method used

Automatic script conversion and execution is achieved by replacing the client command line tool in the script of the source database with the conversion identifier, and modifying the connection parameters and setting parameters according to the configuration file to adapt them to the target database.

Benefits of technology

There is no need to generate target scripts specific to the target database, which saves development time, improves development efficiency, and enables seamless access to the original application system when switching databases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112417024B_ABST
    Figure CN112417024B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and in particular to a method, apparatus, computer equipment and storage medium for quickly adapting database scripts. Replace the client command line tool in the source script of the source database with a conversion identifier; when executing the source script of the source database, execute a conversion unit that matches the conversion identifier: modify the connection parameters in the source script of the source database according to the first configuration file, and connect to the target database; modify the first setting parameters in the source script of the source database to the second setting parameters of the target script of the target database according to the second configuration file; execute the target script of the target database with the second setting parameters in the target database; receive and output the return result of the target database. Using the embodiments of the present invention, there is no need to repeatedly generate a target script of the target database corresponding to the source script of the source database for the target database, which saves development time and improves development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This article relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for quickly adapting database scripts. Background Art

[0002] Data security has become a critical issue in the information age. Large banks and e-commerce platforms require databases to undergo various data stress tests, security tests, and disaster recovery. When replacing or switching a database, a large number of scripts that are dependent on the source database are used to perform various database operations within the source database, such as importing data, deleting temporary data, updating table records, querying configurations, and other such operations. When the source database needs to be replaced or switched to the target database, the instructions and parameters in the source database may differ from those in the target database due to database changes, making many scripts in the source database unusable in the target database.

[0003] How to efficiently update a large number of scripts that have dependencies on the source database to adapt to the target database is an urgent problem that needs to be solved. Summary of the Invention

[0004] The embodiments of this document provide a method, apparatus, computer device, and storage medium for rapidly adapting database scripts, which are used to solve the problem in the prior art of time-consuming and labor-intensive source script modification in a source database during database switching.

[0005] The embodiment of this article provides a method for quickly adapting database scripts, including:

[0006] Replace the client command line tool in the source script of the source database with the conversion identifier;

[0007] When executing the source script of the source database, executing the conversion unit that matches the conversion identifier includes:

[0008] Modify the connection parameters in the source script of the source database according to the first configuration file, and connect to the target database;

[0009] Modifying the first setting parameters in the source script of the source database into the second setting parameters of the target script of the target database according to the second configuration file;

[0010] executing a target script of the target database having the second setting parameters in the target database;

[0011] Receive and output the return result of the target database.

[0012] The embodiment of this invention also provides a device for quickly adapting a database script, comprising:

[0013] Batch replacement unit, used to replace the client command line tools in the source script of the source database with conversion identifiers;

[0014] A conversion unit, which, when executing a source script of the source database, executes a conversion unit that matches the conversion identifier, wherein the conversion unit further includes:

[0015] a first modification module, configured to modify connection parameters in a source script of the source database according to a first configuration file, so that the connection unit connects to the target database according to the modified connection parameters;

[0016] A second modification module is configured to modify the first setting parameters in the source script of the source database into second setting parameters in the target script of the target database according to the second configuration file;

[0017] An execution unit, configured to execute a target script of the target database having the second setting parameters in the target database;

[0018] The output unit is used to receive and output the return result of the target database.

[0019] The embodiments of this document further provide a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method when executing the computer program.

[0020] The embodiments of this document further provide a computer-readable storage medium having computer instructions stored thereon, which implement the above method when executed by a processor.

[0021] By utilizing the embodiments of this article, when switching a source database to a target database in an automated manner, there is no need to repeatedly generate a target script for the target database corresponding to the source script of the source database, thereby saving development time and improving development efficiency. External application systems do not need to be modified, so that the target database can be seamlessly connected to the original external application system to replace the source database. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of this article or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of this article. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1The figure shows a schematic diagram of a database switching system according to an embodiment of this invention;

[0024] Figure 2 Shown is a flowchart of a method for quickly adapting a database script according to an embodiment of this invention;

[0025] Figure 3 The figure shows a schematic diagram of the structure of a device for quickly adapting a database script according to an embodiment of this invention;

[0026] Figure 4 The figure shows a schematic diagram of the specific structure of a device for quickly adapting a database script according to an embodiment of this invention;

[0027] Figure 5 The figure shows a flow chart of a method for quickly adapting a database script according to an embodiment of the present invention;

[0028] Figure 6 Shown is a flow chart of executing a source script in a Gaussian database according to an embodiment of this invention;

[0029] Figure 7 Schematic diagram of the structure of the computing device in the embodiment of this article.

[0030]

Description of the accompanying drawings

[0031] 101. Source database;

[0032] 102. Target database;

[0033] 103. Conversion device;

[0034] 104. Source script;

[0035] 105. Target script;

[0036] 106. Application system;

[0037] 301, batch replacement unit;

[0038] 302, conversion unit;

[0039] 3021, first modification module;

[0040] 3022, second modification module;

[0041] 303, connection unit;

[0042] 304, execution unit;

[0043] 305, output unit;

[0044] 3051, receiving module;

[0045] 3052, additional information processing module;

[0046] 3053, output module;

[0047] 306, recording unit;

[0048] 307. First interactive interface;

[0049] 308. First configuration file information receiving unit;

[0050] 309. First configuration file matching unit;

[0051] 310. First configuration file parsing unit;

[0052] 311. Second interactive interface;

[0053] 312. Instruction receiving unit;

[0054] 313. Set parameter to add unit;

[0055] 314. Compliance Testing Unit;

[0056] 315, prompt unit;

[0057] 316. Third interactive interface;

[0058] 702. Computing equipment;

[0059] 704. Processing equipment;

[0060] 706. Storage resources;

[0061] 708, driving mechanism;

[0062] 710, input / output module;

[0063] 712. Input devices;

[0064] 714. Output device;

[0065] 716. Presentation equipment;

[0066] 718. Graphical User Interface;

[0067] 720, network interface;

[0068] 722, communication link;

[0069] 724. Communication bus. DETAILED DESCRIPTION

[0070] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in the embodiments of this document. Obviously, the embodiments described are only part of the embodiments of this document, not all of the embodiments. Based on the embodiments of this document, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this document.

[0071] like Figure 1 A schematic diagram of a database switching system according to an embodiment of the present invention is shown. This diagram illustrates how, after data from a source database 101 is imported into a target database 102, a large number of source scripts 104 in the source database are modified into target scripts 105 adapted for the target database by a conversion device 103. The source and target scripts can be, for example, shell scripts that can invoke command line instructions to perform database operations, such as importing data, deleting temporary data, updating table records, and querying configurations. Application systems 106 connected to source database 101 can seamlessly switch to connecting to target database 102, completing their business operations using the data in target database 102.

[0072] The source database 101 or the target database 102 can be, for example, GAUSSDB, ORACLE, SQLSERVER, MYSQL, etc. The shell script uses a fixed database client command line tool to perform operations on the source database or the target database. For example, the corresponding zsql client command line tool can be used for the GAUSSDB database, the corresponding sqlplus client command line tool can be used for the ORACLE database, the corresponding osql client command line tool can be used for the SQLSERVER database, and the corresponding mysql client command line tool can be used for the MYSQL database. The database client command line tool instructions and the sql statements to be executed are directly written into the shell script, wherein the Structured Query Language (SQL) is abbreviated as SQL. The Structured Query Language is a database query and programming language used to access data and query, update and manage relational database systems. The sql statements are structured query languages ​​for operating databases. In the prior art, in a scenario where a source database 101 is changed to a target database 102, it is necessary to manually modify the command line instructions in the source script 104 of the source database to the command line instructions in the target script 105 of the target database. However, due to the differences between the source database 101 and the target database 102, and the different parameters of the client command line tools of the source database 101 and the target database 102, the source database 101 and the target database 102 have different execution situations of the instructions in the SQL statements, and the source database 101 and the target database 102 return very different information. Therefore, it is necessary to perform a complex replacement on the source script 104 of the source database in order to form the target script 105 of the target database. In particular, when the source script 104 is extremely large, a replacement requires a huge workload and may require comparison of multiple database products, resulting in a large amount of additional development work. When switching between the source database and the target database, the adaptation efficiency of the corresponding database script is low.

[0073] The method in the embodiment of the present invention uses a conversion device 103 to pre-process the source script 104 of the source database and post-process the information fed back by the target database 102, converting all parameters of the source script 104 of the source database into the required mode of the target script 105 of the target database. In the embodiment of the present invention, the target script 105 can be generated without actually generating the target script 105. The source script 104 (equivalent to the target script 105) with all parameters replaced is run in the target database 102, including pre-processing such as modifying the command line execution tool name, modifying parameter values ​​and parameter names, and shielding special operations of the source database 101. The information returned by the target database 102 is then post-processed, shielding additional output information and format, to restore it to the format of the information returned by the source database, thus seamlessly integrating with the original application system, avoiding changes to the original application system, and avoiding processing failures or errors caused by the original application system processing different database return information. A configurable conversion tool can be provided to pre-process and post-process the source database script, so as to achieve script adaptation work when the database is replaced with minimal cost.

[0074] like Figure 2 The flowchart of a method for quickly adapting database scripts according to an embodiment of the present invention is shown. This figure describes how a large number of source scripts in a source database are changed to form target scripts in a target database during a database switching process, so as to adapt to executing the target scripts in the target database in the target database. The execution of the target script can return a processing result of the target database, which is the same as the processing result returned by executing the source script of the source database in the source database. Therefore, after the database is switched, the original application system can be seamlessly connected to complete the original business functions. The method described in the embodiment of the present invention can be run on a separate computer, or on a computer that stores a large number of source scripts in the source database, or on a computer of the application system, and automatically implements the parsing of the source scripts of the source database into the target scripts of the target database, specifically including:

[0075] Step 201: Replace the client command line tool in the source script of the source database with a conversion identifier;

[0076] Step 202, when executing the source script of the source database, execute the conversion unit that matches the conversion identifier, and when executing the conversion unit, the steps include:

[0077] Step 203: Modify the connection parameters in the source script of the source database according to the first configuration file, and connect to the target database;

[0078] Step 204: modify the first setting parameters in the source script of the source database to the second setting parameters of the target script of the target database according to the second configuration file;

[0079] Step 205: executing a target script of the target database having the second setting parameters in the target database;

[0080] Step 206: Receive and output the return result of the target database.

[0081] Through the method of the embodiments of this article, a large number of source scripts in the source database can be automatically converted into target scripts that are adapted to the target database during execution, without generating target scripts of the target database corresponding to the source scripts of the source database; the script replacement efficiency can also be improved, avoiding the problem of inefficiency caused by manually modifying a large number of source scripts of the source database into target scripts that are adapted to the target database; and the target database can seamlessly replace the source database and connect to the original application system without affecting the original business.

[0082] As an embodiment of this invention, when executing the source script of the source database, executing the conversion unit matching the conversion identifier further includes:

[0083] The conversion unit matching the conversion identifier is executed in the memory.

[0084] In this step, the source script of the source database is converted into the target script of the target database by the conversion unit. The target script of the target database is executed in the target database and the return result of the target database is received and outputted in the memory, and the target script of the target database is not generated in the form of a file.

[0085] As an embodiment of this invention, modifying the first setting parameter in the source script of the source database to the second setting parameter in the target script of the target database according to the second configuration file further includes:

[0086] Recording, according to the second configuration file, additional information in a return result of executing a target script of the target database having second setting parameters on the target database;

[0087] The step of receiving and outputting the return result of the target database also includes:

[0088] receiving a return result from the target database;

[0089] According to the recorded additional information, the additional information in the received return result is removed;

[0090] Output the returned result after removing the additional information.

[0091] In this step, due to the different types of source and target databases, some setting parameters may have different return information. For example, if the source database is an ORACLE database, the echo parameter setting in the ORACLE database is used to determine whether to echo each SQL statement in the script in the database return result. If the echo parameter is set to off, each SQL statement in the script will not be echoed in the database return result. The target database is a Gaussian database (GAUSSDB). The echo parameter setting in the GAUSSDB database also has the same function as that of the ORACALE database. The difference is that when the echo parameter is set to off, additional information of the off string will appear in the database return result. According to the target database's support information for the source database parameter settings recorded in the second configuration file, the setting parameter echo in the source script of the source database can be recorded. After the target script of the target database is executed in the target database, the additional information in the return result can be recorded. For example, in this example, the additional information is the off string. In addition, the positional information such as the order, string length, type, etc. of the setting parameters in the target script of the target database can also be recorded, as well as the additional information returned by each setting parameter. In other words, the positional information of the setting parameters in the target script of the target database and the corresponding additional information can be recorded, so that the additional information can be located in the return result of the target database.

[0092] When the target database executes the converted target script, it will generate corresponding execution results. For example, when performing a database query operation, the target database will return the query result; when performing an operation to add a record to the database, the target database will return the result of adding the record. However, the returned result includes additional information of the target database. Based on the location information of the additional information recorded in the aforementioned step in the target database return result, the additional information in the return result can be located. By deleting the additional information, the return result identical to that of the source database executing the source script of the source database can be obtained.

[0093] Feeding back the returned result after removing the additional information to the external application system can meet the corresponding business needs, so that the application system can seamlessly connect to the target database and work.

[0094] As an embodiment of this document, the first configuration file includes the target database name, the client command line tool in the target script of the target database, the target database address, and the target database operation mode.

[0095] In this step, the target database name is composed of a string or a specific digital number. The name of the first configuration file can be the name of the target database, so that the first configuration file that matches the target database name to be replaced can be found; different databases correspond to different client command line tools, for example, the GAUSSDB database uses the zsql client command line tool, the ORACLE database uses the sqlplus client command line tool, the SQLSERVER database uses the osql client command line tool, and the MYSQL database uses the mysql client command line tool; the target database address can include the URL (Uniform Resource Locator) or IP address of the target database, as well as information such as the port number; the target database operation mode refers to the parameters required when using the target database, for example, for the Gaussian database, -q means skip confirmation, -c means execute sql statements, and for the ORACLE database, -s means silent execution. The above-mentioned target database name, the client command line tool in the target script of the target database, the target database address, and the target database operation mode constitute the connection parameters in the embodiment of this article, and the connection parameters refer to the parameters by which the script can connect to the database to execute the sql statements in the script and the operations in the setting parameters.

[0096] As an embodiment of this document, the second configuration file includes association relationship information between the setting parameters of the source database and the setting parameters of the target database.

[0097] In this step, the second configuration file records the association relationship information between all the source database's setting parameters and the target database's setting parameters. The source database's source script may only include a portion of the setting parameters, depending on the database operation to be performed. These partial source database setting parameters constitute the first setting parameters, and the target database setting parameters corresponding to these first setting parameters constitute the second setting parameters. This association relationship information can be used to modify the source database's setting parameters to those of the target database. Furthermore, this association relationship information can be used to identify whether the source database's setting parameter function needs to be completed through a combination of target database instructions or a specific combination of operations. Furthermore, the differences between the source database's setting parameters and the target database's setting parameters can be identified, allowing the target database's return results to be parsed into the same format as the source database's.

[0098] As an embodiment of this invention, the association relationship information of the second configuration file specifically includes:

[0099] The source database's parameter fields and separators, whether the target database supports the fields and separators, the additional information fields and separators in the results returned by the target database, and the corresponding parameter fields for the target database.

[0100] In this step, the parameters can be set, for example, set echo on, set echo off, set show off, set feed off, etc., where setting the parameter set echo on means echoing each SQL statement in the script in the database return result, setting the parameter set echo off means not echoing each SQL statement in the script in the database return result, setting the parameter set show off means not echoing the instructions for setting the status values ​​before and after in the database return result, and setting the parameter set feed off means not returning the number of queried records in the database return result.

[0101] The setting parameters of the source database include all the setting parameters in the source database; whether the target database supports it can be indicated by "YES" or "NO", or "0" or "1" can be used to indicate support or non-support; the additional information in the result returned by the target database may vary depending on the target database. For example, in the Gaussian database, the setting parameter set feed off will be accompanied by the string "OFF" in the database return result; the setting parameters corresponding to the target database are the setting parameters corresponding to the aforementioned source database setting parameters. When the setting parameters in the target database are the same as the source database setting parameters, this field can be empty (NULL); when they are different, it can be a setting parameter of a specific form in the target database, for example, if the source database setting parameter is "whenever sqlerror exit-1;", the corresponding target database setting parameter is "whenever sqlerror exit;".

[0102] Among them, the specific association relationship information can be expressed as, for example, =set heading off; =YES=OFF=, where "=" is a separator, and in other embodiments it can be in other forms such as " / " or "-", "set headingoff;" is the setting parameter in the source database, "YES" means that the target database supports the setting parameter, and "OFF" means that the attachment information is the "OFF" string when the target database returns the result; in this embodiment, the setting parameters of the target database are the same as the setting parameters of the source database, so there is space after the last separator "=", indicating that the setting parameters of the mold table database are the same as the setting parameters of the source database.

[0103] As an embodiment of this invention, modifying the first setting parameter in the source script of the source database to the second setting parameter in the target script of the target database according to the second configuration file further includes:

[0104] When the target database support field in the second configuration file indicates that a first setting parameter of the source script of the source database is not supported, the first setting parameter is masked in the process of modifying the first setting parameter in the source script of the source database to the second setting parameter of the target script of the target database.

[0105] In this step, masking the first setting parameter means discarding the unsupported setting parameter in the target script of the target database. When the "Whether the target database supports" field record in the second configuration file corresponds to a specific setting parameter in the source script of the source database and is "NO", that is, the second configuration file does not support a certain setting parameter in the source script of the source database, for example, does not support the setting parameter "set feed off" in the source script of the source database, then the setting parameter in the source script of the source database is not modified to the second setting parameter of the target script of the target database, that is, the setting parameter "set feed off" is discarded in the target script of the target database, so that the setting parameter is not processed when the target script is executed in the target database.

[0106] As an embodiment of this invention, the conversion unit that performs matching with the conversion identifier further includes:

[0107] displaying a first interactive interface for the user to input the first configuration file information;

[0108] receiving first configuration file information input by the user based on the first interactive interface;

[0109] matching the first configuration file according to the first configuration file information;

[0110] The connection parameters for connecting to the target database are obtained according to the first configuration file.

[0111] In this step, when the source database needs to be replaced or switched to a target database, the target database can be specified by the user or pre-set in the conversion unit. In this embodiment, the target database is specified by the user. The user can be informed by a dialog box displayed on the screen that the first configuration file information corresponding to the target database should be entered. For example, the user can enter the Gaussian database as the target database to be switched in the dialog box. The conversion unit can find the corresponding first configuration file based on the name of the target database, such as GaussianDatabase.property. Different configuration files correspond to different databases, and can be distinguished by the database name.

[0112] After obtaining the first configuration file of the target database, the connection parameters for connecting to the target database are parsed from the first configuration file, including information such as the target database name, the client command line tool in the target script of the target database, the target database address, and the target database operation mode.

[0113] As an embodiment of this invention, the conversion unit that performs the conversion identification matching further includes:

[0114] Displaying a second interactive interface for the user to input operations on the source database when executing the source script of the source database;

[0115] receiving an instruction input by the user based on the second interactive interface for operating the source database;

[0116] The instruction for operating the source database is used as a part of the first setting parameter in the source script of the source database.

[0117] In this step, the first setting parameter in the source script of the source database may be a wildcard (or variable), for example, "${CONDITION1}" represents a wildcard for the query condition. When executing the source script of the source database, the user is required to input the corresponding query condition according to actual needs, or the application system assigns the wildcard to an actual database operation instruction. For example, the query condition or database operation instruction is to search for males aged greater than or equal to 30 years old. The database operation instruction input by the user is used as part of the first setting parameter in the source script of the source database. In step 204, the first setting parameter in the source script of the source database is modified to the second setting parameter of the target script of the target database, so that the target script can be executed in the target database.

[0118] As an embodiment of this invention, when executing the conversion unit matching the conversion identifier, it further includes:

[0119] Determining whether the source script of the source database is compliant;

[0120] If it is not compliant, the prompt will indicate that the conversion unit cannot be executed.

[0121] In this step, the conversion unit performs a compliance check on the source script of the source database, for example, checking whether the source script of the source database includes database connection parameters, whether the first setting parameter in the source script of the source database meets format requirements, and whether the SQL statements in the source script of the source database meet syntax requirements. If the compliance check is passed, the conversion unit proceeds to the next step, modifying the connection parameters in the source script of the source database according to the first configuration file, connecting to the target database, and other subsequent steps. If the compliance check is not passed, a dialog box is displayed on the display interface, prompting the user that the source script of the source database is non-compliant and that subsequent replacement of the target script of the target database cannot be performed.

[0122] As an embodiment of this invention, modifying the first setting parameter in the source script of the source database to the second setting parameter in the target script of the target database according to the second configuration file further includes:

[0123] When the first setting parameters in the source script of the source database cannot be modified to the second setting parameters of the target script of the target database according to the second configuration file, the third interactive interface is used for the user to input the second setting parameters of the target script of the target database that can realize the function of the first setting parameters in the source script of the source database.

[0124] In this step, when the second configuration file does not record the association relationship information between the setting parameters of the source database and the setting parameters of the target database, a dialog box is displayed to prompt the user which setting parameters in the source script of the source database cannot be converted into setting parameters of the target script of the target database, so that the user can enter the SQL statement or operation instruction of the target database in the dialog box (which may be a combination of multiple setting parameters supported by the target database to implement the setting parameters in the source database), and implement the corresponding setting parameters in the source database through the SQL statement or operation instruction of the target database, so that the target script of the target database can implement all functions and database operations in the source script of the source database.

[0125] Through the method in the embodiments of this article, when switching the source database to the target database in an automated manner, there is no need to repeatedly generate a target script of the target database corresponding to the source script of the source database for the target database, thereby saving development time and improving development efficiency; the external application system does not need to be modified, so that the target database can be seamlessly connected to the original external application system to replace the source database.

[0126] like Figure 3The figure shows a schematic diagram of the structure of a device for quickly adapting database scripts according to an embodiment of this invention. This figure describes a scheme for adapting a large number of source scripts of a source database to the hardware and software structure of a target database after database switching. The various functional units described in this embodiment can be implemented using separate computers or general-purpose chips. Multiple functional units can be integrated together and implemented by separate computers, or they can be integrated into computers in existing systems and implemented through software. It includes a batch replacement unit 301, a conversion unit 302, a connection unit 303, an execution unit 304, and an output unit 305. The conversion unit 302 further includes a first modification module 3021 and a second modification module 3022. The device specifically includes:

[0127] A batch replacement unit 301 is used to replace the client command line tool in the source script of the source database with a conversion identifier;

[0128] The conversion unit 302 executes the conversion unit that matches the conversion identifier when executing the source script of the source database, wherein the conversion unit further includes:

[0129] A first modification module 3021 is configured to modify the connection parameters in the source script of the source database according to the first configuration file, so that the connection unit 303 connects to the target database according to the modified connection parameters;

[0130] A second modifying module 3022 is configured to modify the first setting parameters in the source script of the source database into second setting parameters in the target script of the target database according to the second configuration file;

[0131] An execution unit 304 is configured to execute a target script of the target database having the second setting parameters in the target database;

[0132] The output unit 305 is configured to receive and output the return result of the target database.

[0133] As an example of this article, Figure 4 The figure shows a schematic diagram of the specific structure of a device for quickly adapting a database script according to an embodiment of the present invention. The figure describes the specific structure of the device, which also includes:

[0134] The conversion unit 302 is executed in the memory.

[0135] As an embodiment of the present invention, the system further includes a recording unit 306, configured to record, according to the second configuration file, additional information in a return result of executing a target script of the target database having second setting parameters on the target database on the target database;

[0136] The output unit 305 further includes a receiving module 3051, an additional information processing module 3052, and an output module 3053.

[0137] The receiving module 3051 is configured to receive the return result from the target database;

[0138] Additional information processing module 3052, configured to remove the additional information from the received return result according to the recorded additional information;

[0139] The output module 3053 is used to output the returned result after removing the additional information.

[0140] As an embodiment of this document, the first configuration file includes the target database name, the client command line tool in the target script of the target database, the target database address, and the target database operation mode.

[0141] As an embodiment of this document, the second configuration file includes association relationship information between the setting parameters of the source database and the setting parameters of the target database.

[0142] As an embodiment of this invention, the association relationship information of the second configuration file specifically includes:

[0143] The source database's parameter fields and separators, whether the target database supports the fields and separators, the additional information fields and separators in the results returned by the target database, and the corresponding parameter fields for the target database.

[0144] As an embodiment of this invention, it further includes a first interactive interface 307, a first configuration file information receiving unit 308, a first configuration file matching unit 309, and a first configuration file parsing unit 310.

[0145] The first interactive interface 307 is used to display a first interactive interface for the user to input the first configuration file information;

[0146] A first configuration file information receiving unit 308 is configured to receive first configuration file information input by the user based on the first interactive interface;

[0147] A first configuration file matching unit 309 is configured to match the first configuration file to the first configuration file according to the first configuration file information;

[0148] The first configuration file parsing unit 310 is configured to obtain connection parameters for connecting to the target database according to the first configuration file.

[0149] As an embodiment of this invention, it also includes a second interactive interface 311, an instruction receiving unit 312, and a setting parameter adding unit 313.

[0150] The second interactive interface 311 displays a second interactive interface for the user to input operations on the source database when executing the source script of the source database;

[0151] An instruction receiving unit 312 receives an instruction input by the user based on the second interactive interface to operate the source database;

[0152] The setting parameter adding unit 313 is configured to take the instruction for operating the source database as a part of the first setting parameter in the source script of the source database.

[0153] As an embodiment of this invention, it also includes a compliance detection unit 314 and a prompt unit 315.

[0154] Wherein, the compliance detection unit 314 is used to determine whether the source script of the source database is compliant;

[0155] The prompting unit 315 is used to prompt that the conversion unit cannot be executed when there is non-compliance.

[0156] As an embodiment of the present invention, a third interactive interface 316 is further included for allowing a user to input the second setting parameters of the target script of the target database that can implement the function of the first setting parameters in the source script of the source database when the first setting parameters in the source script of the source database cannot be modified to the second setting parameters of the target script of the target database according to the second configuration file;

[0157] The instruction receiving unit 312 receives a second setting parameter of a target script of a target database input by the user based on the third interactive interface.

[0158] Through the device in the embodiments of this article, when switching the source database to the target database in an automated manner, there is no need to repeatedly generate a target script of the target database corresponding to the source script of the source database for the target database, thereby saving development time and improving development efficiency; the external application system does not need to be modified, so that the target database can be seamlessly connected to the original external application system to replace the source database.

[0159] like Figure 5 The flowchart of a method for quickly adapting database scripts in an embodiment of this invention is shown. This figure uses ORACLE as the source database and Gaussian as the target database as examples. The client command line tool for ORACLE is sqlplus, and the client command line tool for Gaussian is zsql. The source database has a large number of source scripts adapted for it. This embodiment uses querying a date field as an example of what a source script needs to accomplish. Specifically, the following steps are included:

[0160] Step 501: Generate a first configuration file of the Gaussian database.

[0161] In this step, a first configuration file corresponding to the Gaussian database as the target database is generated. In the first configuration file, the database name used to match the configuration file can be first configured. For example, the configuration file is named Gaussian database 01, and / or the database name corresponding to the configuration file is written in the first line of the configuration file, that is, Gaussian database, DBPRODUCT = Gaussian database 01; wherein, Gaussian database 01 refers to the script adaptation required for switching from ORACLE database to Gaussian database. When the target database is Gaussian database 02, it represents the script adaptation required for switching from MYSQL database to Gaussian database.

[0162] In the configuration file named Gaussian Database 01, configure the target database's target script with the client command line tool, target database address, and target database operation mode. The Gaussian database can be configured to use the zsql client command line tool by setting SQLCMD=zsql; the Gaussian database address can be replaced with @DB=@128.111.222.222:4000 for the script to connect to, where @DB is a wildcard character that can be replaced with the command string (source database address or name) provided by the external application system or manual user input. The source database name is further replaced with the address 128.111.222.222:4000, where 4000 is the target database (the port number of the Gaussian database computer); and the Gaussian database operation mode can be set with SQLCMDSUFFIX=-qc, where SQLCMDSUFFIX is a command suffix parameter required when using the target database. -q indicates skipping confirmation, and -c indicates executing the SQL statement.

[0163] Step 502: Generate a second configuration file of the Gaussian database.

[0164] In this step, the second configuration file includes association relationship information between the setting parameters of the source database and the setting parameters of the target database, wherein the association relationship information includes the following:

[0165] 00==YES=connected.SQL>=

[0166] 01=set echo off;=YES=OFF=

[0167] 02=set pages*;=YES==

[0168] 03=set heading off;=YES=OFF=

[0169] 05=set feedback off;=YES=OFF=

[0170] …

[0171] 16=set show off;=NO==

[0172] …

[0173] 25=set feed off;=YES=OFF=

[0174] …

[0175] 31=whenever sqlerror exit-1;=YES==whenever sqlerror exit;

[0176] The above-mentioned second configuration file includes the association between all the setting parameters supported by the ORACLE database and the setting parameters of the Gaussian database. The format of each line in the second configuration file is: serial number = setting parameters of the source script = whether the target database supports it = additional information returned by the target database = setting parameters that need to be replaced by the target database, and the serial number is the first two digits.

[0177] Take the relationship with the first line numbered 00 as an example. Line 00 represents the difference between the source script of the source database and the target script of the target database when they connect to their respective databases. The last two delimiters "=" are separated by "connected.SQL>". In this example, when the target script of the target database connects to the target database, the target database returns the additional information "connected.SQL>".

[0178] Take the relationship numbered 02 in the third row as an example. "set pages*;" is the setting parameter of the source database, "YES" indicates whether the target database supports it, which it does in this example. The space between the last two delimiters "=" indicates that the target database will not return additional information for the setting parameter "set pages*;".

[0179] Take the fifth row with the relationship number 05 as an example. "set feedback off;" is the setting parameter of the source database, "YES" indicates whether the target database supports it, which is yes in this example. The last separator "=" contains "OFF", indicating that the target database returns the additional information "OFF" for the setting parameter "set feedback off;".

[0180] Take the association number 16 as an example, where "set show off;" is a setting parameter of the source database, "NO" indicates whether the target database supports it, which in this case is not supported; the space between the last two delimiters "=" indicates that the target database does not return any additional information for the setting parameter "set show off;". When the conversion unit is executed and encounters the setting parameter in the source script of the source database, a third interactive interface will be displayed based on the unsupported record in the second configuration file, allowing the user to enter a combination of corresponding setting parameters or database operation instructions based on the third interactive interface to implement the function of the setting parameter in the source script of the source database, so that the function of the setting parameter can be implemented when the target script is executed in the target database.

[0181] Take the association relationship with sequence number 31 as an example, where "whenever sqlerror exit-1;" is the setting parameter of the source database, "YES" indicates whether the target database supports it, which in this example is supported; the space between the last two delimiters "=" indicates that the target database does not return any additional information for the setting parameter "whenever sqlerror exit-1;". "whenever sqlerror exit;" is included after the last delimiter, indicating that the setting parameter in the target database corresponding to the setting parameter "whenever sqlerror exit-1;" in the source database is "whenever sqlerror exit;". The setting parameter "whenever sqlerrorexit-1;" in the source script of the source database is replaced with the setting parameter "whenever sqlerror exit;" of the target script of the target database. In this way, the setting parameter can be executed in the target database.

[0182] Step 503: Replace sqlplus in all source scripts of the ORACLE database with btsqlclient.

[0183] In this step, there are a large number of source scripts in the ORACLE database. Each script can be combined with the ORACLE database to perform different functions. For example, to query a date field in the data, the source script needs to call sqlplus in the ORACLE database to query a date field in the data. The source script is as follows:

[0184] DATE_DB=`sqlplus-s user1 / user1@DB001`<<!

[0185] Set echo off;

[0186] Set heading off;

[0187] Set feed off;

[0188] Select to_char(date1,'yyyymmdd')from table1 where condition1='${CONDITION1}';

[0189] Quit;

[0190] ! `

[0191] DATE_DB = `sqlplus -s user1 / user1@DB001` is the connection parameter for the source script to connect to the source database (that is, the ORACLE database). "sqlplus -s" refers to the sqlplus client command line tool of the ORACLE database, and -s indicates executing SQL in silent mode. "user1 / user1@DB001" means that the user name for connecting to the ORACLE database is user1, the password is user1, and the database name is @DB001.

[0192] Set echo off means that each SQL statement in the script will not be echoed in the database return results;

[0193] Set heading off means that the field name will not be echoed in the database return results;

[0194] Set feed off means to echo the additional information at the end of the found record line in the database return result;

[0195] Select to_char(date1,'yyyymmdd')from table1 where condition1='${CONDITION1}' indicates searching for records in the data table named table1 where the condition (condition1) satisfies the '${CONDITION1}' wildcard character, and returns the data in the date1 (date) field in the 'yyyymmdd' format. The wildcard character '${CONDITION1}' can be set by an external application system to specify the query condition, or the query condition can be manually entered by the user.

[0196] The output result of executing the above source script in the ORACLE database is, for example, [20201109].

[0197] In this embodiment, the "sed -i ' / sqlplus–s / btsqlclient / '*.sh'" command can be used to replace the "sqlplus–s" client command line tool in all source database source scripts with the conversion identifier "btsqlclient." All source script files end with ".sh," where i represents the number of source scripts. Each time a source script is replaced, i-1 is used. btsqlclient can be matched to a corresponding executable program, thereby initiating the modification of the source script to the target script when the source script is executed.

[0198] The source script after replacing the client command line tool in the source script is as follows:

[0199] DATE_DB=`btsqlclient user1 / user1@DB001`<<!

[0200] Set echo off;

[0201] Set heading off;

[0202] Set feed off;

[0203] Select to_char(date1,'yyyymmdd')from table1 where condition1='${CONDITION1}';

[0204] Quit;

[0205] ! `

[0206] As you can see, after the replacement, the source script settings and connection parameters remain unchanged; only the client command line tool changes to a conversion flag. To switch from a Gaussian database to an Oracle database, simply change the conversion flag, btsqlclient , to the Oracle database client command line tool, "sqlplus -s." This facilitates script switching between databases, avoids repeated script modifications, and improves development efficiency.

[0207] Step 504: When executing the source script of the source database on the target database, execute btsqlclient to perform script conversion.

[0208] In this step, when the computer executes the business of the external application system, it calls the above-mentioned source script to complete the related business. When executing the first line of the source script, since the client command line tool "sqlplus-s" has been replaced by "btsqlclient", the source script execution program is jumped out, and the btsqlclient conversion program is started to modify the connection parameters and setting parameters in the source script so that the functions of the source script are executed in the Gaussian database. Therefore, there is no need to generate a target script for the target database (Gaussian database) separately. It is only necessary to execute the btsqlclient conversion program in the memory to complete the change of the connection parameters and setting parameters in the source script, and the target database generates the corresponding business processing results, and the return results of the Gaussian database are fed back to the external application system. In order to clearly illustrate that the modified source script has changed, the target script method is adopted in this article to describe the source script after the connection parameters and setting parameters have changed, but in fact the target script, a file stored in the non-volatile storage medium, is not generated.

[0209] For specific steps, please refer to Figure 6 The flowchart of executing a source script in a Gaussian database according to an embodiment of the present invention is shown. This figure describes the process of modifying the source script of the ORACLE database into a target script suitable for execution in the Gaussian database after switching from the ORACLE database to the Gaussian database. This process can be run in the computer memory without generating the target script with modified parameters. Specifically, it includes:

[0210] Step 601: Search for a matching first configuration file and a matching second configuration file according to the name of the Gaussian database.

[0211] In this step, the corresponding first configuration file can be found according to the name of the target database, which is Gaussian database 01 in this example. Gaussian database 01 represents the first configuration file for switching from an ORACLE database to a Gaussian database. It can also include Gaussian database 02, which represents the first configuration file for switching from a MYSQL database to a Gaussian database, and so on.

[0212] The first configuration file may be as follows:

[0213] SQLCMD=zsql;

[0214] @DB001=@128.111.222.222:4000;

[0215] SQLCMDSUFFIX=-qc;

[0216] Among them, SQLCMD=zsql means using the zsql client command line tool to execute the target script in the Gaussian database; @DB001=@128.111.222.222:4000 means replacing the database name DB001 in the ORACLE database with the IP address and port number of the Gaussian database; SQLCMDSUFFIX=-qc means that the operating mode of the Gaussian database is -q (skip confirmation) and -c (execute SQL statements).

[0217] Step 602 , determining whether the source script complies with the regulations, if so, proceeding to step 604 , otherwise proceeding to step 603 .

[0218] In this step, it can be determined whether the SQL statements in the source script comply with the syntax requirements of the SQL statements, whether there are any errors in the setting parameters, etc. If an illegal error occurs, go to step 603, otherwise go to step 604.

[0219] Step 603: Display a prompt message indicating that the source script cannot be replaced.

[0220] Step 604: Modify the connection parameters of the source script according to the first configuration file to connect to the Gaussian database.

[0221] In this step, when the database name in the ORACLE database in the first configuration file is a wildcard, a dialog box of an interactive interface can be displayed on the graphical user interface, prompting the user to enter the address of the Gaussian database to be connected in the dialog box, so that the user can flexibly connect to the specified Gaussian database according to the user configuration. The user can also configure the user name and password for logging into the Gaussian database.

[0222] Alternatively, the Gaussian database may be connected according to connection parameters input by the external application system, such as database name, user name, and password.

[0223] In this example, zsql in the first configuration file is used as the client command line tool of the Gaussian database, 128.111.222.222:4000 is used as the address of the Gaussian database library, and -qc is used as the operation mode for connecting to the Gaussian database.

[0224] Step 605: Modify the setting parameters in the source script to the setting parameters of the Gaussian database according to the second configuration file.

[0225] In this step, the setting parameters in the source script are replaced according to the second configuration file generated in the above step. The specific result after replacement is:

[0226] set echo off;

[0227] set heading off;

[0228] set feed off;

[0229] Select to_char(date1,'yyyymmdd')from table1 where condition1='${CONDITION1}';

[0230] quit;

[0231] Although the setting parameters in the source script in the above example do not change, they may change in other embodiments. Assuming that the setting parameter A in the ORACLE database is A', the setting parameter of the corresponding function in the Gaussian database is replaced by A' in this step.

[0232] In other embodiments, if "${CONDITION1}" in the source script is a wildcard, the query conditions in the business are input into the source script by the external application system in the form of parameter passing, that is, the wildcard is replaced; or, the user is required to manually input the corresponding conditions. At this time, an interactive interface dialog box can be displayed in the user graphical interface for the user to manually input the query conditions to replace the wildcard in the source script, and the setting parameter "Selectto_char(date1,'yyyymmdd')from table1 where condition1='input query conditions'" is replaced with the setting parameters supported by the Gaussian database through the second configuration file in this step.

[0233] In a further embodiment, when certain setting parameters in the source script cannot be converted into setting parameters in the Gaussian database according to the second configuration file, a dialog box of an interactive interface is displayed in the graphical user interface, prompting the user to enter a SQL statement that implements the same function as the setting parameters in the source script, or setting parameters in the Gaussian database, or a combination of other instruction strings.

[0234] Step 606: Record additional information in the result returned when the setting parameters in the source script are replaced with the setting parameters in the Gaussian database according to the second configuration file.

[0235] In this step, when the source script parameter settings corresponding to the Gaussian database are executed in the Gaussian database, additional information will be interspersed in the returned result. For example, in this example, "set echo off; set heading off; set feed off" will all be interspersed with the OFF string in the returned result, that is, three OFF strings will appear. Since the Gaussian database automatically returns the "connected.SQL>" string when connected, the additional information "connected.SQL>OFF OFF OFF" will appear when the source script is executed by the Gaussian database. These additional information strings are recorded. In addition, the position and order of these additional information can also be recorded. For example, in the returned result, the first to 14 characters are the additional information for the Gaussian database connection, the 16th to 18th characters are the additional information returned by setting the parameter echo off, the 20th to 23rd characters are the additional information returned by setting the parameter heading off, and the 24th to 27th characters are the additional information returned by setting the parameter feed off. Discontinuous character positions are spaces.

[0236] In a further embodiment, the setting parameters appearing in the above-mentioned source script may also be recorded, and the line number information corresponding to the corresponding setting parameters in the second configuration file may be recorded. For example, in this example, the setting parameters in lines 00, 01, 03, and 05 of the second configuration file in the source script may be recorded. In the subsequent step of removing the additional information, the additional information recorded in the setting parameters of the corresponding number of lines may be obtained according to the second configuration file, and the corresponding attachment information may be matched in the results returned by the Gaussian database for deletion.

[0237] When the additional information returned by the setting parameters of the Gaussian database is the same as the additional information in the setting parameter return result in the source script of the ORACLE database, the additional information of the setting parameters may not be recorded.

[0238] Step 505: Execute the source script after the parameter setting is replaced in the Gaussian database.

[0239] In this step, after Gaussian Database executes the source script after parameter replacement, the return result is: [connected.SQL>OFF OFF OFF 20201109].

[0240] Step 506: Receive the return result from the Gaussian database.

[0241] Step 507: remove the additional information in the returned result.

[0242] In this step, the additional information returned by the setting parameters of the Gaussian database corresponding to the setting parameters in the source script may be deleted according to the second configuration file.

[0243] In a further embodiment, the attachment information can be deleted from the result returned by the Gaussian database based on the additional information recorded above; the corresponding attachment information can also be found and deleted from the result returned by the Gaussian database based on the position and sequence information of the additional information recorded.

[0244] In this example, after deleting the additional information in the result [connected.SQL>OFF OFF OFF 20201109] returned by the Gaussian database, the result is [20201109], which is the same as the result returned by executing the source script in the ORACLE database. This allows seamless integration with external application systems.

[0245] like Figure 7 This is a schematic diagram of the structure of a computing device in an embodiment of this document. The apparatus for rapidly adapting database scripts herein may be a computing device in this embodiment, used to perform the method described above. Computing device 702 may include one or more processing devices 704, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. Computing device 702 may also include any storage resources 706 for storing any type of information, such as code, settings, data, and the like. For example, and without limitation, storage resources 706 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory, hard disks, optical disks, and the like. More generally, any storage resource may use any technology to store information. Furthermore, any storage resource may provide volatile or non-volatile retention of information. Furthermore, any storage resource may represent a fixed or removable component of computing device 702. In one embodiment, when processing device 704 executes associated instructions stored in any storage resource or combination of storage resources, computing device 702 may perform any operation of the associated instructions. The computing device 702 also includes one or more drive mechanisms 708 for interacting with any storage resources, such as a hard disk drive mechanism, an optical disk drive mechanism, and the like.

[0246] The computing device 702 may also include an input / output module 710 (I / O) for receiving various inputs (via input devices 712) and providing various outputs (via output devices 714). A specific output mechanism may include a presentation device 716 and an associated graphical user interface (GUI) 718. In other embodiments, the input / output module 710 (I / O), input devices 712, and output devices 714 may not be included, and the computing device 702 may simply be a computing device in a network. The computing device 702 may also include one or more network interfaces 720 for exchanging data with other devices via one or more communication links 722. One or more communication buses 724 couple the components described above together.

[0247] The communication link 722 may be implemented in any manner, for example, via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 722 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0248] The embodiments of the present invention further provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0249] Replace the client command line tool in the source script of the source database with the conversion identifier;

[0250] When executing the source script of the source database, executing the conversion unit that matches the conversion identifier includes:

[0251] Modify the connection parameters in the source script of the source database according to the first configuration file, and connect to the target database;

[0252] Modifying the first setting parameters in the source script of the source database into the second setting parameters of the target script of the target database according to the second configuration file;

[0253] executing a target script of the target database having the second setting parameters in the target database;

[0254] Receive and output the return result of the target database.

[0255] The computer device provided in the embodiments of this invention can also implement the following Figure 2 、 Figure 5 、 Figure 6 The method in .

[0256] Corresponding to Figure 2 、 Figure 5 、 Figure 6 The embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which executes the steps of the above method when executed by a processor.

[0257] The embodiment of the present invention also provides a computer readable instruction, wherein when the processor executes the instruction, the program causes the processor to execute the following Figure 2 、 Figure 5 、 Figure 6 The method shown.

[0258] It should be understood that in the various embodiments of this document, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.

[0259] It should also be understood that in the embodiments herein, the term "and / or" merely describes an association between associated objects, indicating that three possible relationships exist. For example, "A and / or B" could represent: A alone, A and B simultaneously, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.

[0260] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the composition and steps of each example according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.

[0261] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0262] In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices, or units, or can be an electrical, mechanical, or other form of connection.

[0263] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments herein.

[0264] In addition, the functional units in the various embodiments herein may be integrated into a single processing unit, each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0265] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this article is essentially or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of this article. The aforementioned storage medium includes: various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0266] This article uses specific embodiments to illustrate the principles and implementation methods of this article. The description of the above embodiments is only used to help understand the methods and core ideas of this article. At the same time, for those skilled in the art, based on the ideas of this article, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation to this article.

Claims

1. A method for quickly adapting database scripts, Features include, Replace the client command line tool in the source script of the source database with the conversion identifier; When executing the source script of the source database, executing the conversion unit matching the conversion identifier includes: Modify the connection parameters in the source script of the source database according to the first configuration file, and connect to the target database; Modify the first setting parameter in the source script of the source database into the second setting parameter of the target script of the target database according to the second configuration file; Executing a target script of the target database having the second setting parameters in the target database; Receive and output the return result of the target database.

2. The method according to claim 1, It is characterized in that When executing the source script of the source database, executing the conversion unit matching the conversion identifier further includes: The conversion unit matching the conversion identifier is executed in the memory.

3. The method according to claim 1, It is characterized in that Modifying the first setting parameter in the source script of the source database into the second setting parameter of the target script of the target database according to the second configuration file further includes: According to the second configuration file, recording the additional information in the return result of the target database according to the execution of the target script of the target database with the second setting parameters; The step of receiving and outputting the return result of the target database also includes: Receiving a return result from the target database; According to the recorded additional information, removing the additional information in the received return result; The returned result after removing the additional information is outputted.

4. The method according to claim 1, It is characterized in that The first configuration file includes a target database name, a client command line tool in a target script of the target database, a target database address, and a target database operation mode.

5. The method according to claim 1, It is characterized in that The second configuration file includes association relationship information between the setting parameters of the source database and the setting parameters of the target database.

6. The method according to claim 5, It is characterized in that The association relationship information of the second configuration file specifically includes: The setting parameter fields and separators of the source database, whether the target database supports the fields and separators, the additional information fields and separators in the results returned by the target database, and the setting parameter fields corresponding to the target database.

7. The method according to claim 6, It is characterized in that Modifying the first setting parameter in the source script of the source database into the second setting parameter of the target script of the target database according to the second configuration file further includes: When the target database support field in the second configuration file indicates that a first setting parameter of the source script of the source database is not supported, the first setting parameter is masked in the process of modifying the first setting parameter in the source script of the source database to the second setting parameter of the target script of the target database.

8. The method according to claim 6, It is characterized in that The separator is "="; when the target database does not include additional information in the result returned, the additional information field in the target database is empty; when the setting parameters corresponding to the target database are the same as the setting parameters of the source database, the setting parameter field corresponding to the target database is empty.

9. The method according to claim 1, It is characterized in that The conversion unit that performs matching with the conversion identifier further includes: Displaying a first interactive interface for the user to input the first configuration file information; receiving first configuration file information input by the user based on the first interactive interface; Matching the first configuration file according to the first configuration file information; The connection parameters for connecting to the target database are obtained according to the first configuration file.

10. The method according to claim 1, It is characterized in that The conversion unit that performs matching with the conversion identifier further includes: Displaying a second interactive interface for the user to input operations on the source database when executing the source script of the source database; receiving an instruction input by the user based on the second interactive interface for operating the source database; The instruction for operating the source database is used as a part of the first setting parameter in the source script of the source database.

11. The method according to claim 1, It is characterized in that When executing the conversion unit matching the conversion identifier, the method further includes: Determining whether the source script of the source database is compliant; If it is not compliant, it will prompt that the conversion unit cannot be executed.

12. The method according to claim 1, It is characterized in that Modifying the first setting parameter in the source script of the source database into the second setting parameter of the target script of the target database according to the second configuration file further includes: When the first setting parameters in the source script of the source database cannot be modified to the second setting parameters of the target script of the target database according to the second configuration file, a third interactive interface is used for the user to input the second setting parameters of the target script of the target database that can realize the function of the first setting parameters in the source script of the source database.

13. The method according to claim 1, It is characterized in that The source database and the target database are different from one of the following databases: GAUSSDB database, ORACLE database, SQLSERVER database, MYSQL database.

14. The method according to claim 13, It is characterized in that The client command line tools corresponding to the GAUSSDB database, ORACLE database, SQLSERVER database, and MYSQL database are: zsql client command line tool, sqlplus client command line tool, osql client command line tool, mysql client command line tool.

15. A device for quickly adapting database scripts, Features include, A batch replacement unit, used to replace the client command line tool in the source script of the source database with the conversion identifier; A conversion unit, when executing a source script of the source database, executes a conversion unit matching the conversion identifier, wherein the conversion unit further comprises: A first modification module, configured to modify connection parameters in a source script of the source database according to a first configuration file, so that a connection unit is connected to a target database according to the modified connection parameters; A second modification module, configured to modify the first setting parameter in the source script of the source database into the second setting parameter of the target script of the target database according to the second configuration file; An execution unit, configured to execute a target script of the target database having the second setting parameters in the target database; The output unit is used to receive and output the return result of the target database.

16. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 14 is implemented.

17. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method of any one of claims 1 to 14 is executed.