Database query method and device

By receiving and compiling database query statements under different operating systems, obtaining and displaying database record data, the convenience of database query under multiple systems is solved, and the database query method supported by multiple systems is realized, which improves the efficiency and convenience of database management. sex.

CN114254006BActive Publication Date: 2024-12-20CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111572871.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-21
Publication Date
2024-12-20
Estimated Expiration
2041-12-21

AI Technical Summary

Technical Problem

The lack of database query methods suitable for multiple systems in the prior art, resulting in cumbersome and inconvenient database query operations under different operating systems.

Method used

By receiving database query statements input by users, we obtain system information of the current operating system, compile and execute query statements, obtain record data from the target table, and convert the data into preset types and formats, display the specified number of record data, and support Database query operations under multiple systems.

Benefits of technology

It realizes unified support for database queries under different operating systems, simplifies database query operations, provides flexible data display and statistical information display, and improves the convenience of database management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114254006B_ABST
    Figure CN114254006B_ABST
Patent Text Reader

Abstract

The present invention discloses a database query method and device, and relates to the field of big data access technology. A specific implementation of the method includes: receiving a database query statement input by a user, the database query statement corresponds to a target table; obtaining system information of the current operating system; compiling and executing the database query statement according to the system information to obtain target record data from the target table; converting the value of the target field in the target record data to a preset type; determining a preset number of current record data from the target record data after the type conversion; and displaying the preset number of current record data in a preset display format. This implementation can be applicable to database queries of multiple systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data access technology, and in particular to a database query method and device. Background Art

[0002] With the rapid development of computer technology, database query operations are being used more and more frequently in various applications. Technical developers often need to access the database when developing tests and checking production data. Accessing database objects is a tedious and time-consuming task, and daily management of the database also requires access to the database. The method of querying the database through tools such as toad for series software, DBTOOLS, SQLDBX, etc. is only applicable under Windows systems. In operating systems such as Unix, Linux, CentOS, etc., the database can usually only be queried through command line interaction. In the prior art, there is still a lack of database query methods that can be applied to multiple systems. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a database query method and device, which can be applicable to database query of multiple systems.

[0004] In a first aspect, an embodiment of the present invention provides a database query method, comprising:

[0005] Receiving a database query statement input by a user, wherein the database query statement corresponds to a target table;

[0006] Get the system information of the current operating system;

[0007] Compile and execute the database query statement according to the system information to obtain target record data from the target table;

[0008] Converting the value of the target field in the target record data into a preset type;

[0009] Determining a preset number of current record data from the target record data after the type conversion;

[0010] The preset number of current record data are displayed in a preset display format.

[0011] Optionally, after displaying the preset number of current record data in a preset display format, the method further includes:

[0012] receiving a display instruction for the target recorded data;

[0013] In response to the display request, determining subsequent record data of the current record data from the target record data after the type conversion, the number of the subsequent record data being the preset number;

[0014] The subsequent recorded data is displayed in the preset display format.

[0015] Optionally, after executing the database query statement, the method further includes:

[0016] Obtaining the execution time of the database query statement and the record statistics information of the target record data;

[0017] The execution time and the recorded statistics are displayed.

[0018] Optionally, after executing the database query statement, the method further includes:

[0019] receiving a save instruction for the target record data, wherein the save instruction includes save path information;

[0020] In response to the saving instruction, a text file for the target record data is generated, and the text file is saved in a path corresponding to the saving path information.

[0021] Optionally, after receiving the database query statement input by the user, the method further includes:

[0022] Receive database operation instructions input by users;

[0023] Determining database permissions of the user;

[0024] Determining whether the user has the authority to execute the database operation instruction according to the database authority;

[0025] If the user has the authority to execute the database operation instruction, execute the database operation instruction and return the execution result corresponding to the database operation instruction to the user;

[0026] In the case that the user does not have the authority to execute the database operation instruction, a prompt message indicating execution failure is sent to the user.

[0027] Optionally, after receiving the database query statement input by the user, the method further includes:

[0028] Obtain and display resource usage of database objects, wherein the database objects include at least one of the following: database query statements, database operation statements, database-related programs, and database indexes.

[0029] Optionally, after receiving the database query statement input by the user, the method further includes:

[0030] Receive statement viewing instructions sent by users;

[0031] Obtain and display multiple historical database operation statements;

[0032] receiving a selected instruction for the historical database operation statement;

[0033] Selecting a target database operation statement corresponding to the selected instruction from the plurality of historical database operation statements;

[0034] Select an instruction according to the statement to display and / or execute the target database operation statement.

[0035] Optionally, the receiving a database query statement input by a user includes:

[0036] receiving a database query instruction input by a user, wherein the database query instruction corresponds to at least one target field in the target table;

[0037] The database query statement is generated according to the target table and the at least one target field.

[0038] In a second aspect, an embodiment of the present invention provides a database query device, including:

[0039] A statement receiving module, used for receiving a database query statement input by a user, wherein the database query statement corresponds to a target table;

[0040] An execution module, used to obtain system information of the current operating system;

[0041] Compile and execute the database query statement according to the system information to obtain target record data from the target table;

[0042] A conversion module, used to convert the value of the target field in the target record data into a preset type;

[0043] A data determination module, used to determine a preset number of current record data from the target record data after the type conversion;

[0044] The display module is used to display the preset number of current record data in a preset display format.

[0045] Optionally, the display module is further used for:

[0046] receiving a display instruction for the target recorded data;

[0047] In response to the display request, determining subsequent record data of the current record data from the target record data after the type conversion, the number of the subsequent record data being the preset number;

[0048] The subsequent recorded data is displayed in the preset display format.

[0049] Optionally, the display module is further used for:

[0050] Obtaining the execution time of the database query statement and the record statistics information of the target record data;

[0051] The execution time and the recorded statistics are displayed.

[0052] Optionally, the display module is further used for:

[0053] Obtaining the execution time of the database query statement and the record statistics information of the target record data;

[0054] The execution time and the recorded statistics are displayed.

[0055] In a third aspect, an embodiment of the present invention provides an electronic device, including:

[0056] one or more processors;

[0057] a storage device for storing one or more programs,

[0058] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.

[0059] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the method described in any of the above embodiments.

[0060] In a fifth aspect, an embodiment of the present invention provides a computer program product, including a computer program, which implements the method described in any of the above embodiments when executed by a processor.

[0061] An embodiment of the above invention has the following advantages or beneficial effects: receiving a database query statement input by a user, compiling and executing the query statement through the system information of the current operating system, so that the method of the embodiment of the present invention can run in different systems and realize the function of multi-system support.

[0062] In addition, the database query statement entered by the user is executed to obtain the target record data from the target table. The preset type is the display type of the target field in the target record data, the preset number is the display number of the target record data, and the preset display format is used to control the display form of the target record data. The preset type, preset number and preset display format can be set according to specific needs, so as to flexibly display the query results of the database and facilitate the use of the database.

[0063] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0065] Figure 1 It is a flowchart of a database query method provided by the first embodiment of the present invention;

[0066] Figure 2 is a flowchart of a database operation method provided by the second embodiment of the present invention;

[0067] Figure 3 is a flowchart of a database operation method provided by the third embodiment of the present invention;

[0068] Figure 4 is a schematic diagram of the structure of a database query device provided by an embodiment of the present invention;

[0069] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0070] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0071] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0072] The embodiment of the present invention provides a database query method, which can bring convenience to technical developers. Figure 1 is a flowchart of a database query method provided by the first embodiment of the present invention, such as Figure 1 As shown, the method includes:

[0073] Step 101: receiving a database query statement input by a user, where the database query statement corresponds to a target table.

[0074] The method of the embodiment of the present invention can be applied to various types of databases, such as Oracle, Mysql, SqlServer or NoSQL, etc. The database query statement is used to query the relevant data records corresponding to the database query statement from the target table.

[0075] In one embodiment of the present invention, receiving a database query statement input by a user includes: receiving a database query instruction input by the user, the database query instruction corresponding to at least one target field in a target table; generating a database query statement according to the target table and the at least one target field.

[0076] Multiple tables and multiple fields in the database can be displayed visually on the interface. Users can select a target table from multiple tables and select a target field from multiple fields in the target table. The system automatically generates data query statements based on the target table and target field. In addition, users can also enter filtering conditions based on the target field, such as field 1 = "male", field 2 = "abc", etc. The system automatically generates data query statements based on the target table, target field and filtering conditions.

[0077] Step 102: Obtain system information of the current operating system; compile and execute a database query statement based on the system information to obtain target record data from a target table.

[0078] Current operating systems may include: linux, unix, ubuntu, centos, windows, etc. The underlying language of the solution of the embodiment of the present invention may be C language, which can be recompiled under multiple systems to support the use of different systems. The above method can realize the operation of the solution of the embodiment of the present invention under multiple systems.

[0079] Execute the database query statement in the target database to obtain the target record data corresponding to the database query statement from the target table in the target database. There may be one or more target record data. There may also be no target record data corresponding to the database query statement, and a prompt message indicating that there is no query result is returned to the user.

[0080] Step 103: Convert the value of the target field in the target record data into a preset type.

[0081] The preset type is the display type of the target field in the target record data. Users can set the preset type of each target field as needed. For example, if the target field is a numeric type, the preset type can be set to a character type or a date type. If the target field is a Boolean type, the preset type can be set to a numeric type or a character type. By converting the value of the target field to the preset type, the target record data can be displayed more flexibly according to the user's intention.

[0082] Step 104: Determine a preset number of current record data from the target record data after the type conversion.

[0083] The preset number is the display number of the target record data. The user can set the preset number as needed. The preset number can be 5, 10, 20, etc. The current record data is the target record data that needs to be displayed currently.

[0084] After displaying a preset number of current record data in a preset display format, it also includes: receiving a display instruction for target record data; in response to the display request, determining subsequent record data of the current record data from the target record data after the conversion type, the number of subsequent record data is a preset number; and displaying the subsequent record data in a preset display format.

[0085] For example, there are 56 target record data in total, and the preset number is 10. Then the 56 target record data can be divided into 6 groups, namely: the 1st to 10th target record data, the 11th to 20th target record data... the 51st to 56th data. And the first group of target record data is used as the current record data, and the current record data is displayed on the interface. After receiving the display instruction, the second group of target record data is used as the current record data, and the current record data is displayed on the interface. And so on, until all target record data are displayed.

[0086] The display command can be input in a variety of ways, for example, by pressing Enter, clicking the left mouse button, clicking a designated key such as F1, F2, etc., or directly clicking a display button in the display interface.

[0087] Step 105: Display a preset number of current record data in a preset display format.

[0088] The preset display format is used to control the display form of the target record data. The user can set the display format as needed. The display format may include: the font, font size, size of each target field, the alignment of each target field, the number of bytes occupied by each target field, etc.

[0089] In the process of developing database applications, accessing database objects and writing SQL programs is a tedious and time-consuming task. Daily management of the database also requires many SQL scripts. After executing the database's own tool mysql or sqlplus on the command line to connect to the database, it is often difficult to match fields and query results one by one, and historical SQL statements cannot be traced back, which brings great trouble and inconvenience to technical developers.

[0090] In an embodiment of the present invention, a database query statement input by a user is executed to obtain target record data from a target table. The preset type is the display type of the target field in the target record data, the preset number is the display number of the target record data, and the preset display format is used to control the display format of the target record data. The preset type, preset number and preset display format can be set according to specific needs, so as to flexibly display the query results of the database and provide convenience for the application of the database. Specifically, by referencing the header file of the database, executing the instruction to obtain the field name of the target table, converting the data type of each field of the query result, and finally outputting the field name and the corresponding value. In addition, a counter is used to limit the output of only a preset number of target record data per page, and a carriage return is pressed to change the page.

[0091] In addition, by receiving a database query statement input by a user, and compiling and executing the query statement through the system information of the current operating system, the method of the embodiment of the present invention can be run in different systems and realize the function of multi-system support.

[0092] In addition, after entering the database query statement, each record on the output page can display the target field name and the corresponding value; the number of queries each time is controlled within the preset number, and each display instruction entered can display a preset number of more items to avoid constant screen refresh due to too many query results.

[0093] In one embodiment of the present invention, after executing a database query statement, the method further includes: obtaining the execution time of executing the database query statement and the record statistics of the target record data; and displaying the execution time and the record statistics. The record statistics are the relevant statistics of the target record data. The record statistics may include the total number of target record data, the occupied space, the storage information, etc. The execution time and the record statistics are displayed after each query, which is convenient for developers to evaluate the performance of the query statement.

[0094] In one embodiment of the present invention, after executing the database query statement, it also includes: receiving a save instruction for the target record data, the save instruction including save path information; in response to the save instruction, generating a text file for the target record data, and saving the text file in a path corresponding to the save path information.

[0095] Specifically, when it is monitored that the sentence input by the user contains keywords such as "save" at the beginning, the export function will be entered, and the header file of the database will be referenced to convert the data type of each field of the query result, and then all the query results will be written into the file specified by the user, and the separator can be set according to the requirements. The method of the embodiment of the present invention can export the query results into a text file, save it locally, and support the customization of the file separator.

[0096] In one embodiment of the present invention, after receiving the database query statement input by the user, it also includes: obtaining and displaying the resource usage of the database object, the database object includes at least one of the following: database query statement, database operation statement, database related program and database index.

[0097] The system can encapsulate a collection of SQL statements sorted by resource usage, and can list in descending order the SQL statements that occupy the most resources in the current database, making it easier for developers to tune SQL execution performance; it supports execution plans and analysis of various index performance.

[0098] The method of the embodiment of the present invention can help relevant personnel analyze database performance. If an execution plan is detected, such as the keyword explain for, the execution plan of the statement following the keyword will be output. If a tablespace is detected, such as the keyword showtablespace, the space usage of the current database will be output. If a lock is detected, such as the keyword lock, the SQL statement currently in deadlock will be output.

[0099] Figure 2 FIG. 1 is a flow chart of a database operation method provided by the second embodiment of the present invention. Figure 2 As shown, the method includes:

[0100] Step 201: receiving a database operation instruction input by a user.

[0101] Database operation instructions are instructions for operating database objects. Database objects may include: databases, tables, fields, indexes, table spaces, etc. Database operation instructions may include: instructions for creating and deleting tables, instructions for adding, deleting, modifying, and checking data records, instructions for creating and deleting indexes, etc.

[0102] Step 202: Determine the user's database authority.

[0103] Database permissions are used to limit the permissions for database operations that users can perform. Database permissions include: login permissions, superuser permissions, create database permissions, create role permissions, etc.

[0104] Step 203: Determine whether the user has the authority to execute the database operation instruction based on the database authority.

[0105] Step 204: If the user has the authority to execute the database operation instruction, the database operation instruction is executed, and the execution result corresponding to the database operation instruction is returned to the user.

[0106] Step 205: When the user does not have the authority to execute the database operation instruction, a prompt message indicating that the execution failed is sent to the user.

[0107] Before step 201, the method may further include the step of assigning different database permissions to different users. A database permission assignment instruction is received, the database permission assignment instruction comes from a user with database management permission or super user permission, and the database permission assignment instruction includes: target database permission and assigned user; and the database permission of the assigned user is determined as the target database permission.

[0108] The scheme of the embodiment of the present invention provides a permission control function. If this function is enabled, when it is monitored that the statement input by the user contains keywords such as update, delete, and insert, the execution will be automatically refused, and the user will be prompted that it cannot be executed due to permission issues. It also supports shielding some permissions. For example, in a production environment, statements such as modification, insertion, and DDL can be shielded, so that the user only has query permission but no modification permission. In order to ensure the safe operation of the database, different permissions are assigned to different users, and after receiving the database operation instruction, it is checked whether the user who issued the database operation instruction has the permission required by the database operation instruction, so as to ensure the safety of the production environment and the database.

[0109] Figure 3 FIG. 1 is a flow chart of a database operation method provided by the third embodiment of the present invention. Figure 3 As shown, the method includes:

[0110] Step 301: Receive a statement viewing instruction sent by a user.

[0111] The statement viewing instruction is used to view the historical database operation statements of the database. The conditional fields in the statement viewing instruction can be set according to specific needs. For example, the statement viewing instruction can include: target table, and the statement viewing instruction is used to view the historical database operation instructions of the target table. The statement viewing instruction can include: start time and end time, and the statement viewing instruction is used to view the historical database operation instructions of the database from the start time to the end time.

[0112] Step 302: Acquire and display multiple historical database operation statements.

[0113] Step 303: Receive a selected instruction for a historical database operation statement.

[0114] The selection command is used to select the target database operation statement from the historical database operation statements. The selection command can be input by pressing Enter, clicking the left mouse button, clicking a specified case, or directly clicking a database operation statement in the display interface.

[0115] Step 304: Select a target database operation statement corresponding to the selected instruction from the multiple historical database operation statements.

[0116] Step 305: Select an instruction according to the statement, and display and / or execute the target database operation statement.

[0117] The method of the embodiment of the present invention can display all currently executed database operation statements, which is convenient for developers to quickly edit and test using historical database operation statements. Specifically, an array can be used to save the SQL statements executed by the user in the historical period, and then monitor the selected instructions input by the user. The user can enter the selected instructions in a variety of ways, such as mouse clicks, specified keys, etc. For example, when receiving the user's input, if it is the letter l, the previous SQL statement is displayed, if it is the letter ll, all SQL statements currently executed by the user are displayed, and if it is the symbol / , the previous SQL statement is re-executed.

[0118] The solution of the embodiment of the present invention is aimed at command line operation database, and provides functions such as formatted output, data export, permission control, history backtracking, performance analysis, etc., which can help developers to easily, concisely and quickly develop and manage database changes, and promote the realization of a higher level of code quality, performance and maintainability.

[0119] Figure 4 is a schematic diagram of the structure of a database query device provided by an embodiment of the present invention. Figure 4 As shown, the device comprises:

[0120] A statement receiving module 401 is used to receive a database query statement input by a user, wherein the database query statement corresponds to a target table;

[0121] The execution module 402 is used to obtain the system information of the current operating system; compile and execute the database query statement according to the system information to obtain the target record data from the target table;

[0122] A conversion module 403, used to convert the value of the target field in the target record data into a preset type;

[0123] The data determination module 404 is used to determine a preset number of current record data from the target record data after the type conversion;

[0124] The display module 405 is used to display the preset number of current record data in a preset display format.

[0125] Optionally, the display module 405 is further used for:

[0126] receiving a display instruction for the target recorded data;

[0127] In response to the display request, determining subsequent record data of the current record data from the target record data after the type conversion, the number of the subsequent record data being the preset number;

[0128] The subsequent recorded data is displayed in the preset display format.

[0129] Optionally, the display module 405 is further used for:

[0130] Obtaining the execution time of the database query statement and the record statistics information of the target record data;

[0131] The execution time and the recorded statistics are displayed.

[0132] Optionally, the device further comprises:

[0133] A saving module, used for receiving a saving instruction for the target record data, wherein the saving instruction includes saving path information;

[0134] In response to the saving instruction, a text file for the target record data is generated, and the text file is saved in a path corresponding to the saving path information.

[0135] Optionally, the device further comprises:

[0136] A rights judgment module is used to receive database operation instructions input by users;

[0137] Determining database permissions of the user;

[0138] Determining whether the user has the authority to execute the database operation instruction according to the database authority;

[0139] If the user has the authority to execute the database operation instruction, execute the database operation instruction and return the execution result corresponding to the database operation instruction to the user;

[0140] In the case that the user does not have the authority to execute the database operation instruction, a prompt message indicating execution failure is sent to the user.

[0141] Optionally, the display module 405 is further used for:

[0142] Obtain and display resource usage of database objects, wherein the database objects include at least one of the following: database query statements, database operation statements, database-related programs, and database indexes.

[0143] Optionally, the device further comprises:

[0144] An operation module, used for receiving a statement viewing instruction sent by a user;

[0145] Obtain and display multiple historical database operation statements;

[0146] receiving a selected instruction for the historical database operation statement;

[0147] Selecting a target database operation statement corresponding to the selected instruction from the plurality of historical database operation statements;

[0148] Select an instruction according to the statement to display and / or execute the target database operation statement.

[0149] Optionally, the statement receiving module 401 is specifically used for:

[0150] receiving a database query instruction input by a user, wherein the database query instruction corresponds to at least one target field in the target table;

[0151] The database query statement is generated according to the target table and the at least one target field.

[0152] An embodiment of the present invention provides an electronic device, including:

[0153] one or more processors;

[0154] a storage device for storing one or more programs,

[0155] When one or more programs are executed by one or more processors, the one or more processors implement the method of any of the above embodiments.

[0156] An embodiment of the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, the database query method in the embodiment of the present invention is implemented.

[0157] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0158] like Figure 5As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0159] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0160] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0161] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0162] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0163] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be arranged in a processor, for example, they may be described as: a statement receiving module, an execution module, a conversion module, a data determination module, and a display module. The names of these modules do not constitute a limitation on the modules themselves in certain circumstances. For example, the statement receiving module may also be described as "a module for receiving a database query statement input by a user, wherein the database query statement corresponds to a target table".

[0164] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0165] Receiving a database query statement input by a user, wherein the database query statement corresponds to a target table;

[0166] Get the system information of the current operating system;

[0167] Compile and execute the database query statement according to the system information to obtain target record data from the target table;

[0168] Converting the value of the target field in the target record data into a preset type;

[0169] Determining a preset number of current record data from the target record data after the type conversion;

[0170] The preset number of current record data are displayed in a preset display format.

[0171] According to the technical solution of the embodiment of the present invention, a database query statement input by a user is received, and the query statement is compiled and executed through the system information of the current operating system, so that the method of the embodiment of the present invention can run in different systems and realize the function of multi-system support.

[0172] In addition, the database query statement entered by the user is executed to obtain the target record data from the target table. The preset type is the display type of the target field in the target record data, the preset number is the display number of the target record data, and the preset display format is used to control the display format of the target record data. The preset type, preset number and preset display format can be set according to specific needs, so as to flexibly display the query results of the database and provide convenience for the application of the database.

[0173] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A database query method, characterized in that: include: Receiving a database query statement input by a user, wherein the database query statement corresponds to a target table; Get the system information of the current operating system; Compile and execute the database query statement according to the system information to obtain target record data from the target table; Converting the value of the target field in the target record data into a preset type; Determining a preset number of current record data from the target record data after the type conversion; The preset number of current record data are displayed in a preset display format.

2. The method according to claim 1, characterized in that After displaying the preset number of current record data in a preset display format, the method further includes: receiving a display instruction for the target recorded data; In response to the display instruction, determining subsequent record data of the current record data from the target record data after the type conversion, the number of the subsequent record data being the preset number; The subsequent recorded data is displayed in the preset display format.

3. The method according to claim 1, characterized in that After executing the database query statement, the method further includes: Obtaining the execution time of the database query statement and the record statistics information of the target record data; The execution time and the recorded statistics are displayed.

4. The method according to claim 1, characterized in that: After executing the database query statement, the method further includes: receiving a save instruction for the target record data, wherein the save instruction includes save path information; In response to the saving instruction, a text file for the target record data is generated, and the text file is saved in a path corresponding to the saving path information.

5. The method according to claim 1, characterized in that After receiving the database query statement input by the user, the method further includes: Receive database operation instructions input by users; Determining database permissions of the user; Determining whether the user has the authority to execute the database operation instruction according to the database authority; If the user has the authority to execute the database operation instruction, execute the database operation instruction and return the execution result corresponding to the database operation instruction to the user; In the case that the user does not have the authority to execute the database operation instruction, a prompt message indicating execution failure is sent to the user.

6. The method according to claim 1, characterized in that After receiving the database query statement input by the user, the method further includes: Obtain and display resource usage of database objects, wherein the database objects include at least one of the following: database query statements, database operation statements, database-related programs, and database indexes.

7. The method according to claim 1, characterized in that After receiving the database query statement input by the user, the method further includes: Receive statement viewing instructions sent by users; Obtain and display multiple historical database operation statements; receiving a selected instruction for the historical database operation statement; Selecting a target database operation statement corresponding to the selected instruction from the plurality of historical database operation statements; Select an instruction according to the statement to display and / or execute the target database operation statement.

8. The method according to claim 1, characterized in that The receiving of a database query statement input by a user comprises: receiving a database query instruction input by a user, wherein the database query instruction corresponds to at least one target field in the target table; The database query statement is generated according to the target table and the at least one target field.

9. A database query device, characterized in that: include: A statement receiving module, used for receiving a database query statement input by a user, wherein the database query statement corresponds to a target table; An execution module, used to obtain system information of the current operating system; Compile and execute the database query statement according to the system information to obtain target record data from the target table; A conversion module, used to convert the value of the target field in the target record data into a preset type; A data determination module, used to determine a preset number of current record data from the target record data after the type conversion; The display module is used to display the preset number of current record data in a preset display format.

10. The device according to claim 9, characterized in that The display module is also used for: receiving a display instruction for the target recorded data; In response to the display instruction, determining subsequent record data of the current record data from the target record data after the type conversion, the number of the subsequent record data being the preset number; The subsequent recorded data is displayed in the preset display format.

11. The device according to claim 9, characterized in that The display module is also used for: Obtaining the execution time of the database query statement and the record statistics information of the target record data; The execution time and the recorded statistics are displayed.

12. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.

13. A computer readable medium having a computer program stored thereon, characterized in that When the program is executed by a processor, the method described in any one of claims 1 to 8 is implemented.

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