CN108694172B - Information output method and device - Google Patents
Information output method and device Download PDFInfo
- Publication number
- CN108694172B CN108694172B CN201710217133.8A CN201710217133A CN108694172B CN 108694172 B CN108694172 B CN 108694172B CN 201710217133 A CN201710217133 A CN 201710217133A CN 108694172 B CN108694172 B CN 108694172B
- Authority
- CN
- China
- Prior art keywords
- query language
- structured query
- character string
- language statement
- preset
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 48
- 230000004044 response Effects 0.000 claims abstract description 18
- 238000004590 computer program Methods 0.000 claims description 10
- 230000002085 persistent effect Effects 0.000 claims description 8
- 230000001788 irregular Effects 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 5
- 238000011161 development Methods 0.000 abstract description 6
- 238000012360 testing method Methods 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 6
- 238000013507 mapping Methods 0.000 description 5
- 230000008569 process Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 230000002688 persistence Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000008676 import Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000003780 insertion Methods 0.000 description 1
- 230000037431 insertion Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
Images
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application discloses an information output method and device. One embodiment of the method comprises: reading a target configuration file, wherein a structured query language statement is stored in the target configuration file; determining the operation corresponding to the structured query language statement; determining whether the structured query language statement is matched with a character string in a preset character string set associated with an operation, wherein the operation and the character string set are in one-to-one correspondence; and outputting information related to the structured query language sentence in response to determining that the structured query language sentence matches a character string in the preset character string set associated with the operation. The embodiment saves the test cost and the development cost.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to the field of information processing technologies, and in particular, to an information output method and apparatus.
Background
Currently, developers usually perform data persistence operations using a persistent framework, and all Structured Query Language (SQL) statements are written into a configuration file of the persistent framework. However, in the development process, the relation points of the developers on the performance of the structured query language are few, so that the performance of the edited structured query language is poor, and the performance index of the whole system is affected.
Disclosure of Invention
It is an object of the present application to provide an improved information output method and apparatus to solve the technical problems mentioned in the background section above.
In a first aspect, an embodiment of the present application provides an information output method, where the method includes: reading a target configuration file, wherein a structured query language statement is stored in the target configuration file; determining the operation corresponding to the structured query language statement; determining whether the structured query language statement is matched with a character string in a preset character string set associated with an operation, wherein the operation and the character string set are in one-to-one correspondence; and outputting information related to the structured query language sentence in response to determining that the structured query language sentence matches a character string in the preset character string set associated with the operation.
In some embodiments, the target configuration file is an extensible markup language file and is applied on a Java-based persistence tier framework; and determining an operation corresponding to the structured query language statement, including: reading a tag in an element in an extensible markup language file; and acquiring the operation corresponding to the label.
In some embodiments, determining whether the structured query language statement matches a string in a preset set of strings associated with the operation comprises: it is determined whether the content in the element matches a string in a preset set of strings associated with the operation.
In some embodiments, outputting information related to the structured query language statement comprises: and outputting information related to the structured query language sentence according to the output path information received in advance.
In some embodiments, in response to determining that the structured query language statement matches a string in the set of preset strings associated with the operation, outputting information related to the structured query language statement includes: in response to determining that the structured query language statement matches a string in a preset string set associated with the operation, further determining a number of strings that match the structured query language statement; determining whether the number is greater than a preset threshold value; if yes, outputting information related to the structured query language statement.
In some embodiments, in response to determining that the structured query language statement matches a string in the set of preset strings associated with the operation, outputting information related to the structured query language statement includes: in response to determining that the structured query language statement matches the character string in the operation-associated preset character string set, extracting the character string matching the character string in the operation-associated preset character string set from the structured query language statement to generate a matching character string set; importing the matching character strings in the matching character string set into a preset character string weight output model for matching to obtain the weight of each matching character string, wherein the character string weight output model is used for representing the corresponding relation between the matching character strings and the weights; adding the weights of the matched character strings to obtain the score of the structured query language statement; determining whether the score is greater than a preset score threshold; if yes, outputting information related to the structured query language statement.
In some embodiments, the information related to the structured query language statement includes at least one of: name of target configuration file, structured query language statement, description information for structured query language statement.
In a second aspect, an embodiment of the present application provides an information output apparatus, including: the reading unit is configured to read a target configuration file, wherein the target configuration file stores a structured query language statement; the first determining unit is configured to determine an operation corresponding to the structured query language statement; the second determining unit is configured to determine whether the structured query language statement matches a character string in a preset character string set associated with an operation, wherein the operation and the character string set are in one-to-one correspondence; and the output unit is configured to output information related to the structured query language sentence in response to determining that the structured query language sentence is matched with the character strings in the preset character string set associated with the operation.
In some embodiments, the target configuration file is an extensible markup language file and is applied on a Java-based persistence tier framework; and the first determination unit includes: the reading module is configured to read a tag in an element in the extensible markup language file; and the acquisition module is configured to acquire the operation corresponding to the label.
In some embodiments, the second determining unit is further configured to: it is determined whether the content in the element matches a string in a preset set of strings associated with the operation.
In some embodiments, the output unit is further configured to: and outputting information related to the structured query language sentence according to the output path information received in advance.
In some embodiments, the output unit includes: a first determination module configured to further determine a number of strings that match the structured query language statement in response to determining that the structured query language statement matches a string in a preset set of strings associated with the operation; a second determining module configured to determine whether the number is greater than a preset threshold; a first output module configured to output information related to the structured query language statement if the number is greater than a preset threshold.
In some embodiments, the output unit includes: the generating module is configured to respond to the fact that the structured query language statement is matched with the character strings in the preset character string set associated with the operation, extract the character strings matched with the character strings in the preset character string set associated with the operation from the structured query language statement, and generate a matched character string set; the matching module is configured to introduce the matching character strings in the matching character string set into a preset character string weight output model for matching to obtain the weight of each matching character string, wherein the character string weight output model is used for representing the corresponding relation between the matching character strings and the weights; the adding module is configured to add the weights of the matched character strings to obtain the score of the structured query language statement; a third determination module configured to determine whether the score is greater than a preset score threshold; and the second output module is configured to output information related to the structured query language statement if the query language statement is the structured query language statement.
In some embodiments, the information related to the structured query language statement includes at least one of: name of target configuration file, structured query language statement, description information for structured query language statement.
In a third aspect, an embodiment of the present application further provides a server, including: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the information output method provided by the application.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the information output method provided in the present application.
According to the information output method and device, the operation corresponding to the read structured query language statement in the target configuration file is determined, whether the structured query language statement is matched with the character string in the preset character string set associated with the operation is determined, and if the structured query language statement is matched with the character string in the preset character string set associated with the operation, the information related to the structured query language statement is output, so that the structured query language statement influencing the system performance due to the problem of irregular compiling is found out in the project development stage, and the test cost and the development cost are saved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of an information output method according to the present application;
fig. 3 is a schematic diagram of an application scenario of the information output method according to the present embodiment;
FIG. 4 is a flow chart of yet another embodiment of an information output method according to the present application;
FIG. 5 is a schematic block diagram of an embodiment of an information output apparatus according to the present application;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing a server according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the information output method or information output apparatus of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 1011, 1012, a network 102, a server 103, and an information display apparatus 104. Network 102 serves, among other things, as a medium for providing communication links between terminal devices 1011, 1012 and server 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The server 103 may interact with the terminal devices 1011, 1012 through the network 102 to send or receive information or the like; the server 103 may also interact with a local information display device 104 to output information and the like. Various client applications, such as a document editing type application, a program editing type application, and the like, may be installed on the terminal devices 1011, 1012.
The terminal devices 1011, 1012 may be various electronic devices having a display screen and supporting information interaction, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 103 may be a server that provides various services, such as a background server that processes the read target configuration file. The background server may first determine an operation corresponding to a structured query language statement in a configuration file in which the structured query language statement is stored, then determine whether the structured query language statement matches a character string in a preset character string set associated with the operation, and if the structured query language statement matches the character string in the preset character string set, output information related to the structured query language statement on the terminal devices 1011 and 1012 or on the local information display device 104.
The information display device 104 may be various electronic apparatuses having a display screen and locally interacting with the server 103, and may display information output by the server 103.
It should be noted that the information output method provided in the embodiment of the present application is generally executed by the server 103, and accordingly, the information output apparatus is generally disposed in the server 103.
It should be understood that the number of terminal devices, networks, servers, and information display devices in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, servers, and information display devices, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of an information output method according to the present application is shown. The information output method comprises the following steps:
In this embodiment, an electronic device (for example, a server shown in fig. 1) on which the information output method operates may read a target configuration file, in which a structured query language statement is stored. A configuration file may be a collection of settings and files that the software system will load the desired environment for the user when using the software. The target configuration file is a structured query language statement to be searched out, which does not conform to a preset rule, or a configuration file to be scanned, and the target configuration file may be input by a user or set by default (default by a system).
Structured query language is a database query and programming language for storing data and querying, updating and managing relational database systems. The structured Query Language mainly includes a Data Query Language (DQL) and a Data Manipulation Language (DML). Statements in the data query language, also called "data retrieval statements", are used to obtain data from the table, determine how the data is presented in the application, "select" is the most verb for the data query language (also all structured query languages); the data manipulation language, also referred to as an action query language or a data manipulation language, through which a user can perform basic operations on the database, such as querying, inserting, deleting, and modifying data in a table. The insertion operation is to insert data into a specified position in the database, for example, "open" is to add a record at the end of the database file, and "insert" is to add a record before the specified record; deleting a group of records which are not required to be kept in the database any more, for example, deleting marks are made on the records in the database by 'delete', the 'pack' is to completely remove the records marked with the deleting marks, and the 'zap' is to remove all the records of the database file; the modification operation is to modify a record or a database mode, or to generate a new relation mode and record on the basis of the original data, such as connecting a join operation and a projection operation; the query operation is to query the database for data satisfying a condition, which may be a data item, a record or a group of records, such as "select" to select a record satisfying a certain condition and range.
In some optional implementations of this embodiment, the target configuration file may be an Extensible Markup Language (XML) file, and is applied to a Java-based persistent layer framework. The extensible markup language is a subset of standard general markup languages, and is a markup language used for marking electronic files to enable the electronic files to have structure.
As an example, the xml configuration file described above may be applied in MyBatis applications. MyBatis, described above, is an excellent persistence tier framework that supports normal SQL queries, stored procedures, and advanced mappings. Typically, MyBatis maps interfaces and generic Java objects to records in a database using simple xml or annotations for configuration and raw mapping. MyBatis needs to load configuration at work, and the configuration comes from two places, one is a configuration file (such as an xml configuration file) and the other is the annotation of Java code.
In this embodiment, after reading the target configuration file stored with the structured query language statement in step 201, the electronic device may determine an operation corresponding to the structured query language statement in the target configuration file, for example, the operation corresponding to the structured query language statement "select" is a query operation, the operation corresponding to the structured query language statement "update" is an update operation, and the operation corresponding to the structured query language statement "delete" is a delete operation.
In some optional implementation manners of this embodiment, the electronic device may obtain an operation corresponding to the tag by reading the tag in the element in the xml configuration file. The XML element includes a start tag, an end tag, and all content between the start tag and the end tag, the tags being a pair of angle brackets and content between them, including the element name and all attributes. For example, when an element in the xml file is "< select > select id from table where num/2 ═ 100</select >", the operation corresponding to the tag in the element in the xml file is a query operation.
In this embodiment, after determining the operation corresponding to the structured query language sentence in step 202, the electronic device may first obtain a preset character string set associated with the operation, and then may determine whether a character string in the character string set matches the structured query language sentence, and if so, execute step 204. Wherein, the operation is corresponding to the character string set one by one.
In this embodiment, the electronic device may first receive a string set associated with an operation, which is input by a developer, where the string set is composed of strings that are summarized or evaluated by the developer and have low system performance due to an irregular writing of an SQL statement. For a query operation, because "select" is to query all fields, all fields are queried once and the result is filtered; the occurrence of "null" in the query condition consumes time and computer memory; the occurrence of "like" in the query condition results in the query of all fields; it is very time consuming to present an arithmetic operator in a query condition, so the strings in the string set associated with the query operation may be "+", "like" and some arithmetic operators such as "+", "" | ","! "and the like.
As an example, if the structured query language statement is "select from table where id is 1", a set of strings associated with the query operation, such as "," null "," like "," + ", may be obtained first, and then it may be determined whether the structured query language statement" select from table where id is 1 "matches the strings in the set of strings associated with the query operation.
In some optional implementations of this embodiment, the electronic device may determine whether content in an element in the xml configuration file (i.e., content between the start tag and the end tag) matches a string in a preset string set associated with the operation, and if so, execute step 204.
At step 204, information associated with the structured query language statement is output.
In this embodiment, if it is determined in step 203 that the structured query language sentence matches a character string in the preset character string set associated with the operation, information related to the structured query language sentence may be output, for example, the related information may be written in an EXCEL table and output.
In some optional implementations of this embodiment, the electronic device may first receive output path information of the information related to the structured query language sentence, and then output the information related to the structured query language sentence according to the output path information. As an example, when the received output path is "D:/abc.
In some optional implementations of this embodiment, after determining that the character strings in the character string set match the structured query language statement, the electronic device may first extract, in the structured query language statement, character strings that match the character strings in a preset character string set associated with the operation, and generate a matching character string set by using the matched character strings; then, the matching character strings in the matching character string set may be imported into a preset character string weight output model for matching, so as to obtain the weight of each matching character string, where the character string weight output model is used to represent the correspondence between the matching character strings and the weights, for example, the weight corresponding to the matching character string "×" may be 0.9, the weight corresponding to the matching character string "=" may be 0.5, and the weight corresponding to the matching character string "like" may be 0.8; then, the weights of the matching character strings can be added, and the sum of the weights is used as the score of the structured query language statement; finally, it may be determined whether the score is greater than a preset score threshold, and if so, information related to the structured query language statement may be output. The method can output the structured query language sentences which have larger influence on the system performance and contain a larger number of written irregular sentences.
In some optional implementations of this embodiment, the information may include at least one of: the name of the target configuration file, the structured query language statement, and description information for the structured query language statement. As an example, when the name of the target configuration file is "abc.xml" and the structured query language statement is "select from tableme", the name of the xml configuration file may be output as "abc.xml", the structured query language statement "select from tableme" and the description information "current SQL present full-table scan statement" for the structured query language statement.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the information output method according to the present embodiment. In the application scenario of fig. 3, after the background server reads the target configuration file "abc.xml", the operation corresponding to the structured query language statement "select _ from _ table _ name" 301 in the configuration file may be read as a query operation, and then when it is determined that the "select _ from _ table _ name" 301 matches the string "", in the string set associated with the query operation, information related to the structured query language statement 301 may be output, for example, the name "abc.xml" of the target configuration file, the structured query language statement "select _ from _ table _ name" and the description information "current SQL exists in the full-table scan statement" for the structured query language statement 301 are output; the backend server may also read that the operation corresponding to the structured query language statement "update table set a is 1, b is 2, c is 3, and d is 4" 302 "in the configuration file is an update operation, and then, when it is determined that" update table set a is 1, b is 2, c is 3, and d is 4 "302 matches the string" in the string set associated with the update operation, and when four fields are present in the full table, the backend server may output information related to the structured query language statement 302, such as the name "abc.
The method provided by the above embodiment of the present application determines whether the structured query language statement written in the target configuration file has a preset character string set associated with the operation corresponding to the structured query language statement, so as to determine whether to output information related to the structured query language statement, and finds out the structured query language statement affecting the system performance in the development stage, thereby saving the test cost and the development cost.
With further reference to fig. 4, a flow 400 of yet another embodiment of an information output method is shown. The process 400 of the information output method includes the following steps:
In this embodiment, an electronic device (for example, a server shown in fig. 1) on which the information output method operates may read a target configuration file in which a structured query language statement is stored. A configuration file may be a collection of settings and files that the software system will load the desired environment for the user when using the software.
Structured query language is a database query and programming language for storing data and querying, updating and managing relational database systems. The structured query language mainly comprises a data query language and a data operation language. Statements in the data query language, also called "data retrieval statements", are used to obtain data from the table, determine how the data is given in the application, "select" is the most verb for the data query language; the data manipulation language, also referred to as an action query language or a data manipulation language, through which a user can perform basic operations on a database, such as queries (e.g., "select"), inserts (e.g., "insert," "append"), deletes (e.g., "delete," "pack," "zap"), and modifies (e.g., "update") data in the table.
In some optional implementations of this embodiment, the target configuration file may be an extensible markup language file, and is applied to a Java-based persistent layer framework. The extensible markup language is a subset of standard general markup languages, and is a markup language used for marking electronic files to enable the electronic files to have structure.
By way of example, the above xml configuration file may be applied in a MyBatis application, which is an excellent persistent layer framework that supports generic SQL queries, stores procedures and advanced mappings, using simple xml or annotations for configuration and raw mapping, mapping interfaces and generic Java objects to records in a database. MyBatis needs to load configuration at work, and the configuration comes from two places, one is a configuration file and the other is the annotation of Java code.
In this embodiment, after reading the target configuration file stored with the structured query language statement in step 401, the electronic device may determine an operation corresponding to the structured query language statement in the target configuration file, for example, an operation corresponding to the structured query language statement "select" is a query operation, an operation corresponding to the structured query language statement "update" is an update operation, an operation corresponding to the structured query language statement "delete" is a delete operation, and the like.
At step 403, it is determined whether the structured query language statement matches a string in a preset string set associated with the operation.
In this embodiment, after determining the operation corresponding to the structured query language sentence in step 402, the electronic device may first obtain a preset character string set associated with the operation, and then may determine whether a character string in the character string set matches the structured query language sentence, and if so, execute step 404. Wherein, the operation is corresponding to the character string set one by one.
In this embodiment, the electronic device may first receive a string set associated with an operation, which is input by a developer, where the string set is composed of strings that are summarized or evaluated by the developer and have low system performance due to an irregular writing of an SQL statement. For the update operation, since it is very time consuming to present the arithmetic operation symbol in the update condition, the strings in the string set associated with the update operation may be some arithmetic operation symbols such as "+", ""% "," ^","! "and the like.
In the present embodiment, when a plurality of "join" appears in the query condition, such query operation is very time-consuming; when a plurality of "═ s" appear in the sentence corresponding to the update operation, it is necessary to determine the number of fields included in the target object to be updated, and if the number of fields is the same as the number of "═ s", all the fields of the target object are updated, then the string set associated with the query operation may further include "join", and the string set associated with the update operation may further include "═ s".
As an example, if the structured query language statement is "update id from table where num-40 ═ 20", a set of strings associated with the update operation, such as "+", "/", may be obtained first, and then it may be determined whether the structured query language statement "update id from table where num-40 ═ 20" matches the strings in the set of strings associated with the update operation.
At step 404, the number of strings that match the structured query language statement is determined.
In this embodiment, if it is determined in step 403 that the structured query language sentence matches a character string in the preset character string set associated with the operation, the number of character strings matching a part of character strings in the structured query language sentence may be further determined.
In step 405, it is determined whether the number is greater than a preset threshold.
In this embodiment, after determining the number of character strings matching the partial character string in the structured query language sentence in step 404, the electronic device may determine whether the number is greater than a preset threshold, and if the number is greater than the preset threshold, step 406 may be executed. As an example, when the preset threshold is 3, if the number of the character strings matching with the partial character string in the structured query language sentence is greater than 3, step 406 is executed.
As an example, if the structured query language statement is "update table set a is 1, b is 2, c is 3, and d is 4", and the set of character strings associated with the update operation includes "set", the number of character strings matching "set" in the structured query language statement may be determined to be 4, and if the preset threshold is 3, the number of character strings 3 may be determined to be greater than the threshold 4.
At step 406, information associated with the structured query language statement is output.
In this embodiment, if it is determined in step 405 that the number is greater than the preset threshold, information related to the structured query language sentence may be output, for example, the related information may be written in an EXCEL table and output. The information may include at least one of: the name of the target configuration file, the structured query language statement, and description information for the structured query language statement.
As can be seen from fig. 4, compared with the embodiment shown in fig. 2, the flow 400 of the information output method in this embodiment highlights a step of determining the output related information according to the determined number of character strings matching with the structured query language sentence. Therefore, the scheme described in this embodiment can make the output structured query language statement be a structured query language statement that seriously affects the system performance, so that a tester can firstly solve the structured query language statement that seriously affects the system performance.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an information output apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the information output apparatus 500 of the present embodiment includes: a reading unit 501, a first determining unit 502, a second determining unit 503, and an output unit 504. The reading unit 501 is configured to read a target configuration file, where a structured query language statement is stored in the target configuration file; the first determining unit 502 is configured to determine an operation corresponding to the structured query language statement; the second determining unit 503 is configured to determine whether the structured query language statement matches a character string in a preset character string set associated with the operation, where the operation corresponds to the character string set one to one; the output unit 504 is configured to output information related to the structured query language statement in response to determining that the structured query language statement matches a string of a preset set of strings associated with the operation.
In this embodiment, the reading unit 501 of the information output apparatus 500 may read a target configuration file in which the structured query language statement is stored. A configuration file may be a collection of settings and files that the software system will load the desired environment for the user when using the software. The target configuration file is a structured query language statement to be searched out which does not conform to a preset rule or a configuration file to be scanned, and the target configuration file can be input by a user or set by default. Structured query language is a database query and programming language for storing data and querying, updating and managing relational database systems.
In this embodiment, after the reading unit 501 reads the target configuration file stored with the structured query language statement, the first determining unit 502 may determine an operation corresponding to the structured query language statement in the target configuration file, for example, the operation corresponding to the structured query language statement "select" is a query operation, the operation corresponding to the structured query language statement "update" is an update operation, and the operation corresponding to the structured query language statement "delete" is a delete operation.
In this embodiment, after the first determining unit 502 determines the operation corresponding to the structured query language sentence, the second determining unit 503 may first obtain a preset character string set associated with the operation, and then may determine whether the character strings in the character string set match the structured query language sentence, for example, whether the same partial character strings as the character strings in the character string set exist in the structured query language sentence. Wherein, the operation is corresponding to the character string set one by one.
In this embodiment, if the second determining unit 503 determines that the structured query language sentence matches a character string in a preset character string set associated with the operation, the output unit 504 may output information related to the structured query language sentence, for example, the related information may be written in an EXCEL table and output.
In some optional implementations of this embodiment, the target configuration file may be an extensible markup language file, and is applied to a Java-based persistent layer framework. The extensible markup language is a subset of standard general markup languages, and is a markup language used for marking electronic files to enable the electronic files to have structure. The first determination unit 502 may include a reading module 5021 and an acquisition module 5022. The reading module 5021 may read tags in elements in the xml configuration file, and then obtain the operations corresponding to the tags through the obtaining module 5022. The XML element includes a start tag, an end tag, and all content between the start tag and the end tag, the tags being a pair of angle brackets and content between them, including the element name and all attributes.
In some optional implementations of the embodiment, the second determining unit 503 may determine whether the content in the element in the xml configuration file matches a string in a preset string set associated with the operation.
In some optional implementations of this embodiment, the output unit 504 may first receive output path information of the information related to the structured query language sentence, and then output the information related to the structured query language sentence according to the output path information.
In some optional implementations of the present embodiment, the output unit 504 may include a first determining module 5041, a second determining module 5042, and a first output module 5043. If the second determining unit 503 determines that the structured query language sentence matches a character string in the preset character string set associated with the operation, the first determining module 5041 may further determine the number of character strings matching a part of character strings in the structured query language sentence; thereafter, the second determining module 5042 may determine whether the number is greater than a preset threshold, and if the number is greater than the preset threshold, the first outputting module 5043 may output information related to the structured query language statement, for example, the related information may be written in an EXCEL table and output. The information may include at least one of: the name of the target configuration file, the structured query language statement, and description information for the structured query language statement.
In some optional implementations of this embodiment, the output unit 504 may further include a generating module 5044, a matching module 5045, an adding module 5046, a third determining module 5047, and a second output module 5048. After determining that the character strings in the character string set match the structured query language sentence, the generating module 5044 may first extract the character strings matching the character strings in the preset character string set associated with the operation from the structured query language sentence, and generate a matching character string set by using the matching character strings; then, the matching module 5045 may import the matching character strings in the matching character string set into a preset character string weight output model for matching, so as to obtain the weight of each matching character string, where the character string weight output model is used to represent the corresponding relationship between the matching character strings and the weights; then, the adding module 5046 may add the weights of the matching strings, and use the sum of the weights as the score of the structured query language sentence; finally, the third determining module 5047 may determine whether the score is greater than a preset score threshold, and if the score is greater than the score threshold, the second outputting module 5048 may output information related to the structured query language statement. The method can output the structured query language sentences which have larger influence on the system performance and contain a larger number of written irregular sentences.
In some optional implementations of this embodiment, the information may include at least one of: the name of the target configuration file, the structured query language statement, and description information for the structured query language statement.
Referring now to FIG. 6, a block diagram of a computer system 600 suitable for use as a server in implementing embodiments of the present invention is shown. The server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable medium mentioned above in the present application may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a reading unit, a first determining unit, a second determining unit, and an output unit. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves. For example, the reading unit may also be described as a "unit for reading a target profile".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: reading a target configuration file, wherein a structured query language statement is stored in the target configuration file; determining the operation corresponding to the structured query language statement; determining whether the structured query language statement is matched with a character string in a preset character string set associated with an operation, wherein the operation and the character string set are in one-to-one correspondence; and outputting information related to the structured query language sentence in response to determining that the structured query language sentence matches a character string in the preset character string set associated with the operation.
The foregoing description is only exemplary of the preferred embodiments of the invention and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention according to the present invention is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the scope of the invention as defined by the appended claims. For example, the above features and (but not limited to) features having similar functions disclosed in the present invention are mutually replaced to form the technical solution.
Claims (14)
1. An information output method, characterized in that the method comprises:
reading a target configuration file, wherein a structured query language statement is stored in the target configuration file;
determining an operation corresponding to the structured query language statement;
determining whether the structured query language statement is matched with a character string in a preset character string set associated with the operation, wherein the operation and the character string set are in one-to-one correspondence, and the character string set comprises a character string with low system performance caused by the nonstandard writing of the structured query language statement;
in response to determining that the structured query language statement matches a string in a preset set of strings associated with the operation, outputting information related to the structured query language statement, wherein the related information includes at least one of: a name of the target configuration file, the structured query language statement, description information for the structured query language statement.
2. The method of claim 1, wherein the target configuration file is an extensible markup language file and is applied to a Java-based persistent layer framework; and
the determining the operation corresponding to the structured query language statement includes:
reading a tag in an element in the extensible markup language file;
and acquiring the operation corresponding to the label.
3. The method of claim 2, wherein the determining whether the structured query language statement matches a string in a preset set of strings associated with the operation comprises:
and determining whether the content in the element is matched with a character string in a preset character string set associated with the operation.
4. The method of claim 1, wherein outputting information related to the structured query language statement comprises:
and outputting information related to the structured query language statement according to the output path information received in advance.
5. The method of claim 1, wherein outputting information related to the structured query language statement in response to determining that the structured query language statement matches a string in a preset set of strings associated with the operation comprises:
in response to determining that the structured query language statement matches a string in the pre-set string set associated with the operation, further determining a number of strings that match the structured query language statement;
determining whether the number is greater than a preset threshold;
and if so, outputting information related to the structured query language statement.
6. The method of claim 1, wherein outputting information related to the structured query language statement in response to determining that the structured query language statement matches a string in a preset set of strings associated with the operation comprises:
in response to determining that the structured query language statement matches a character string in the preset character string set associated with the operation, extracting a character string matching the character string in the preset character string set associated with the operation from the structured query language statement to generate a matching character string set;
leading the matched character strings in the matched character string set into a preset character string weight output model for matching to obtain the weight of each matched character string, wherein the character string weight output model is used for representing the corresponding relation between the matched character strings and the weight;
adding the weights of the matched character strings to obtain the score of the structured query language statement;
determining whether the score is greater than a preset score threshold;
and if so, outputting information related to the structured query language statement.
7. An information output apparatus, characterized in that the apparatus comprises:
the device comprises a reading unit, a processing unit and a processing unit, wherein the reading unit is configured to read a target configuration file, and a structured query language statement is stored in the target configuration file;
a first determining unit, configured to determine an operation corresponding to the structured query language statement;
a second determining unit, configured to determine whether the structured query language statement matches a character string in a preset character string set associated with the operation, where the operation corresponds to the character string set in a one-to-one manner, and the character string set includes a character string with low system performance caused by an irregular writing of the structured query language statement;
an output unit configured to output information related to the structured query language statement in response to determining that the structured query language statement matches a character string of a preset set of character strings associated with the operation, wherein the related information includes at least one of: a name of the target configuration file, the structured query language statement, description information for the structured query language statement.
8. The apparatus of claim 7, wherein the target configuration file is an extensible markup language file and is applied to a Java-based persistent layer framework; and
the first determination unit includes:
a reading module configured to read tags in elements in the extensible markup language file;
and the acquisition module is configured to acquire the operation corresponding to the label.
9. The apparatus of claim 8, wherein the second determining unit is further configured to:
and determining whether the content in the element is matched with a character string in a preset character string set associated with the operation.
10. The apparatus of claim 7, wherein the output unit is further configured to:
and outputting information related to the structured query language statement according to the output path information received in advance.
11. The apparatus of claim 7, wherein the output unit comprises:
a first determination module configured to further determine a number of strings that match the structured query language statement in response to determining that the structured query language statement matches a string in a preset set of strings associated with the operation;
a second determining module configured to determine whether the number is greater than a preset threshold;
a first output module configured to output information related to the structured query language statement if the number is greater than a preset threshold.
12. The apparatus of claim 7, wherein the output unit comprises:
a generating module, configured to, in response to determining that the structured query language statement matches a character string in the preset character string set associated with the operation, extract, in the structured query language statement, a character string that matches a character string in the preset character string set associated with the operation, and generate a matching character string set;
the matching module is configured to introduce the matching character strings in the matching character string set into a preset character string weight output model for matching to obtain the weight of each matching character string, wherein the character string weight output model is used for representing the corresponding relation between the matching character strings and the weight;
the adding module is configured to add the weights of the matching character strings to obtain the score of the structured query language statement;
a third determination module configured to determine whether the score is greater than a preset score threshold;
and the second output module is configured to output information related to the structured query language statement if the query language statement is the structured query language statement.
13. A server, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710217133.8A CN108694172B (en) | 2017-04-05 | 2017-04-05 | Information output method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710217133.8A CN108694172B (en) | 2017-04-05 | 2017-04-05 | Information output method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108694172A CN108694172A (en) | 2018-10-23 |
CN108694172B true CN108694172B (en) | 2021-12-31 |
Family
ID=63841973
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710217133.8A Active CN108694172B (en) | 2017-04-05 | 2017-04-05 | Information output method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108694172B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111400342A (en) * | 2019-01-03 | 2020-07-10 | 百度在线网络技术(北京)有限公司 | Database updating method, device, equipment and storage medium |
CN110309099B (en) * | 2019-06-28 | 2025-05-06 | 深圳前海微众银行股份有限公司 | Interface management method, device, equipment and computer-readable storage medium |
CN110321544B (en) * | 2019-07-08 | 2023-07-25 | 北京百度网讯科技有限公司 | Method and device for generating information |
CN114547085B (en) * | 2022-03-22 | 2023-05-05 | 中国铁塔股份有限公司 | Data processing method and device, electronic equipment and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2008155779A2 (en) * | 2007-06-20 | 2008-12-24 | Sanjeev Krishnan | A method and apparatus for software simulation |
CN102541521A (en) * | 2010-12-17 | 2012-07-04 | 中国银联股份有限公司 | Automatic operating instruction generating device based on structured query language and method |
CN103488738A (en) * | 2013-09-18 | 2014-01-01 | 北京思特奇信息技术股份有限公司 | Method and system for automatically realizing JAVA object and data table SQL (structured query language) file |
CN103559444A (en) * | 2013-11-05 | 2014-02-05 | 星云融创(北京)信息技术有限公司 | Sql (Structured query language) injection detection method and device |
CN103793315A (en) * | 2012-10-29 | 2014-05-14 | Sap股份公司 | Software development quality monitoring and improving system and method |
CN104484448A (en) * | 2014-12-26 | 2015-04-01 | 浙江协同数据系统有限公司 | Assessment method for relational data quality |
CN106156623A (en) * | 2016-07-29 | 2016-11-23 | 江西师范大学 | Based on the SQLIA defence method being intended to |
-
2017
- 2017-04-05 CN CN201710217133.8A patent/CN108694172B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2008155779A2 (en) * | 2007-06-20 | 2008-12-24 | Sanjeev Krishnan | A method and apparatus for software simulation |
CN102541521A (en) * | 2010-12-17 | 2012-07-04 | 中国银联股份有限公司 | Automatic operating instruction generating device based on structured query language and method |
CN103793315A (en) * | 2012-10-29 | 2014-05-14 | Sap股份公司 | Software development quality monitoring and improving system and method |
CN103488738A (en) * | 2013-09-18 | 2014-01-01 | 北京思特奇信息技术股份有限公司 | Method and system for automatically realizing JAVA object and data table SQL (structured query language) file |
CN103559444A (en) * | 2013-11-05 | 2014-02-05 | 星云融创(北京)信息技术有限公司 | Sql (Structured query language) injection detection method and device |
CN104484448A (en) * | 2014-12-26 | 2015-04-01 | 浙江协同数据系统有限公司 | Assessment method for relational data quality |
CN106156623A (en) * | 2016-07-29 | 2016-11-23 | 江西师范大学 | Based on the SQLIA defence method being intended to |
Non-Patent Citations (1)
Title |
---|
"基于静态分析的应用代码质量管理体系研究及应用";付金莹 等;《中国新通信》;20131115(第13期);54-58 * |
Also Published As
Publication number | Publication date |
---|---|
CN108694172A (en) | 2018-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9740698B2 (en) | Document merge based on knowledge of document schema | |
US11030083B2 (en) | Systems and methods for reducing storage required for code coverage results | |
US20130054812A1 (en) | System and method for dynamically assembling an application on a client device | |
CN110555030A (en) | SQL statement processing method and device | |
US11741002B2 (en) | Test automation systems and methods using logical identifiers | |
CN103810212A (en) | Automated database index creation method and system | |
CN108694172B (en) | Information output method and device | |
CN113419740B (en) | Program data stream analysis method and device, electronic equipment and readable storage medium | |
CN113626223A (en) | Interface calling method and device | |
WO2021051624A1 (en) | Data acquisition method and apparatus, and electronic device and storage medium | |
CN112527738A (en) | Project description file optimization method, system and storage medium | |
CN108959294B (en) | Method and device for accessing search engine | |
US20200348949A1 (en) | System and methods for loading objects from hash chains | |
CN117632241A (en) | Method and device for generating flow chart | |
CN109885610A (en) | A kind of abstracting method of structural data, device, electronic equipment and storage medium | |
CN113138792B (en) | Elasticsearch version migration method, device and storage medium | |
CN113312053B (en) | A method and device for data processing | |
CN117762984A (en) | Data acquisition method, device, electronic equipment and storage medium | |
CN114168119B (en) | Code file editing method, device, electronic equipment and storage medium | |
CN114089976A (en) | Method, apparatus and medium for generating database operation statements | |
CN108334621B (en) | Database operation method, device, equipment and computer readable storage medium | |
CN114358000B (en) | Extracting structured information from unstructured documents | |
US10216817B2 (en) | Creating XML data from a database | |
CN116755684B (en) | OAS Schema generation method, device, equipment and medium | |
US12326870B2 (en) | Deep connectivity between disparate database systems |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TG01 | Patent term adjustment | ||
TG01 | Patent term adjustment |