Method and apparatus for invoking structured query language statement, and computer device

By obtaining input variable parameters in database interactive applications, the problem of dynamic SQL statement invocation is solved, the flexibility and security of structured query statements are realized, and the database maintenance and debugging process is simplified.

CN117312367BActive Publication Date: 2026-02-10IND BANK CO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311392806.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-10-25
Publication Date
2026-02-10
Estimated Expiration
2043-10-25

AI Technical Summary

Technical Problem

Existing database client interaction tools only support the execution of static SQL statements and cannot call dynamic SQL statements, especially when table names, field names, and values ​​change dynamically.

Method used

By obtaining input variable parameters from the interactive application, replacing the dynamic structured query statement in the structured query statement file with key-value pairs, generating a temporary script file, determining the database password through operating system variables, and finally calling the dynamic structured query statement.

Benefits of technology

It supports calling dynamic structured query statements, increasing the flexibility and security of structured query statements, facilitating database maintenance and debugging, and preventing users from tampering with special characters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117312367B_ABST
    Figure CN117312367B_ABST
Patent Text Reader

Abstract

The application relates to a structured query statement calling method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: acquiring an input variable parameter in an interactive application; wherein the variable parameter comprises an absolute path of a structured query statement file and a key-value pair; in the case that the variable parameter meets the condition that a preset character is arranged between two adjacent key-value pairs, the input variable of a dynamic structured query statement in the structured query statement file is replaced by the key-value pair in sequence to obtain a temporary script file; and the script file is executed to call the dynamic structured query statement. The method can support the calling of a dynamic SQL statement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of big data technology, and in particular to a method, apparatus, computer device, storage medium and computer program product for invoking structured query statements. Background Technology

[0002] With the development of big data technology, database technology has emerged. Traditionally, database client tools are used to interact with the database, allowing users to perform database operations via command line or graphical interface. This also enables database management and maintenance, as well as data backup and recovery. However, current database client tools only support the execution of static SQL statements. In this case, the SQL statement must be written first, with all table names, field names, and values ​​defined and stored in an SQL file before the database client tool can execute it. However, in database automation scripts, some table names, field names, and values ​​need to change dynamically, and current technologies cannot support the invocation of dynamic SQL statements. Summary of the Invention

[0003] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for invoking structured query statements to address the aforementioned technical problems.

[0004] Firstly, this application provides a method for invoking a structured query statement. The method includes:

[0005] The variable parameters are obtained from the input in the interactive application; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file;

[0006] When the variable parameters satisfy the condition that a preset character is set between two adjacent key-value pairs, the input variables of the dynamic structured query statement in the structured query statement file are replaced sequentially using the key-value pairs to obtain a temporary script file;

[0007] Execute the script file to invoke the dynamic structured query statement.

[0008] In one embodiment, obtaining the input variable parameters in the interactive application includes:

[0009] In interactive applications, obtain the input variable parameters;

[0010] When the number of variable parameters is less than a preset threshold or the first variable parameter is a preset parameter, the parameter input rules corresponding to the variable parameter are displayed.

[0011] In one embodiment, when the variable parameters satisfy the condition that a preset character is set between two adjacent key-value pairs, the input variables of the dynamic structured query statement in the structured query statement file are sequentially replaced with the key-value pairs to obtain a temporary script file, including:

[0012] Based on the absolute path of the structured query statement file, query the corresponding structured query statement file;

[0013] If a corresponding structured query statement file exists, the key-value pairs are used to sequentially replace the input variables of the dynamic structured query statement in the structured query statement file, and a temporary script file is obtained.

[0014] In one embodiment, executing the script file to invoke the dynamic structured query statement includes:

[0015] The database account identifier and database identifier are determined based on the structured query statement in the script file;

[0016] The password for the database is determined using operating system variables;

[0017] The dynamic structured query statement is invoked based on the database account identifier, the database identifier, and the password.

[0018] In one embodiment, determining the database password via operating system variables includes:

[0019] The encrypted password for the corresponding database is determined through operating system variables; wherein, the encrypted password is encrypted and configured into the operating system variables when the database is created;

[0020] The password for the database is obtained by decrypting the encrypted password through an interactive application.

[0021] In one embodiment, executing the script file to invoke the dynamic structured query statement includes:

[0022] Obtain the script file;

[0023] Compile and execute the script file;

[0024] If the script file fails to execute, a replacement script file and a structured query statement will be generated.

[0025] If the script file executes successfully, the dynamic structured query statement is invoked and a log file is generated.

[0026] Secondly, this application also provides a device for invoking structured query statements. The device includes:

[0027] The acquisition module is used to acquire input variable parameters in the interactive application; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file;

[0028] The replacement module is used to replace the input variables of the dynamic structured query statement in the structured query statement file with the key-value pairs in turn when the variable parameters satisfy the condition that a preset character is set between two adjacent key-value pairs, so as to obtain a temporary script file.

[0029] The execution module is used to execute the script file to invoke the dynamic structured query statement.

[0030] In one embodiment, the acquisition module includes:

[0031] The `get` submodule is used to retrieve input variable parameters in interactive applications.

[0032] The rules submodule is used to display the parameter input rules corresponding to the variable parameters when the number of variable parameters is less than a preset threshold or when the first variable parameter is a preset parameter.

[0033] In one embodiment, the replacement module includes:

[0034] The query submodule is used to query the corresponding structured query statement file based on the absolute path of the structured query statement file.

[0035] The replacement submodule is used to replace the input variables of the dynamic structured query statement in the structured query statement file sequentially using the key-value pairs, when a corresponding structured query statement file exists, and to obtain a temporary script file.

[0036] In one embodiment, the execution module includes:

[0037] The determination submodule is used to determine the database account identifier and database identifier of the database based on the structured query statement in the script file;

[0038] The password submodule is used to determine the password for the database through operating system variables;

[0039] The submodule is invoked to call the dynamic structured query statement based on the database account identifier, database identifier, and password.

[0040] In one embodiment, the password submodule includes:

[0041] The acquisition unit is used to determine the encrypted password of the corresponding database through operating system variables; wherein, the encrypted password is encrypted and configured into the operating system variables when the database is created;

[0042] The decryption unit is used to decrypt the encrypted password through an interactive application to obtain the password for the database.

[0043] In one embodiment, the execution module includes:

[0044] The script submodule is used to obtain the script file;

[0045] An execution submodule is used to compile and execute the script file;

[0046] The failure submodule is used to generate a replacement script file and structured query statements when the script file fails to execute.

[0047] The success submodule is used to invoke the dynamic structured query statement and generate a log file when the script file executes successfully.

[0048] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method for invoking structured query statements as described in any of the embodiments of this disclosure.

[0049] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the method for invoking structured query statements as described in any one of the embodiments of this disclosure.

[0050] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the method for invoking structured query statements as described in any of the embodiments of this disclosure.

[0051] The aforementioned method, apparatus, computer device, storage medium, and computer program product for invoking structured query statements utilizes database interactive applications to obtain input variable parameters. By replacing the input variables of the dynamic structured query statement in the structured query statement file with key-value pairs from these parameters, a temporary script file is obtained, enabling the invocation of dynamic structured query statements. This allows database interactive applications to recognize dynamically changing parameter information during relevant program invocation, thereby supporting the invocation of dynamic structured query statements. It increases the flexibility of structured query statements, separates them from backend code, facilitating database maintenance and debugging. Furthermore, the parameter substitution method effectively prevents users from tampering with the structured query statements by inputting special characters, improving the security of invoking structured query statements. Attached Figure Description

[0052] Figure 1 This is a flowchart illustrating the method for invoking a structured query statement in one embodiment;

[0053] Figure 2 This is a flowchart illustrating the determination of variable parameters in one embodiment;

[0054] Figure 3 This is a schematic diagram of the process for generating a temporary script file in one embodiment;

[0055] Figure 4 This is a flowchart illustrating the process of invoking a dynamic structured query statement in one embodiment;

[0056] Figure 5 This is a schematic diagram of the database password acquisition process in one embodiment;

[0057] Figure 6 This is a schematic diagram illustrating the compilation and execution process of a script file in one embodiment;

[0058] Figure 7 This is a schematic diagram of the call flow of a structured query statement in one embodiment;

[0059] Figure 8 This is a structural block diagram of a device for invoking a structured query statement in one embodiment;

[0060] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0061] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0062] In one embodiment, such as Figure 1 As shown, a method for invoking a structured query statement is provided, including the following steps:

[0063] Step S100: Obtain the input variable parameters in the interactive application; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file;

[0064] Step S200: When the variable parameters satisfy the condition that a preset character is set between two adjacent key-value pairs, the input variables of the dynamic structured query statement in the structured query statement file are replaced sequentially with the key-value pairs to obtain a temporary script file.

[0065] Step S300: Execute the script file to call the dynamic structured query statement.

[0066] In one exemplary embodiment, the interactive application may include database client interaction tools, such as Oracle's SQL*Plus, Informix's Dbaccess, Teradata's BTEQ, GaussDB's Gsql, etc.

[0067] In one exemplary embodiment, the variable parameters may include the absolute path of the structured query statement file, the specific structured query statement in the called structured query statement file, key-value pairs, database account identifier, database identifier, and database password, etc.

[0068] In one exemplary embodiment, the absolute path of the structured query statement file may include the absolute path of the user. In another exemplary embodiment, the absolute path may include the filename of the structured query statement file, in which case the script file in the current directory will be executed by default.

[0069] In one exemplary embodiment, the key-value pair may include the name of the input variable to be replaced and the data to be replaced. For example, the key-value pair may include a database account identifier, a database identifier, a table header attribute in the database, a numerical value in the database, etc.

[0070] In one exemplary embodiment, if a preset character is set between two adjacent key-value pairs, the variable parameter may contain only one set of key-value pairs; in another exemplary embodiment, if no preset character is set between two adjacent key-value pairs or the key-value pairs are used incorrectly, the program will exit with an error and print the program usage method.

[0071] In one exemplary embodiment, the preset character may include a fixed character set between two key-value pairs, such as a space, comma, or pause mark.

[0072] In one exemplary embodiment, the dynamic structured query statement in the structured query statement file may include one structured query statement. In another exemplary embodiment, the dynamic structured query statement in the structured query statement file may include multiple structured query statements. When inputting variable parameters, it is necessary to input the absolute path of the structured query statement and the specific structured query statement in the structured query statement file to be called.

[0073] In one exemplary embodiment, the input variables may include the database account identifier, database identifier, database header attributes, and numerical values ​​in the database.

[0074] In one exemplary embodiment, the temporary script file may include a dynamic structured query statement extracted from a structured query statement file, and the structured query statement after key-value pair replacement.

[0075] In one exemplary embodiment, executing the script file includes compiling the script file into a machine language file that a computer can recognize, and running the machine language file to invoke the dynamic structured query statement.

[0076] The above method for invoking structured query statements utilizes the database's interactive application to obtain input variable parameters. Then, using the key-value pairs in these parameters, it replaces the input variables of the dynamic structured query statement in the structured query statement file, resulting in a temporary script file that can then be used to invoke the dynamic structured query statement. This allows the database's interactive application to recognize dynamically changing parameter information during relevant calls, thus supporting the invocation of dynamic structured query statements. It increases the flexibility of structured query statements, separates them from the backend code, making database maintenance and debugging easier. Furthermore, the parameter substitution method effectively prevents users from tampering with the structured query statement by inputting special characters, improving the security of invoking structured query statements.

[0077] In one embodiment, such as Figure 2 As shown, step S100 includes:

[0078] Step S101: In the interactive application, obtain the input variable parameters;

[0079] Step S102: When the number of variable parameters is less than a preset threshold or the first variable parameter is a preset parameter, display the parameter input rules corresponding to the variable parameter.

[0080] In one exemplary embodiment, the specific variable parameter information to be called can be entered through an input box in an interactive application. In another exemplary embodiment, the specific variable parameter can be selected in the interactive application and the structured query statement to be executed can be determined.

[0081] In one exemplary embodiment, when the input variable is "help", the parameter input rules are invoked to the user; in another exemplary embodiment, when the number of input variable parameters is less than 1, the user is alerted to the usage error and the parameter input rules are displayed to the user.

[0082] In this embodiment, by judging the number and type of input variable parameters, the parameter input rules corresponding to the variable parameters are displayed when the variable parameters are used incorrectly. This enables a clear understanding of the parameter input rules and reasonable invocation of structured query statements, as well as proper input of variable parameters, making the input variable parameters more standardized and facilitating the subsequent generation and execution of script files.

[0083] In one embodiment, such as Figure 3 As shown, step S200 includes:

[0084] Step S201: Query the corresponding structured query statement file according to the absolute path of the structured query statement file;

[0085] Step S202: If a corresponding structured query statement file exists, the input variables of the dynamic structured query statement in the structured query statement file are replaced sequentially using the key-value pairs to obtain a temporary script file.

[0086] In one exemplary embodiment, the absolute path of the structured query statement file may include the absolute path of the structured query statement file. In another exemplary embodiment, the absolute path of the structured query statement may include the filename of the structured query statement file, and the script in the current directory is executed by default.

[0087] In one exemplary embodiment, the step of sequentially replacing the input variables of the dynamic structured query statement in the structured query statement file using key-value pairs may include: inputting the table name to be operated on, the field attributes to be changed, etc., into the key-value pairs, and sequentially replacing the input variables of the dynamic structured query statement in the structured query statement file based on the information input into the key-value pairs. For example, the dynamic structured query statement may be "Insert: Table-Name-Score", and the key-value pairs may be "Table='Grade 5', Name='Xiaoming', Score='50'", then data with the table name "Grade 5", name "Xiaoming", and score "50" will be inserted.

[0088] In this embodiment, the corresponding structured query statement is queried through the absolute path of the structured query statement, and the input parameters of the structured query statement are replaced according to the key-value pairs to form a temporary script file. This can determine the dynamic structured query statement file that needs to be called, and accurately generate the corresponding script file after replacing the key-value pairs. This increases the accuracy and standardization of the structured query statement and provides convenience for the subsequent compilation and execution of the script file.

[0089] In one embodiment, such as Figure 4 As shown, step S300 includes:

[0090] Step S301: Determine the database account identifier and database identifier of the database according to the structured query statement in the script file;

[0091] Step S302: Determine the password for the database using operating system variables;

[0092] Step S303: Invoke the dynamic structured query statement based on the database account identifier, database identifier, and password.

[0093] In one exemplary embodiment, the account identifier and database identifier of the invoked database can be determined based on the structured query statement in the temporarily generated script file. In another exemplary embodiment, the account identifier and database identifier of the invoked database can be determined based on the input variable parameters. In yet another exemplary embodiment, the database account identifier and database identifier are configured in a script file located at the absolute path corresponding to the structured query statement file, and the database account identifier and database identifier can be modified by modifying the parameters in the script file.

[0094] In one exemplary embodiment, the operating system variables can be queried using the database account identifier and the database identifier to obtain the encrypted database password, and then the database password can be obtained by decryption.

[0095] In this embodiment, the database account identifier and database identifier are obtained by analyzing the script file, and the database password is determined by the operating system variables. Then, a dynamic structured query statement is called, which can determine the account, database and corresponding password of the database to be run, and thus accurately call the dynamic structured query statement, ensuring that the interactive platform calls the dynamic structured query statement.

[0096] In one embodiment, such as Figure 5 As shown, step S302 includes:

[0097] Step S321: Determine the encrypted password for the corresponding database through operating system variables; wherein, the encrypted password is encrypted and configured into the operating system variables when the database is created.

[0098] Step S322: Decrypt the encrypted password through an interactive application to obtain the password for the database.

[0099] In one exemplary embodiment, the system variable can be judged to query the encrypted password corresponding to the database account identifier and the database identifier, and the encrypted password can be decrypted according to the configuration file in the interactive tool to obtain the corresponding password.

[0100] In this embodiment, by encrypting the database password and configuring it into an operating system variable, and then decrypting it through the operating system variable to obtain the database password, the exposure of the database password can be avoided, thereby improving the security and stability of the system.

[0101] In one embodiment, such as Figure 6 As shown, step S300 includes:

[0102] Step S304: Obtain the script file;

[0103] Step S305: Compile and execute the script file;

[0104] Step S306: If the script file fails to execute, generate a replacement script file and a structured query statement.

[0105] Step S307: If the script file executes successfully, the dynamic structured query statement is invoked and a log file is generated.

[0106] In one exemplary embodiment, the script file can be compiled to generate a compiled machine language file, the machine language file can be executed, and based on the input variable parameters, it can be determined whether to save the replaced script file and the structured query statement.

[0107] In one exemplary embodiment, after the script file executes successfully, the dynamic structured query statement can be invoked and a log file can be generated. In another exemplary embodiment, after the script file executes successfully, the dynamic structured query statement is invoked and the corresponding log file is determined based on the input variable parameters.

[0108] In this embodiment, the script file is compiled and executed. If execution fails, a corresponding script file and structured query statement are generated; if execution succeeds, a log file is generated. This ensures that script file execution failures can accurately facilitate operational diagnosis and quickly identify the cause of errors. Successful script file execution allows for accurate querying of specific database operations through the log file, increasing database security and stability.

[0109] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0110] In one exemplary embodiment, the method for invoking the structured query statement can be as follows: Figure 7 The flowchart is as follows:

[0111] Obtain input variable parameters in interactive applications;

[0112] Check if the variable parameter is "help". If it is, call the "help" function and print the program's usage instructions; otherwise,

[0113] Check if the number of variable parameters is less than 1. If the number of variable parameters is less than 1, call the help function, print the program usage instructions, return error code 101, and append the error message to the log file; if the number of variable parameters is not less than 1, then...

[0114] The system checks whether the parameter format conforms to the parameter input rules. If the variable parameter input does not conform to the rules, it returns error code 102 and appends the error message to the log file; if the variable parameter input conforms to the rules, then...

[0115] Check if the SQL file mentioned in the variable parameters exists. If the SQL file does not exist, return error code 103 and append the error message to the log file; if the SQL file exists, then...

[0116] Replace the input variables in the SQL file to generate a temporary shell file;

[0117] Compile the temporary shell file. If an error occurs during compilation, return code 104 and append the error message to the log file; otherwise, if no errors occur during compilation...

[0118] Execute the temporarily generated shell file and SQL script, and check for errors during execution. If an error is found, return error code 105 and append the error information to the log file. If no error is found, the program terminates.

[0119] Based on the same inventive concept, this application also provides a structured query statement invocation apparatus for implementing the structured query statement invocation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more structured query statement invocation apparatus embodiments provided below can be found in the limitations of the structured query statement invocation method described above, and will not be repeated here.

[0120] In one embodiment, such as Figure 8 As shown, a structured query statement invocation device 10 is provided, including: an acquisition module 101, a replacement module 102, and an execution module 103, wherein:

[0121] The acquisition module is used to acquire input variable parameters in the interactive application; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file;

[0122] The replacement module is used to replace the input variables of the dynamic structured query statement in the structured query statement file with the key-value pairs in turn when the variable parameters satisfy the condition that a preset character is set between two adjacent key-value pairs, so as to obtain a temporary script file.

[0123] The execution module is used to execute the script file to invoke the dynamic structured query statement.

[0124] In one embodiment, a parameter input rule apparatus is provided, comprising: an acquisition submodule and a rule submodule, wherein:

[0125] The `get` submodule is used to retrieve input variable parameters in interactive applications.

[0126] The rules submodule is used to display the parameter input rules corresponding to the variable parameters when the number of variable parameters is less than a preset threshold or when the first variable parameter is a preset parameter.

[0127] In one embodiment, an apparatus for replacing input variables of a structured query statement is provided, comprising: a query submodule and a replacement submodule, wherein:

[0128] The query submodule is used to query the corresponding structured query statement file based on the absolute path of the structured query statement file.

[0129] The replacement submodule is used to replace the input variables of the dynamic structured query statement in the structured query statement file sequentially using the key-value pairs, when a corresponding structured query statement file exists, and to obtain a temporary script file.

[0130] In one embodiment, an apparatus for executing a temporary script is provided, comprising: a determination submodule, a password submodule, and a calling submodule, wherein:

[0131] The determination submodule is used to determine the database account identifier and database identifier of the database based on the structured query statement in the script file;

[0132] The password submodule is used to determine the password for the database through operating system variables;

[0133] The submodule is invoked to call the dynamic structured query statement based on the database account identifier, database identifier, and password.

[0134] In one embodiment, a decryption apparatus is provided, comprising: an acquisition unit and a decryption unit, wherein:

[0135] The acquisition unit is used to determine the encrypted password of the corresponding database through operating system variables; wherein, the encrypted password is encrypted and configured into the operating system variables when the database is created;

[0136] The decryption unit is used to decrypt the encrypted password through an interactive application to obtain the password for the database.

[0137] In one embodiment, a log file generation module is provided, including a script submodule, an execution submodule, a failure submodule, and a success submodule, wherein:

[0138] The script submodule is used to obtain the script file;

[0139] An execution submodule is used to compile and execute the script file;

[0140] The failure submodule is used to generate a replacement script file and structured query statements when the script file fails to execute.

[0141] The success submodule is used to invoke the dynamic structured query statement and generate a log file when the script file executes successfully.

[0142] The modules in the aforementioned structured query statement invocation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device in software form, so that the processor can invoke and execute the operations corresponding to each module.

[0143] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores structured query statement data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When executed by the processor, the computer program implements a method for invoking structured query statements.

[0144] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0145] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0146] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0147] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0148] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for invoking structured query statements, characterized in that, The method includes: In interactive applications, input variable parameters are obtained; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file; When the number of variable parameters is less than a preset threshold or the first variable parameter is a preset parameter, the parameter input rules corresponding to the variable parameter are displayed. Based on the absolute path of the structured query statement file, the corresponding structured query statement file is queried; if the corresponding structured query statement file exists, the input variables of the dynamic structured query statement in the structured query statement file are replaced sequentially using the key-value pairs to obtain a temporary script file; Execute the script file to invoke the dynamic structured query statement.

2. The method according to claim 1, characterized in that, Executing the script file to invoke the dynamic structured query statement includes: The database account identifier and database identifier are determined based on the structured query statement in the script file; The password for the database is determined using operating system variables; The dynamic structured query statement is invoked based on the database account identifier, the database identifier, and the password.

3. The method according to claim 2, characterized in that, The step of determining the database password through operating system variables includes: The encrypted password for the corresponding database is determined through operating system variables; wherein, the encrypted password is encrypted and configured into the operating system variables when the database is created; The password for the database is obtained by decrypting the encrypted password through an interactive application.

4. The method according to claim 1, characterized in that, Executing the script file to invoke the dynamic structured query statement includes: Obtain the script file; Compile and execute the script file; If the script file fails to execute, a replacement script file and a structured query statement will be generated. If the script file executes successfully, the dynamic structured query statement is invoked and a log file is generated.

5. A device for invoking a structured query statement, characterized in that, The device includes: The acquisition module is used to acquire input variable parameters in interactive applications; when the number of variable parameters is less than a preset threshold or the first variable parameter is a preset parameter, the module displays the parameter input rules corresponding to the variable parameters; wherein, the variable parameters include the absolute path and key-value pairs of the structured query statement file; The replacement module is used to query the corresponding structured query statement file based on the absolute path of the structured query statement file; if the corresponding structured query statement file exists, the input variables of the dynamic structured query statement in the structured query statement file are replaced sequentially using the key-value pairs to obtain a temporary script file. The execution module is used to execute the script file to invoke the dynamic structured query statement.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Structured query statement processing method and device and storage medium

    CN111414377A

  • Method and device for storing data by utilizing bitmap index and computer equipment

    CN116257524A