CN115080591A - Database language correction method, device, computer terminal and storage medium - Google Patents

Database language correction method, device, computer terminal and storage medium Download PDF

Info

Publication number
CN115080591A
CN115080591A CN202210731297.3A CN202210731297A CN115080591A CN 115080591 A CN115080591 A CN 115080591A CN 202210731297 A CN202210731297 A CN 202210731297A CN 115080591 A CN115080591 A CN 115080591A
Authority
CN
China
Prior art keywords
database
database language
statement
sensitive
language
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210731297.3A
Other languages
Chinese (zh)
Inventor
易旺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202210731297.3A priority Critical patent/CN115080591A/en
Publication of CN115080591A publication Critical patent/CN115080591A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Landscapes

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

Abstract

The embodiment of the invention discloses a database language correction method, a database language correction device, a computer terminal and a storage medium, wherein the method comprises the following steps: scanning a database statement and identifying a sensitive element in the database statement; if the sensitive elements exist, judging whether the database language in which the sensitive elements exist meets the preset requirement or not according to the types of the sensitive elements; and if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element. After the developer writes the codes, the non-standard and risky contents in the database language can be easily found, and the correction and revision are carried out to maintain the stability of the database.

Description

Database language correction method and device, computer terminal and storage medium
Technical Field
The present invention relates to the field of natural language processing, and in particular, to a database language correction method, apparatus, computer terminal, and storage medium.
Background
In software system development, developers have different experiences, resulting in the nonstandard SQL grammar written in codes, such as using select # query, for complex systems in the financial industry, irregular SQL statements can affect the system operating efficiency, great potential safety hazards are brought, the overall query efficiency is low, and the server is constantly oriented to multiple users, the low-efficiency language can enable server resources to be occupied, and multiple repeated meaningless works are performed, so that the whole system is possible to crash, an intelligent code SQL detection technology is needed to find and automatically repair the problems, and the potential safety hazards of the system are avoided.
Disclosure of Invention
In a first aspect, the present application provides a database language modification method, including:
scanning a database statement and identifying a sensitive element in the database statement;
if the sensitive elements exist, judging whether the database language in which the sensitive elements exist meets the preset requirement or not according to the types of the sensitive elements;
and if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element.
Further, the sensitive element comprises a conditional statement;
the step of judging whether the database language meets the preset requirement comprises the following steps:
if the sensitive element is the conditional statement, extracting and tracking index value configuration of a corresponding database table, comparing the index value configuration with conditions in the conditional statement, and judging whether the conditional statement covers an index in the index value configuration;
if the database language does not meet the preset requirement, using a modification mode corresponding to the type of the sensitive element, wherein the step of modifying the database language comprises the following steps:
and if the index value configuration is not covered, adding a missing index in the index configuration of the database table.
Further, the sensitive elements also comprise form data;
the step of judging whether the database language meets the preset requirement comprises the following steps:
if the sensitive element is the form data, judging whether the form data contains a sensitive object;
if the database language does not meet the preset requirement, using a modification mode corresponding to the type of the sensitive element, wherein the step of modifying the database language comprises the following steps:
and if the sensitive object exists, adjusting the message of the form data according to the attribute meaning of the sensitive object.
Further, the sensitive object comprises a large object type;
according to the attribute meaning of the sensitive object, the adjustment of the form data message comprises the following steps:
reading the remarks of the large object types, determining the size of the message returning the form data by combining with externally configured parameters, and intercepting the current message of the form according to the size of the message.
Further, the sensitive element further comprises a query statement:
and if the sensitive element is the query statement, judging whether the query statement meets the specification, and if not, correspondingly correcting the query statement through the name of a data table associated with the query statement.
Further, the query statement comprises a selection statement;
the judging whether the selection statement conforms to the specification comprises:
searching whether the database language has wildcard characters, if yes, determining that the database language does not have wildcard characters;
correspondingly correcting the query statement by the name of the data table associated with the query statement comprises the following steps:
and identifying a structural mapping class object of the table returned by the database language through the name of the data table, and replacing the wildcard character according to the mapping class object.
Further, the determining whether the query statement meets the specification further includes:
and judging whether the field queried in the query statement has redundant parts, if so, performing field pairing according to the context, and deleting the unused field.
In a second aspect, the present application further provides a database language modification apparatus, including:
the scanning module scans database sentences and identifies sensitive elements in the database sentences;
the judgment module judges whether the database language meets the preset requirement or not according to the type of the sensitive element if the sensitive element exists;
and the correction module is used for modifying the database language by using a modification mode corresponding to the type of the sensitive element if the database language does not meet the preset requirement.
In a third aspect, the present application further provides a computer terminal, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the database language correction method when running on the processor.
In a fourth aspect, the present application further provides a readable storage medium storing a computer program, which when executed on a processor performs the database language modification method.
The embodiment of the invention discloses a database language correction method, a database language correction device, a computer terminal and a storage medium, wherein the method comprises the following steps: scanning a database statement and identifying sensitive elements in the database statement; if the sensitive elements exist, judging whether the database language in which the sensitive elements exist meets the preset requirement or not according to the types of the sensitive elements; and if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element. After the developer writes the codes, the non-standard and dangerous contents in the database language can be easily found, the correction and the revision are carried out, the stability of the database is maintained, the code quality is improved, the later maintenance is easy, when the contents of the database are changed, the codes can be updated, the codes are in accordance with the optimal query thought of the current database, the accident potential is avoided, and the subsequent operation is convenient.
Drawings
In order to more clearly illustrate the technical solution of the present invention, the drawings required to be used in the embodiments will be briefly described below, and it should be understood that the following drawings only illustrate some embodiments of the present invention, and therefore should not be considered as limiting the scope of the present invention. Like components are numbered similarly in the various figures.
FIG. 1 is a flow chart illustrating a database language modification method according to an embodiment of the present application;
FIG. 2 is a schematic diagram illustrating packet truncation according to an embodiment of the present application;
fig. 3 shows a schematic structural diagram of a database language correction apparatus according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments.
The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
Hereinafter, the terms "including", "having", and their derivatives, which may be used in various embodiments of the present invention, are only intended to indicate specific features, numbers, steps, operations, elements, components, or combinations of the foregoing, and should not be construed as first excluding the existence of, or adding to, one or more other features, numbers, steps, operations, elements, components, or combinations of the foregoing.
Furthermore, the terms "first," "second," "third," and the like are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present invention belong. The terms (such as those defined in commonly used dictionaries) should be interpreted as having a meaning that is consistent with their contextual meaning in the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein in various embodiments of the present invention.
The technical scheme of the application is applied to code maintenance, particularly database code maintenance, a target database language is selected through traversing of the code language, then semantics are understood from the context of the database language, whether the current database language is stable or not and whether keywords which can cause low working efficiency exist or not are judged, and the database language is optimized according to an inspection result so as to eliminate potential safety hazards and optimize the code.
It should be noted that the database language mentioned in the present application may be a common SQL language, or may be an internally defined database language, and as long as the database language is operated on data of the database, the database language is within a scenario to which the technical solution of the present application is applied. The technical solution of the present application may be operated in a plug-in manner or an independent application manner, or may be integrated in a system, and the form of the method is not specifically limited in the present application.
The technical solution of the present application will be described with specific examples.
Example 1
The database language of this embodiment is, for example, SQL (structured Query language), and is a database language having multiple functions such as data manipulation and data definition, and this language has the interactive characteristic, and can provide great convenience for users, and the database management system should fully utilize the SQL language to improve the work quality and efficiency of the computer application system. The SQL language can be independently applied to a terminal and can also be used as a sub-language to provide effective assistance for other program designs.
As shown in fig. 1, the database language correction method of the present application includes the following steps:
step S100, scanning a database statement and identifying sensitive elements in the database statement.
For the source code of the developer, a pure database statement may be used, or a database language may be referred to in development languages such as C + +, JAVA, or python, and because the technical solution of the present application is directed to the database language, only the database language is scanned and identified.
The database language and the above-mentioned development languages are different from grammar and defined words, and when they are nested in the development languages, they are usually processed by respective special interfaces, and have extremely high recognition in codes, so that the database language can be recognized by the grammar and keywords of the database language, or the interface name and method name used. Or the database languages are realized through internal code specifications, for example, when the database languages need to be nested in a development language, SQL words are remarked, or a special database class is declared, and the identification and positioning of the database languages are realized through the rules.
After the target code is found, sensitive elements in the database statements need to be searched, where the sensitive elements refer to statements or keywords that may have a negative effect on the program when the corresponding program is executed by using the sensitive elements, resulting in a stuck-at program, and specifically, the sensitive elements may be conditional statements, form data, and query statements.
For example, the query keywords and the term words such as SELECT and where may constitute a query statement and a term statement, where the query statement and the term statement may exist in one sentence at the same time or may exist separately, and the form data is the same.
For these keywords, in this embodiment, the keywords may be searched and labeled in a manner of storing a keyword table, and meanwhile, some formats and grammars that are not suggested to be used may be listed in the table, so as to facilitate the search and judgment of these sensitive elements.
Besides the keywords, the function of parsing the whole database statement, whether to query, add, delete or modify, according to the context semantics of the database language is also required, and the sensitive elements in the function are different for different functions.
For example, a query statement, which needs to return data to an external interface, needs to ensure that the returned data is consistent with the queried data, and not more or less, so that in the query statement, both the conditional statement that controls the returned data and the field of the returned data are sensitive elements.
Besides query sentences, some sentences with addition, deletion and modification have similar problems, and conditional sentences are also required to limit sentences to narrow the influence scope, but the limited conditions need to be legal, namely exist in the tables of objects, and the situations are also sensitive elements mentioned in the application.
Aiming at the sensitive elements needing to judge the semantics, the method depends on some keywords and combinations of the keywords, so that the sensitive elements can be searched in a list mode. In addition, a query AI can be trained to search by training the query AI in a modeling mode and taking keywords and sentences of the database language labeled with the labels as a training set, and meanwhile, a self-feedback model is set, so that the AI can update the search model of the AI when working.
And S200, if the sensitive elements exist, judging whether the database language meets the preset requirement or not according to the types of the sensitive elements.
When there are sensitive elements, the types of the sensitive elements need to be determined, and it is determined whether the sensitive elements meet preset requirements, obviously, different keywords may have different requirements, for example, the keywords of SELECT, WHERE, and JOIN have different uses and different syntax formats, so the determination methods and conditions for the keywords may also be different.
The preset requirement refers to that the statement does not have potential safety hazard according to code writing specifications or program specifications.
These sensitive elements include conditional statements, form data, and query statements, classified by category of keyword. However, except for the keywords, whether the whole statement is consistent with the functions of the context, whether the whole statement generates additional operations, and whether additional data is returned is also one of the conditions to be determined, so that besides finding the sensitive elements, whether the whole database statement meets the conditions or not is determined, and whether the safety hazard is generated or not is determined.
Query statements are common statements, and some data in some tables can be obtained by querying the index entries in the tables, for example, by a select key.
For example, a database statement is SELECT FROM table name, which is a statement that contains the role of a query, and because the wildcard ". sup." is used, the statement can be used to look up all elements in the table _ name. It can be seen that SELECT returns all the data in the table, and when the size of the table is not large, the whole program problem is not large. However, after the data are accumulated in the table, the data are increased, and the query mode can lead to more and more returned data, so that the query speed is slow, and even the phenomena of jam and crash are caused, so that the use of SELECT is generally discouraged to perform query in the database language, and therefore, the use of SELECT is a sensitive element with potential safety hazard, can be listed as a problematic sensitive element, and is considered to be not in accordance with the preset requirement.
Or taking the SELECT as a sensitive element, and then judging whether the use is the SELECT, and when the use is found, the preset requirement is not met. Or judging the size of the table, and when the size of the table is larger than a certain limit, not allowing the use of the method of SELECT to judge that the sentence is not qualified.
The table _ name in this case is a form data, a plurality of data are stored in the form data, the data have data types, such as large object types, BLOBs, text, and the like, which occupy a large data space, and often the space occupied by these large types is not used completely, resulting in space occupation, but only half of the actual use may be omitted, resulting in space waste, and the size of the returned data packet is also increased, which not only makes network transmission slow, but also consumes local computing resources and storage space, so that the use of the large object type here is not satisfactory, and needs to be corrected in subsequent steps.
In addition to the fields, the query statement in the database is also a sensitive element which needs to be checked, if the number of data fields returned by the query statement is far greater than the number of fields defined by the external interface, the query statement represents that a lot of data which are not needed by the external program are returned by the current query statement, on one hand, for the external program, the data which are not needed are received, the processing is troublesome, and meanwhile, the local operation amount is increased, and the database statement is considered to be not in accordance with the requirement.
In the above example, there are multiple types of sensitive elements and the existence forms of the sensitive elements, so that the scanned database languages can be subjected to one-to-one matching comparison by setting a matching table, after the sensitive elements are found, the types of the sensitive elements are judged, and then targeted screening is performed according to the types to judge whether the database statements meet the requirements.
For example, after a database statement is queried, the function of the statement is determined, for example, if there is a query keyword SELECT in the statement, it indicates that there is a query function in the statement, it is determined whether the SELECT is a SELECT, and meanwhile, whether there is a where statement in the statement is queried in a matching manner, and if so, it is determined whether the conditional keyword in the where statement covers the index according to the message parameter analysis of the context request. Thus, whether the statement meets the preset condition is judged.
After the keyword is checked, function checking of the whole sentence is started, whether relevant indexes in a database sentence are used or not and whether empty direction exists or not are determined by extracting context relevant information, whether redundant actions exist in the sentence for the context is checked, and after the judgment is finished, corresponding operation is carried out according to the judgment result.
And step S300, if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element.
And when the sensitive elements exist in the database language, respectively correcting the sensitive elements in a targeted manner according to the categories of the sensitive elements.
And if the sensitive element is the query statement, judging whether the query statement meets the specification, and if not, correspondingly correcting the query statement through the name of a data table associated with the query statement.
Taking SELECT as an example, when a SELECT is found by scanning, it needs to change the statement, and therefore, it needs to determine the target database table operated by the SELECT statement first, and through the table owner of the database, it can identify the returned table structure mapping class object, that is, which object elements exist in the table, and then according to the purpose of the statement, SELECT the corresponding object element, and remove the substitution number in the SELECT.
For example, object elements of id, name, url, alexa and count exist in a table, corresponding data are stored, after the context of the database language is analyzed, the actually referenced object elements are only name, url and count, the three object elements are used for replacing the number in SELECT, and a new query statement is generated, so that the number of the returned object elements is reduced, and the consumption of computing resources is reduced.
In addition, whether redundant fields exist in the fields searched in the query statement or not is judged, if the redundant fields exist, field pairing is carried out according to the context, and the fields which are not used are deleted.
For example, only 5 fields are defined in the message which is finally returned to the external channel by the interface, but the field return of the full table is defined by the implementation logic query in the code, which fields in the returned SQL fields have context-dependent condition factors can be identified, and other secondary fields which are not contained in the returned message field range can be filtered.
For example, a query statement with select is:
SELECT column_name,column_num FROM table_name。
that is, two elements need to be returned, but when attribute pairing is performed according to the context semantics, it is found that there is a field column _ num that is not used in the context, and only column _ name is used, that is, there is a field that is not returned or calculated, which represents that the statement does unnecessary, and although it is not used subsequently, when the statement is executed, the data below the index is fetched from the database, and the amount of calculation is increased in the process, so that it is necessary to delete the field column _ num from the statement SELECT column _ name and column _ num according to the context semantics, so as to reduce the amount of returned data.
And if the sensitive element is the form data, judging whether the form data contains a sensitive object, and if the sensitive object exists, adjusting the message of the form according to the attribute meaning of the sensitive object.
Specifically, the remark of the large object type is read, a reasonable message size is determined by combining with an externally configured parameter, and the message of the current table is intercepted according to the reasonable message size.
Taking a table containing a text type as an example, the text is a character string with variable length, the data of 2GB text can be stored at most, the field of the text type does not directly store character data but stores a sixteen-bit long pointer, the pointer executes the character data, so the text field always occupies fixed sixteen bits, and the text field and the common field are stored separately, therefore, when writing codes, the text field is used as little as possible, and the waste of space is reduced.
Therefore, in order to reduce the problems of memory overflow and the like caused by using the text, the meaning of the statement using the table can be analyzed, the analysis mode can be a mode combining external interface configuration, internal annotation and the like, so as to determine the number of the return value of the object of the text type, and then the bottom number common to the front part of the returned data packet is reserved in a stage mode, so that the problem that the network transmission is slow due to overlarge data volume is avoided. That is, when the text type is determined, the size of the returned message is determined by combining with other configurations, and the returned data packet is cut off according to the corresponding context, so as to reduce the returned data.
As shown in fig. 2, a schematic diagram of a data packet is shown, where the size of the data packet is 1000 bytes, the data packet returned by text before the database language is modified is determined to be 200 bytes in the front part and 800 bytes in the rear part are redundant data by analyzing and processing the whole sentence and remark field of the data packet, and thus the data packet can be directly truncated, and the data in the front 200 bytes is directly left as a new data packet.
Specifically, the stage method may be a counting method, that is, a sentence is analyzed, the size of useful data is determined, rounded up, a little vacant space is reserved, then counting is performed when the packet of the text format is generated, generation is stopped when 200 bytes is generated, and a cycle of generating the data packet is directly skipped.
In addition, after the data packet is generated, a packet tail is newly arranged at a position 200 bytes from the beginning of the data packet, the 800 bytes part of the second half part is cut out of the data packet, the space of the 800 bytes part is released, and the size of the data packet is reduced to relieve the pressure of the network.
If the sensitive element is the conditional statement, extracting and tracking index value configuration of a corresponding database table, comparing the index value configuration with conditions in the conditional statement, and judging whether the conditional statement covers an index in the index value configuration.
And if the index value configuration is not covered, adding a missing index in the index configuration of the database table.
The conditional statement takes place as an example, for example, a certain statement is as follows, SELECT FROM Websites WHERE count is 'CN', and represents data whose value under the object of count is CN is queried in the Websites table. For this statement, it is necessary to determine that the Websites table does have the object of the count, and if the Websites table does not have the object of the count, the statement cannot normally operate, and the object of the count needs to be added to the table to update the data table.
In addition, the whole language can be modified in a normal way by speaking the deletion of the related part of the where.
There are also associative statements such as JOIN, which are used to JOIN rows from two or more tables. The derivation of this key is inner join, full join, etc., and a new table is obtained by associating two tables and summarizing the same elements. If the association field and the condition field in the JOIN sentence lack index configuration, the query speed is slowed, which is also an undesirable situation, and for this reason, the JOIN sentence is analyzed, for example, the sentence FROM web pages INNER JOIN _ log _ ON web pages id is access _ log _ id. The representation connects two tables of Websites and access _ log, and is realized by pointing the column of "id" in the "Websites" table to the field "site _ id" in the "access _ log" table, so that the "id" field in the "Websites" table and the "site _ id" field in the "access _ log" table are required. And if the deletion is found, adding a corresponding field for the corresponding table. After the corresponding fields are added, the JOIN statement is established, and no problem exists during execution and the execution speed is not slowed down.
Because the data in the database needs to be collected, the data needs to be imported again after the field is added, so that the data is complete, the imported data can be automatically executed once by using an own importing method of SQL (structured query language), and the data can be updated after the index adding operation aiming at the table is executed, or a prompt is given to inform a developer that the subsequent manual updating is carried out.
The method can be used in the coding process of the code, after a developer finishes one-time code updating, the code can be checked by using the method of the embodiment to find the own coding bugs, because the sql language embedded in other development languages cannot be reported by a compiler normally, and only after the code is compiled, debug is carried out by observing the query effect, which is very troublesome.
In addition, it can also be applied to the structural change of the database, for the database, there is data and structural update, such as adding index or reducing index entry, for this reason, the database language written before may be ineffective, and as the development of the past years, the code may become bloated inevitably in order to be compatible with the former version. According to the method, after the structure of the database is changed, the past database languages can be quickly and accurately modified, so that the current modified database structure is adapted, repeated work of developers is reduced, the modification range is large, omission is avoided, manual modification is avoided, modification errors and defects caused by carelessness and the like are avoided, and the function of protecting driving and navigation is achieved for later code maintenance, updating and compatibility.
The embodiment of the invention discloses a database language correction method, a database language correction device, a computer terminal and a storage medium, wherein the method comprises the following steps: scanning a database statement and identifying a sensitive element in the database statement; if the sensitive elements exist, judging whether the database language in which the sensitive elements exist meets the preset requirement or not according to the types of the sensitive elements; and if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element. After the developer writes the codes, the non-standard and dangerous contents in the database language can be easily found, the correction and the revision are carried out, the stability of the database is maintained, the code quality is improved, the later maintenance is easy, when the contents of the database are changed, the codes can be updated, the codes are in accordance with the optimal query thought of the current database, the accident potential is avoided, and the subsequent operation is convenient.
Example 2
In a second aspect, the present application further provides a database language modification apparatus, as shown in fig. 3, including:
the scanning module 10 scans database statements and identifies sensitive elements in the database statements;
the judging module 20 judges whether the database language in which the sensitive element exists meets the preset requirement according to the type of the sensitive element if the sensitive element exists;
and the correcting module 30 is used for correcting the database language by using a correcting mode corresponding to the type of the sensitive element if the database language does not meet the preset requirement.
In a third aspect, the present application further provides a computer terminal, which includes a processor and a memory, where the memory stores a computer program, and the computer program executes the database language correction method when running on the processor.
In a fourth aspect, the present application further provides a readable storage medium storing a computer program, which when executed on a processor performs the database language modification method.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, 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 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.
In addition, each functional module or unit in each embodiment of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention or a part of the technical solution that contributes to the prior art in essence can be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention.

Claims (10)

1. A database language modification method, comprising:
scanning a database statement and identifying a sensitive element in the database statement;
if the sensitive elements exist, judging whether the database language in which the sensitive elements exist meets the preset requirement or not according to the types of the sensitive elements;
and if the database language does not meet the preset requirement, modifying the database language by using a modification mode corresponding to the type of the sensitive element.
2. The database language modification method of claim 1, wherein the sensitive element comprises a conditional statement;
the step of judging whether the database language meets the preset requirement comprises the following steps:
if the sensitive element is the conditional statement, extracting and tracking index value configuration of a corresponding database table, comparing the index value configuration with conditions in the conditional statement, and judging whether the conditional statement covers an index in the index value configuration;
if the database language does not meet the preset requirement, using a modification mode corresponding to the type of the sensitive element, wherein the step of modifying the database language comprises the following steps:
and if the index value configuration is not covered, adding a missing index in the index configuration of the database table.
3. The database language correction method of claim 1, wherein the sensitive elements further comprise form data;
the step of judging whether the database language meets the preset requirement comprises the following steps:
if the sensitive element is the form data, judging whether the form data contains a sensitive object;
if the database language does not meet the preset requirement, using a modification mode corresponding to the type of the sensitive element, wherein the step of modifying the database language comprises the following steps:
and if the sensitive object exists, adjusting the message of the form data according to the attribute meaning of the sensitive object.
4. The database language correction method of claim 3, wherein the sensitive object comprises a large object type;
according to the attribute meaning of the sensitive object, the adjustment of the form data message comprises the following steps:
reading the remarks of the large object types, determining the size of the message returning the form data by combining with externally configured parameters, and intercepting the current message of the form according to the size of the message.
5. The database language modification method of claim 1, wherein the sensitive elements further comprise query statements:
and if the sensitive element is the query statement, judging whether the query statement meets the specification, and if not, correspondingly correcting the query statement through the name of a data table associated with the query statement.
6. The database language modification method of claim 5, wherein the query statement comprises a selection statement;
the judging whether the selection statement conforms to the specification comprises:
searching whether the database language has wildcard characters, if yes, determining that the database language does not have wildcard characters;
correspondingly correcting the query statement by the name of the data table associated with the query statement comprises the following steps:
and identifying a structural mapping class object of the table returned by the database language through the name of the data table, and replacing the wildcard character according to the mapping class object.
7. The database language modification method according to claim 6, wherein the determining whether the query statement conforms to a specification further comprises:
and judging whether the field queried in the query statement has redundant parts, if so, performing field pairing according to the context, and deleting the unused field.
8. A database language correction apparatus, comprising:
the scanning module is used for scanning the database statement and identifying the sensitive elements in the database statement;
the judging module is used for judging whether the database language in which the sensitive element is positioned meets the preset requirement or not according to the type of the sensitive element if the sensitive element exists;
and the correction module is used for modifying the database language by using a modification mode corresponding to the type of the sensitive element if the database language does not meet the preset requirement.
9. A computer terminal, characterized in that it comprises a processor and a memory, said memory storing a computer program which, when run on said processor, executes the database language correction method of any one of claims 1 to 7.
10. A readable storage medium, characterized in that it stores a computer program which, when run on a processor, performs the database language correction method of any one of claims 1 to 7.
CN202210731297.3A 2022-06-24 2022-06-24 Database language correction method, device, computer terminal and storage medium Pending CN115080591A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210731297.3A CN115080591A (en) 2022-06-24 2022-06-24 Database language correction method, device, computer terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210731297.3A CN115080591A (en) 2022-06-24 2022-06-24 Database language correction method, device, computer terminal and storage medium

Publications (1)

Publication Number Publication Date
CN115080591A true CN115080591A (en) 2022-09-20

Family

ID=83256015

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210731297.3A Pending CN115080591A (en) 2022-06-24 2022-06-24 Database language correction method, device, computer terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115080591A (en)

Similar Documents

Publication Publication Date Title
CN107247707B (en) Enterprise association relation information extraction method and device based on completion strategy
CN107644323B (en) Intelligent auditing system for business flow
CN106897343B (en) Searching method, storing method and device for execution plan
US20110202331A1 (en) Method and software for extracting chemical data
CN111475525A (en) Desensitization method based on structured query language and related equipment thereof
US8103661B2 (en) Searching for a business name in a database
US20180081861A1 (en) Smart document building using natural language processing
US20120158742A1 (en) Managing documents using weighted prevalence data for statements
WO2020206840A1 (en) Code translation method and apparatus, computer device, and storage medium
CN113110866A (en) Method and device for evaluating database change script
CN112148281A (en) Intent-based machine programming
CN114385763A (en) Data blood margin analysis method, device and system and readable storage medium
CN116226170A (en) Database statement conversion method and device, electronic equipment and storage medium
CN113778852B (en) Code analysis method based on regular expression
CN112182637A (en) Safety control system, method, device and storage medium
CN114385679A (en) Meter structure inspection method, meter structure inspection device and electronic equipment
KR20060043583A (en) Compression of logs of language data
US20060020916A1 (en) Automatic Derivation of Morphological, Syntactic, and Semantic Meaning from a Natural Language System Using a Monte Carlo Markov Chain Process
US20030084041A1 (en) Programmer's dynamic spellchecker
US20020129066A1 (en) Computer implemented method for reformatting logically complex clauses in an electronic text-based document
CN115080591A (en) Database language correction method, device, computer terminal and storage medium
CN110674033A (en) Method, device and equipment for processing code and storage medium
CN112733517B (en) Method for checking requirement template conformity, electronic equipment and storage medium
US5857070A (en) Method for locating errors in a computer program
CN111581950B (en) Method for determining synonym names and method for establishing knowledge base of synonym names

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