CN112732747A - Method, system, device and medium for quickly executing SQL on target computer - Google Patents

Method, system, device and medium for quickly executing SQL on target computer Download PDF

Info

Publication number
CN112732747A
CN112732747A CN202110337421.3A CN202110337421A CN112732747A CN 112732747 A CN112732747 A CN 112732747A CN 202110337421 A CN202110337421 A CN 202110337421A CN 112732747 A CN112732747 A CN 112732747A
Authority
CN
China
Prior art keywords
sql
execution
target computer
result
database
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110337421.3A
Other languages
Chinese (zh)
Inventor
苏文
朱聪
周举
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiajia Technology Co ltd
Original Assignee
Jiajia Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiajia Technology Co ltd filed Critical Jiajia Technology Co ltd
Priority to CN202110337421.3A priority Critical patent/CN112732747A/en
Publication of CN112732747A publication Critical patent/CN112732747A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method, a system, equipment and a medium for quickly executing SQL on a target computer. A method for quickly executing SQL on a target computer, comprising: distributing the SQL execution tool to a target computer to enable the SQL execution tool to be in direct communication with a target database; the SQL execution tool is operated in a command mode and transmits parameters, and the SQL execution tool acquires the parameters and outputs an execution result; acquiring an execution result output by an SQL execution tool; and processing the result through a JSON analysis module of the programming language used by the application program, and outputting the result to the page. A rapid execution SQL system on a target computer, comprising: a distribution communication module; an execution output module; a result obtaining module; and a data processing module. The invention further provides the SQL device and the computer readable storage medium which are quickly executed on the target computer.

Description

Method, system, device and medium for quickly executing SQL on target computer
Technical Field
The present invention relates to the field of information technology, and in particular, to a method, system, device, and medium for quickly executing SQL on a target computer.
Background
SQL (structured Query language) is a common language for operating relational database systems. Most application programs need to store and manage data through a database system, and therefore, the execution of SQL is the basic capability that most applications must have. Currently, a common SQL execution method is to directly connect a database through a database connection driver or a database connection module of each programming language or a database client. In some cases, due to the complexity of the network environment, database clients and the like that are not installed on the computer on which the database resides cannot be directly connected to the database by remote means. In addition, accessing the database by way of a database connection driver, a database client, etc. requires installation and configuration in advance, which is inconvenient in management.
The problems of the prior art are summarized as follows:
1. the current common SQL execution mode cannot meet the requirement of SQL execution by being connected to a target database under complex network environments such as network isolation and the like.
2. The access to the database through the database connection driver, the database client and the like requires the installation and configuration in advance, and the management is complex.
3. The output result formats of different SQL execution modes at present have differences, which are not beneficial to subsequent result processing.
Therefore, in order to improve the convenience of executing SQL and meet the requirements of SQL execution in a complex network environment, a method for quickly executing SQL on a target computer needs to be designed, and the method needs to have the characteristics of convenience, easy management, easy processing of output results and the like.
Disclosure of Invention
Based on this, the present invention aims to provide a method, a system, a device and a medium for quickly executing SQL on a target computer, which are convenient and easy to manage, and output results are easy to process.
In a first aspect, the present invention provides a method for quickly executing SQL on a target computer, comprising:
distributing the SQL execution tool to a target computer to enable the SQL execution tool to be in direct communication with a target database;
the SQL execution tool is operated in a command mode and transmits parameters, and the SQL execution tool acquires the parameters and outputs an execution result;
acquiring an execution result output by an SQL execution tool;
and processing the result through a JSON analysis module of the programming language used by the application program, and outputting the result to the page.
In one embodiment, the distributing the SQL execution tool to the target computer includes: distributing the compiled database SQL execution tool to a fixed directory of a target computer;
the enabling the SQL execution tool to communicate directly with the target database includes: a database connection module using the programming language used by the application acts as a means to connect the SQL execution tool to communicate directly with the target database.
In an embodiment of the foregoing technical solution, the running an SQL execution tool in a command mode includes: and operating the SQL execution tool in an operating system command mode.
In one embodiment, the entering of the parameter includes: one or more of database IP, port, account number, password, database and execution SQL are taken as parameters.
In an embodiment of the foregoing technical solution, the acquiring parameters and outputting execution results by the SQL execution tool includes: the SQL execution tool reads the parameters, the target database and the SQL script information in sequence, converts the execution result returned by the target database into a JSON format character string and outputs the JSON format character string to the target computer operating system.
In a second aspect, the present invention provides a system for quickly executing SQL on a target computer, comprising:
the distribution communication module is configured for distributing the SQL execution tool to the target computer so that the SQL execution tool is directly communicated with the target database;
the execution output module is configured for operating the SQL execution tool in a command mode and transmitting the parameters, and the SQL execution tool acquires the parameters and outputs an execution result;
the result acquisition module is configured for acquiring an execution result output by the SQL execution tool;
and the data processing module is configured to process the result through a JSON analysis module of the programming language used by the application program and output the result to the page.
In a third aspect, the present invention further provides a device for quickly executing SQL on a target computer, including:
a memory for storing one or more programs;
a processor for executing the program stored in the memory to implement the SQL method on the target computer according to any one of the above.
In a fourth aspect, the present invention further provides a computer readable storage medium storing at least one program which, when executed by a processor, implements the SQL method for fast execution on a target computer according to any of the above.
Compared with the prior art, the method, the system, the equipment and the medium for quickly executing the SQL on the target computer have the advantages that:
1. the invention directly connects the target database to execute the SQL by the SQL execution tool on the target computer, thereby avoiding the condition that the database cannot be connected due to network isolation.
2. According to the invention, a database driver or a database client does not need to be installed and configured in advance, and the SQL execution tool is directly operated during operation, so that the management is convenient and fast.
3. The result output format of the invention is a general JSON (JavaScript Object Notification) format, which is convenient for the application program to carry out subsequent result processing.
For a better understanding and practice, the invention is described in detail below with reference to the accompanying drawings.
Drawings
FIG. 1 is an exemplary flow diagram of the present invention method for rapid execution of SQL on a target computer.
FIG. 2 is a connection block diagram of the present invention for fast execution of an SQL system on a target computer.
Detailed Description
The terms of orientation of up, down, left, right, front, back, top, bottom, and the like, referred to or may be referred to in this specification, are defined relative to their configuration, and are relative concepts. Therefore, it may be changed according to different positions and different use states. Therefore, these and other directional terms should not be construed as limiting terms.
The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The terminology used in the present disclosure is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. As used in this disclosure and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
The invention writes SQL execution tools based on the programming languages such as go language, can directly connect target databases (MySQL, Oracle) on target computers with different operating system types (Windows, Linux) to execute SQL, and can adapt to other operating system types and database types through adjusting codes.
In this embodiment, the implementation manner of the MySQL database based on the SQL executed in the go language in the Linux system is taken as an example, and so on may be performed for other types of databases in other types of operating systems.
Referring to fig. 1, fig. 1 is a block diagram illustrating an exemplary flow chart of a method for quickly executing SQL on a target computer according to the present invention.
In a first aspect, the present invention provides a method for quickly executing SQL on a target computer, comprising:
s1, distributing the SQL execution tool to a target computer to enable the SQL execution tool to be in direct communication with a target database.
Specifically, in the above S1, the distributing the SQL execution tool to the target computer includes: and distributing the written database SQL execution tool (mysql _ collect) to a fixed directory of a target computer, such as/usr/local/sqltool.
The enabling the SQL execution tool to communicate directly with the target database includes: a database connection module using the programming language used by the application acts as a means to connect the SQL execution tool to communicate directly with the target database.
For example, database/SQL and githu com/go-SQL-driver/mysql modules may be used as a means to connect SQL execution tools to communicate directly with the target database.
And S2, operating the SQL execution tool in a command mode, transmitting the parameters, and acquiring the parameters and outputting an execution result by the SQL execution tool.
In the above S2, the executing the SQL execution tool by the command mode includes: and operating the SQL execution tool in an operating system command mode. For example, by shell command execution of linux.
Further, the executing the SQL execution tool in an operating system command manner includes: the SQL execution tool is executed by sql.open () and db.query () methods of the database/SQL module.
In some embodiments, said entering parameters comprises: one or more of database IP, port, account number, password, database and execution SQL are taken as parameters.
Such as: /usr/local/sqltool/mysql _ collect 127.0.0.13306 root 1qaz @ WSX testdb "select from testdb.
In some embodiments, the SQL execution tool obtains parameters and outputs execution results, including: the SQL execution tool reads the parameters, the target database and the SQL script information in sequence, converts the execution result returned by the target database into a JSON (JavaScript Object Notification) format character string and outputs the character string to the operating system of the target computer.
Further, the SQL execution tool obtains parameters, including: go language programming is performed on the linux system, and incoming parameters are acquired through os.
The outputting the execution result comprises: converting the execution result into a JSON format character string through JSON.
And S3, acquiring an execution result output by the SQL execution tool.
Such as: { "0": { "id": 1), "name": ttt "}, {" id ": 10)," name ": k" }.
And S4, processing data according to actual needs.
It may specifically include: and processing the result through a JSON analysis module of the programming language used by the application program, and outputting the result to the page.
Referring to fig. 2, fig. 2 is a connection block diagram of the SQL system executed on the target computer according to the present invention.
In a second aspect, the present invention provides a system for quickly executing SQL on a target computer, comprising:
the distribution communication module is configured for distributing the SQL execution tool to the target computer so that the SQL execution tool is directly communicated with the target database;
the execution output module is configured for operating the SQL execution tool in a command mode and transmitting the parameters, and the SQL execution tool acquires the parameters and outputs an execution result;
the result acquisition module is configured for acquiring an execution result output by the SQL execution tool;
and the data processing module is configured to process the result through a JSON analysis module of the programming language used by the application program and output the result to the page.
In a third aspect, the present invention further provides a device for quickly executing SQL on a target computer, including:
a memory for storing one or more programs;
and the processor is used for operating the program stored in the memory so as to realize the SQL method quickly executed on the target computer.
The device may also preferably include a communication interface for communicating with external devices and for interactive transmission of data.
It should be noted that the memory may include a high-speed RAM memory, and may also include a nonvolatile memory (nonvolatile memory), such as at least one disk memory.
In a specific implementation, if the memory, the processor and the communication interface are integrated on a chip, the memory, the processor and the communication interface can complete mutual communication through the internal interface. If the memory, the processor and the communication interface are implemented independently, the memory, the processor and the communication interface may be connected to each other through a bus and perform communication with each other.
In a fourth aspect, the present invention further provides a computer-readable storage medium storing at least one program which, when executed by a processor, implements the SQL method as described above for fast execution on a target computer.
It should be appreciated that the computer-readable storage medium is any data storage device that can store data or programs which can thereafter be read by a computer system. Examples of the computer readable storage medium include read-only memory, random-access memory, CD-ROMs, HDDs, DVDs, magnetic tapes, optical data storage devices, and the like. The computer readable storage medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.
Program code embodied on a computer readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, Radio Frequency (RF), etc., or any suitable combination of the foregoing.
In some embodiments, the computer-readable storage medium may be non-transitory.
Compared with the prior art, the method, the system, the equipment and the medium for quickly executing the SQL on the target computer have the advantages that:
1. the invention directly connects the target database to execute the SQL by the SQL execution tool on the target computer, thereby avoiding the condition that the database cannot be connected due to network isolation.
2. According to the invention, a database driver or a database client does not need to be installed and configured in advance, and the SQL execution tool is directly operated during operation, so that the management is convenient and fast.
3. The result output format of the invention is a general JSON (JavaScript Object Notification) format, which is convenient for the application program to carry out subsequent result processing.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention.

Claims (8)

1. A method for quickly executing SQL on a target computer, comprising:
distributing the SQL execution tool to a target computer to enable the SQL execution tool to be in direct communication with a target database;
the SQL execution tool is operated in a command mode and transmits parameters, and the SQL execution tool acquires the parameters and outputs an execution result;
acquiring an execution result output by an SQL execution tool;
and processing the result through a JSON analysis module of the programming language used by the application program, and outputting the result to the page.
2. The method of rapidly executing SQL on a target computer according to claim 1, wherein the distributing SQL execution tools to the target computer comprises: distributing the compiled database SQL execution tool to a fixed directory of a target computer;
the enabling the SQL execution tool to communicate directly with the target database includes: a database connection module using the programming language used by the application acts as a means to connect the SQL execution tool to communicate directly with the target database.
3. The method of claim 2, wherein the executing the SQL execution tool by command comprises: and operating the SQL execution tool in an operating system command mode.
4. The method of claim 3, wherein said passing parameters in comprises: one or more of database IP, port, account number, password, database and execution SQL are taken as parameters.
5. The method of claim 4, wherein the SQL execution tool obtains parameters and outputs execution results, and comprises: the SQL execution tool reads the parameters, the target database and the SQL script information in sequence, converts the execution result returned by the target database into a JSON format character string and outputs the JSON format character string to the target computer operating system.
6. A system for fast execution of SQL on a target computer, comprising:
the distribution communication module is configured for distributing the SQL execution tool to the target computer so that the SQL execution tool is directly communicated with the target database;
the execution output module is configured for operating the SQL execution tool in a command mode and transmitting the parameters, and the SQL execution tool acquires the parameters and outputs an execution result;
the result acquisition module is configured for acquiring an execution result output by the SQL execution tool;
and the data processing module is configured to process the result through a JSON analysis module of the programming language used by the application program and output the result to the page.
7. A device for fast execution of SQL on a target computer, comprising:
a memory for storing one or more programs;
a processor for executing the program stored in the memory to implement the SQL method on the target computer according to any of claims 1-5.
8. A computer-readable storage medium storing at least one program which, when executed by a processor, implements the SQL method for fast execution on a target computer according to any of claims 1-5.
CN202110337421.3A 2021-03-30 2021-03-30 Method, system, device and medium for quickly executing SQL on target computer Pending CN112732747A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110337421.3A CN112732747A (en) 2021-03-30 2021-03-30 Method, system, device and medium for quickly executing SQL on target computer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110337421.3A CN112732747A (en) 2021-03-30 2021-03-30 Method, system, device and medium for quickly executing SQL on target computer

Publications (1)

Publication Number Publication Date
CN112732747A true CN112732747A (en) 2021-04-30

Family

ID=75597102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110337421.3A Pending CN112732747A (en) 2021-03-30 2021-03-30 Method, system, device and medium for quickly executing SQL on target computer

Country Status (1)

Country Link
CN (1) CN112732747A (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130238656A1 (en) * 2012-03-12 2013-09-12 Qiming Chen Page feed for efficient dataflow between distributed query engines
CN108664236A (en) * 2018-05-08 2018-10-16 山东浪潮通软信息科技有限公司 A kind of automatic conversion based on Excel executes the implementation method of parametrization SQL
CN110399125A (en) * 2019-07-25 2019-11-01 南京数睿数据科技有限公司 A kind of dynamic query method of the various dimensions many condition based on Java technology
US10579627B2 (en) * 2016-01-08 2020-03-03 Microsoft Technology Licensing, Llc Database operation using metadata of data sources
CN110908840A (en) * 2019-12-02 2020-03-24 杭州安恒信息技术股份有限公司 Method, device, equipment and storage medium for restoring bak backup files
CN111381860A (en) * 2020-04-02 2020-07-07 众能联合数字技术有限公司 Quick maintenance framework and method for database SQL script
CN111782993A (en) * 2019-07-23 2020-10-16 北京京东尚科信息技术有限公司 Page display method and device and server
CN112395307A (en) * 2019-08-16 2021-02-23 华为技术有限公司 Statement execution method, statement execution device, server and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130238656A1 (en) * 2012-03-12 2013-09-12 Qiming Chen Page feed for efficient dataflow between distributed query engines
US10579627B2 (en) * 2016-01-08 2020-03-03 Microsoft Technology Licensing, Llc Database operation using metadata of data sources
CN108664236A (en) * 2018-05-08 2018-10-16 山东浪潮通软信息科技有限公司 A kind of automatic conversion based on Excel executes the implementation method of parametrization SQL
CN111782993A (en) * 2019-07-23 2020-10-16 北京京东尚科信息技术有限公司 Page display method and device and server
CN110399125A (en) * 2019-07-25 2019-11-01 南京数睿数据科技有限公司 A kind of dynamic query method of the various dimensions many condition based on Java technology
CN112395307A (en) * 2019-08-16 2021-02-23 华为技术有限公司 Statement execution method, statement execution device, server and storage medium
CN110908840A (en) * 2019-12-02 2020-03-24 杭州安恒信息技术股份有限公司 Method, device, equipment and storage medium for restoring bak backup files
CN111381860A (en) * 2020-04-02 2020-07-07 众能联合数字技术有限公司 Quick maintenance framework and method for database SQL script

Similar Documents

Publication Publication Date Title
US11561972B2 (en) Query conversion for querying disparate data sources
CN111026931B (en) Data query method, device, equipment and medium
US20140237463A1 (en) Dynamically generate and execute a context-specific patch installation procedure on a computing system
CN111414643B (en) Data authority control method, device, server and storage medium
US20230185781A1 (en) System and method for data warehouse migration
CN111737564B (en) Information query method, device, equipment and medium
CN110704476A (en) Data processing method, device, equipment and storage medium
US20180307692A1 (en) Software application interface for mediating access to services of a centralized data store
CN113254519B (en) Access method, device, equipment and storage medium of multi-source heterogeneous database
CN111694866A (en) Data searching and storing method, data searching system, data searching device, data searching equipment and data searching medium
US20190327342A1 (en) Methods and electronic devices for data transmission and reception
CN113467972A (en) Communication interface construction method, communication interface construction device, computer equipment and storage medium
CN111159265A (en) ETL data migration method and system
EP2804361A1 (en) Integrated interface system for power-system monitoring and control system
CN107977344A (en) Date storage method, acquisition methods and server
CN117171108B (en) Virtual model mapping method and system
CN113760961B (en) Data query method and device
CN109669790A (en) Data sharing method, device, shared platform and storage medium based on cloud platform
CN112732747A (en) Method, system, device and medium for quickly executing SQL on target computer
CN113761016A (en) Data query method, device, equipment and storage medium
US9885787B2 (en) Electronic satellite feed switcher
CN111949648A (en) Memory cache data system and data indexing method
CN109241164A (en) A kind of data processing method, device, server and storage medium
CN115510023A (en) Greenplus database migration method and device
KR101632389B1 (en) IoT analyzing system using IoT virtual file structure

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20210430

RJ01 Rejection of invention patent application after publication