CN107844425A - A kind of database statement inspection method and device - Google Patents

A kind of database statement inspection method and device Download PDF

Info

Publication number
CN107844425A
CN107844425A CN201711135570.1A CN201711135570A CN107844425A CN 107844425 A CN107844425 A CN 107844425A CN 201711135570 A CN201711135570 A CN 201711135570A CN 107844425 A CN107844425 A CN 107844425A
Authority
CN
China
Prior art keywords
database
inspection
script
database script
preset rules
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
CN201711135570.1A
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201711135570.1A priority Critical patent/CN107844425A/en
Publication of CN107844425A publication Critical patent/CN107844425A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/366Software debugging using diagnostics
    • 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

Landscapes

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

Abstract

The application provides a kind of database statement inspection method and device, method passes through after target database script is got, the target database script is checked according to pre-stored database script inspection rule, and outgoing inspection result, it is achieved thereby that the automatic inspection of target database script, improves database inspection script and checks efficiency.

Description

A kind of database statement inspection method and device
Technical field
The present invention relates to technical field of data processing, and in particular to a kind of database statement inspection method and device.
Background technology
Database is a part essential in system constructing, and with the huge explosion of information age, various information pavings Canopy, information content, information scale are all growing day by day, the requirement more and more higher to database manipulation.In database manipulation language In the development process of sentence, some nibs may infinitely amplify, and ultimately result in system and the problem of serious occur.
In the structure of the large scale system of enterprise-level, because it is in large scale, participant is numerous, system iteration frequently, exploitation Proficiency differs, and causes the problems such as performance, grammer in data base manipulation statement development process unavoidably be present, and program review according to Taken time and effort by manpower, check that efficiency is low.
Therefore, how to improve and check that the efficiency of database statement turns into those skilled in the art's technical problem urgently to be resolved hurrily One of.
The content of the invention
In view of this, the embodiment of the present invention provides a kind of database statement inspection method and device, to improve database language The inspection efficiency of sentence.
To achieve the above object, the embodiment of the present invention provides following technical scheme:
A kind of database statement inspection method, including:
Obtain the database script of target database to be detected;
Obtain pre-stored database script and check rule;
Calling is examined with the database script inspection rule that the database script matches to the database script Look into, judge that database script coding whether there is problem, and outgoing inspection result.
Preferably, in above-mentioned database statement inspection method, the database pin for obtaining target database to be detected This, specifically includes:
The number of targets that user selects is obtained by way of input directory, the single script file of input or input SQL statement According to the database script in storehouse, or obtain the database script of one or more target databases under the catalogue of user's input.
Preferably, in above-mentioned database statement inspection method, the data are called in the rule storage unit by inspection The database script inspection rule that storehouse script matches is checked the database script, and outgoing inspection result, specifically Including:
The first preset rules in the inspection rule storage unit are obtained, are obtained according to the first preset rules inspection To target database database script in whether there is the carriage return character, if it is, exporting the database script includes carriage return The particular location of the sentence of symbol;
The second preset rules in the inspection rule storage unit are obtained, are obtained according to the second preset rules inspection To target database database script in insert, select, merge whether meet specification, if not, output be not inconsistent Close insert, select, merge of specification particular location;
The 3rd preset rules in the inspection rule storage unit are obtained, are obtained according to the 3rd preset rules inspection To target database database script in insert, update, merge insertion, modification data item whether with present count It is consistent according to the field definition type in the table of storehouse, if inconsistent, export insert, update, merge insertion, modification number According to the particular location of item;
The 4th preset rules in the inspection rule storage unit are obtained, are obtained according to the 4th preset rules inspection To target database database script in off-balancesheet key whether establish index, if do not indexed, export off-balancesheet key tool Body position;
The 5th preset rules in the inspection rule storage unit are obtained, are obtained according to the 5th preset rules inspection The database script index implementation status of the target database arrived, export the particular location for the index that can not effectively perform;
The 6th preset rules in the inspection rule storage unit are obtained, are obtained according to the 6th preset rules inspection The database script table implementation status of the target database arrived, export the specific position for the database script table that can not effectively perform Put;
The 7th preset rules in the inspection rule storage unit are obtained, are obtained according to the 7th preset rules inspection To target database database script in whether include the operation of big data table that is imposed a condition to satisfaction, if it is, Export the particular location of the position of the big data table and the database script to the big data table handling;
The 7th preset rules in the inspection rule storage unit are obtained, target is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in database script, if it is, the particular location for the SQL statement that output is not submitted.
Preferably, in above-mentioned database statement inspection method, get the target database database script it Afterwards, before being checked according to database script inspection rule the database script, in addition to:
The database script is parsed, obtains the information of each part of SQL statement.
Preferably, in above-mentioned database statement inspection method, after outgoing inspection result, in addition to:
Show the database script of the target database and the inspection result of Data Check Unit.
Preferably, in above-mentioned database statement inspection method, the database script of the display target database with And the inspection result of Data Check Unit, specifically include:
The database script of the target database is shown in the first display field, is used in the second display field to the mesh The form that mark wide area information server script is labeled shows inspection result, and marks and be unsatisfactory for the database script inspection The SQL statement of rule.
A kind of database statement check device, including:
Data acquisition unit, for obtaining the database script of target database to be detected;
Rule storage unit is checked, rule is checked for storing default database script;
Data Check Unit, for obtaining the database script of the target database, by inspection rule storage unit The database script inspection rule for calling the database script to match is checked the database script, judges data Storehouse script code whether there is problem, and outgoing inspection result.
Preferably, in above-mentioned database statement check device, the data acquisition unit, it is specifically used for:
The number of targets that user selects is obtained by way of input directory, the single script file of input or input SQL statement According to the database script in storehouse, or obtain the database script of one or more target databases under the catalogue of user's input.
Preferably, in above-mentioned database statement check device, the Data Check Unit is specifically used for:
The first preset rules in the inspection rule storage unit are obtained, are obtained according to the first preset rules inspection To target database database script in whether there is the carriage return character, if it is, exporting the database script includes carriage return The particular location of the sentence of symbol;
The second preset rules in the inspection rule storage unit are obtained, are obtained according to the second preset rules inspection To target database database script in insert, select, merge whether meet specification, if not, output be not inconsistent Close insert, select, merge of specification particular location;
The 3rd preset rules in the inspection rule storage unit are obtained, are obtained according to the 3rd preset rules inspection To target database database script in insert, update, merge insertion, modification data item whether with present count It is consistent according to the field definition type in the table of storehouse, if inconsistent, export insert, update, merge insertion, modification number According to the particular location of item;
The 4th preset rules in the inspection rule storage unit are obtained, are obtained according to the 4th preset rules inspection To target database database script in off-balancesheet key whether establish index, if do not indexed, export off-balancesheet key tool Body position;
The 5th preset rules in the inspection rule storage unit are obtained, are obtained according to the 5th preset rules inspection The database script index implementation status of the target database arrived, export the particular location for the index that can not effectively perform;
The 6th preset rules in the inspection rule storage unit are obtained, are obtained according to the 6th preset rules inspection The database script table implementation status of the target database arrived, export the specific position for the database script table that can not effectively perform Put;
The 7th preset rules in the inspection rule storage unit are obtained, are obtained according to the 7th preset rules inspection To target database database script in whether include the operation of big data table that is imposed a condition to satisfaction, if it is, Export the particular location of the position of the big data table and the database script to the big data table handling;
The 7th preset rules in the inspection rule storage unit are obtained, target is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in database script, if it is, the particular location for the SQL statement that output is not submitted.
Preferably, in above-mentioned database statement check device, Data Check Unit is specifically getting the target data After the database script in storehouse, before being checked according to database script inspection rule the database script, it is additionally operable to:
The database script is parsed, obtains the information of each part of SQL statement.
Preferably, in above-mentioned database statement check device, in addition to:
Display unit, for showing the database script of the target database and the inspection knot of Data Check Unit Fruit.
Preferably, in above-mentioned database statement check device, the display unit is specifically used for:
The database script of the target database is shown in the first display field, is used in the second display field to the mesh The form that mark wide area information server script is labeled shows inspection result, and marks and be unsatisfactory for the database script inspection The SQL statement of rule.
Based on above-mentioned technical proposal, method and apparatus provided in an embodiment of the present invention, target database script is being got Afterwards, the target database script is checked according to pre-stored database script inspection rule, and outgoing inspection result, It is achieved thereby that the automatic inspection of target database script, improves database inspection script and checks efficiency.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this The embodiment of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis The accompanying drawing of offer obtains other accompanying drawings.
Fig. 1 is a kind of schematic flow sheet of database statement inspection method disclosed in the embodiment of the present application;
Fig. 2 is a kind of structural representation of database statement check device disclosed in the embodiment of the present application.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
Be directed to check database statement by the way of the artificial examination in the prior art and caused by check that efficiency is low Problem, this application discloses a kind of database statement inspection method, and referring to Fig. 1, this method can include:
Step S101:Obtain the database script of target database to be detected;
The database script is the text of data base manipulation statement, and the data base manipulation statement is operation data The programming language in storehouse, abbreviation SQL statement.SQL is SQL (Structured Query Language), is one The programming language of kind specific purposes, is a kind of data base querying and programming language, for accessing data and inquiry, renewal With administrative relationships Database Systems;It is also the extension name of database script file simultaneously.
The database script is the database script of user's target database to be checked, the target database can To refer to that a database can also refer to multiple databases, the specific acquisition mode of the database script can foundation User's request voluntarily selects, for example, it can be by way of input directory, the single script file of input or input SQL statement Obtain, can select the database script for the database that user specifies by this way or user specifies with catalogue Multiple target databases database script.
Wherein, the input directory refers to:Obtain catalogue under all catalogues and script file, by catalogue, script file, The relation decomposing of SQL statement forms the queue of SQL statement, and preserves the information such as corresponding path, filename.
The single script file of input refers to:Parsing obtains the SQL statement in script file, preserves corresponding information.
The input SQL statement refers to:The input of multiple SQL statements is supported to parse.
Step S102:Obtain pre-stored database script and check rule;
Before method disclosed in performing the embodiment of the present application, it can pre-set for checking database statement Database script check rule, the regular particular content can enter edlin according to user's request, and its quantity can foundation User's request is deleted or increased.
For example, in technical scheme disclosed in the embodiment of the present application, the database script inspection rule can be used for:Inspection Look into SQL scripts whether containing carriage return character ^M, check SQL statement whether meet specification, check SQL data item whether with database table Field definition type is consistent, checks appearance key whether establishes index, check SQL statement index implementation status, check whether including Full table scan, check whether containing the operation to large data volume table, check whether there is the SQL statement do not submitted in database script Deng.
Step S103:The database script to match with the database script is called to check rule to the database pin This is checked, judges that database script coding whether there is problem, and outgoing inspection result;
In this step, the database script got is checked using the database script inspection rule, sentenced Whether the SQL statement of the disconnected composition database script meets specification, and outgoing inspection result.Specifically, check for convenience, In outgoing inspection as a result, it is possible to which the mode being labeled again with the SQL statement to the database script checks knot to show Fruit, in inspection result, the SQL statement for not meeting the database script inspection rule is marked out using setting means, Also, show that it does not meet database script and checks the reason for regular, certainly, the SQL statement is corrected in order to facilitate user, In inspection result, corresponding SQL statement correcting mode can also be provided.When showing inspection result, for the ease of contrast, aobvious When showing inspection result, it can specifically check in the following ways:Show the database script and data of the target database The inspection result of inspection unit.
Visible by method disclosed in the above embodiments of the present application, after target database script is got, foundation prestores The database script inspection rule of storage is checked the target database script, and outgoing inspection result, it is achieved thereby that The automatic inspection of target database script, improve database inspection script and check efficiency.
The calling is entered with the database script inspection rule that the database script matches to the database script Row checks, and outgoing inspection result, can specifically include:
When SQL statement performs in AIX (Advanced Interactive Executive) environment, it can cause comprising ^M Script performs failure, so must go to remove ^M in script.^M:Refer to the carriage return character in new line, new line in text input It is two independent individuals in the text, but Enter is directly exactly to include new line two in keyboard, when writing SQL scripts Easily carelessness and include ^M comprising the carriage return character, but during performing in AIX environment SQL statement and can then perform failure, institute So that the carriage return character can not be included.This is directed to, the calling checks rule with the database script that the database script matches The database script is checked, and outgoing inspection result, it can include:
The first preset rules in the inspection rule storage unit are obtained, are obtained according to the first preset rules inspection To target database database script in whether there is carriage return character ^M, included back if it is, exporting the database script The particular location of the sentence of car symbol, and be labeled in the SQL statement of former database script.
In database script, the form of the SQL statement has to comply with specification, specifically such as insert, select, Merge must write specific field exactly, if because do not write specific field exactly, easily cause to misplace and cause actual operation Field and desired operation field it is inconsistent, therefore, when checking database script, it is necessary to avoid this situation Generation.This is directed to, the calling checks rule to the data with the database script that the database script matches Storehouse script is checked, and outgoing inspection result, can also be included:
The second preset rules in the inspection rule storage unit are obtained, are obtained according to the second preset rules inspection To target database database script in insert, select, merge whether meet specification, if not, output be not inconsistent Insert, select, merge of specification particular location are closed, and is labeled in the SQL statement of former database script.
In database script, insert, update, merge insertion, modification data item must be with database table field definitions Type is consistent, avoids implicit conversion and mistake when database can not perform conversion;Assignment data is unable to overlength;Assignment data is not Can be sky.Literary name section defines type, including numeric type, character type, date type etc. in the database.Implicit conversion:Refer to input The field type of data and the field type that database table defines are inconsistent in database, and are forced in database aspect The operation of conversion.After performing this operation, index can not be performed when can cause database performance consumption increase, and be related to index field And database performance is largely expended, or even make database interim card.This is directed to, the calling matches with the database script Database script inspection rule check that the database script and outgoing inspection result can also include:
The 3rd preset rules in the inspection rule storage unit are obtained, are obtained according to the 3rd preset rules inspection To target database database script in insert, update, merge insertion, modification data item whether with present count It is consistent according to the field definition type in the table of storehouse, if inconsistent, export insert, update, merge insertion, modification number According to the particular location of item, and it is labeled in the SQL statement of former database script.
External key illustrates the dependency relation between two master-salve tables, and the table of major key is used as using the external key of another relation Referred to as main table, have this external key table be referred to as main table from table.Indexed in database script, it is necessary to be established to off-balancesheet key, if When external key does not establish index, it can cause database in the process of implementation because table handling where external key slowly influences itself table number According to operation.On the other hand, the calling checks rule to the database pin with the database script that the database script matches This is checked, and outgoing inspection result, can also be included:
The 4th preset rules in the inspection rule storage unit are obtained, are obtained according to the 4th preset rules inspection To target database database script in off-balancesheet key whether establish index, if do not indexed, export off-balancesheet key tool Body position.
When checking database script, it is also necessary to check that the index implementation status of each bar SQL statement, including SQL statement are It is no to perform index, by the index in execution that indexes whether the invalid index such as global index, quick global index.If can not The correct effectively index that performs will cause database execution slow.On the other hand, what the calling matched with the database script Database script inspection rule is checked the database script, and outgoing inspection result, can also be included:
The 5th preset rules in the inspection rule storage unit are obtained, are obtained according to the 5th preset rules inspection The database script index implementation status of the target database arrived, export the particular location for the index that can not effectively perform.
When checking database script, it is also necessary to check the implementation status of SQL statement table, including the whether full table scan of table (referring to all data in operation table), whether table data correlation span has diminution.Optimize span as far as possible, it is minimum Association value, it is smaller to database performance consumption.On the other hand, the database pin that the calling matches with the database script This inspection rule is checked the database script, and outgoing inspection result, can also be included:
The 6th preset rules in the inspection rule storage unit are obtained, are obtained according to the 6th preset rules inspection The database script table implementation status of the target database arrived, export the specific position for the database script table that can not effectively perform Put;
When checking database script, it is also necessary to the operation whether having in SQL statement to large data volume table is checked, due to big The table handling of data volume can a large amount of consumption data storehouses performance, perform other situations such as time so needing to pay close attention to, need to additionally close Note.On the other hand, the calling is entered with the database script inspection rule that the database script matches to the database script Row checks, and outgoing inspection result, can also include:
The 7th preset rules in the inspection rule storage unit are obtained, are obtained according to the 7th preset rules inspection To target database database script in whether include the operation of big data table that is imposed a condition to satisfaction, if it is, Export the particular location of the position of the big data table and the database script to the big data table handling;
When checking database script, it is also necessary to check whether to have in database script and do not submit SQL statement, do not submit SQL statement is not performed.On the other hand, the calling checks that rule is right with the database script that the database script matches The database script is checked, and outgoing inspection result, can also be included:
The 7th preset rules in the inspection rule storage unit are obtained, target is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in database script, if it is, the particular location for the SQL statement that output is not submitted.
In technical scheme disclosed in the above embodiments of the present application, when checking database script, different SQL types Sentence is needed to be checked using disparate databases script inspection rule, therefore, matched calling with the database script Database script inspection rule the database script is checked before, in scheme disclosed in the above embodiments of the present application Also include:
The database script is parsed, obtains the information of each part of SQL statement.Specifically, pass through Analytical decomposition is carried out to the structure of the SQL statement of acquisition, obtains the information of each part of SQL statement, including table information, Conditional statement information, incidence relation information, parameter information, operation field information etc..
In the present embodiment, corresponding to the above method, disclosed herein as well is a kind of database statement check device, composition should The specific works content of the unit of device, the content of above method embodiment is referred to,
The database statement check device provided below the embodiment of the present application is described, database language described below Sentence check device can be mutually to should refer to database described above sentence inspection method.
Referring to Fig. 2, the database statement check device can include:
Data acquisition unit 100, for obtaining the database script of target database to be detected, the unit can be applied In the database layer of computer system, List name and attribute specifically for obtaining target database, table index information is obtained, Storing process information is obtained, obtains major key foreign key information, obtains executive plan information;
Rule storage unit 200 is checked, rule is checked for storing default database script;
Data Check Unit 300, for obtaining the database script of the target database, by inspection rule storage unit The middle database script inspection rule for calling the database script to match is checked the database script, judges number It whether there is problem, and outgoing inspection result according to storehouse script code.The Data Check Unit 300 can apply to department of computer science The application layer of system, it is specifically used for parsing database script, obtains SQL statement and its replicates parameter type, to the SQL statement Parsed, obtain parameter and the conditional information that the SQL statement is included, checking that rule is right using the database script The parameter and conditional information are checked, obtain inspection result.
It is corresponding with the above method, the data acquisition unit, it is specifically used for:
The number of targets that user selects is obtained by way of input directory, the single script file of input or input SQL statement According to the database script in storehouse, or obtain the database script of one or more target databases under the catalogue of user's input.
Corresponding with the above method, the Data Check Unit is specifically used for:
The first preset rules in the inspection rule storage unit are obtained, are obtained according to the first preset rules inspection To target database database script in whether there is the carriage return character, if it is, exporting the database script includes carriage return The particular location of the sentence of symbol;
The second preset rules in the inspection rule storage unit are obtained, are obtained according to the second preset rules inspection To target database database script in insert, select, merge whether meet specification, if not, output be not inconsistent Close insert, select, merge of specification particular location;
The 3rd preset rules in the inspection rule storage unit are obtained, are obtained according to the 3rd preset rules inspection To target database database script in insert, update, merge insertion, modification data item whether with present count It is consistent according to the field definition type in the table of storehouse, if inconsistent, export insert, update, merge insertion, modification number According to the particular location of item;
The 4th preset rules in the inspection rule storage unit are obtained, are obtained according to the 4th preset rules inspection To target database database script in off-balancesheet key whether establish index, if do not indexed, export off-balancesheet key tool Body position;
The 5th preset rules in the inspection rule storage unit are obtained, are obtained according to the 5th preset rules inspection The database script index implementation status of the target database arrived, export the particular location for the index that can not effectively perform;
The 6th preset rules in the inspection rule storage unit are obtained, are obtained according to the 6th preset rules inspection The database script table implementation status of the target database arrived, export the specific position for the database script table that can not effectively perform Put;
The 7th preset rules in the inspection rule storage unit are obtained, are obtained according to the 7th preset rules inspection To target database database script in whether include the operation of big data table that is imposed a condition to satisfaction, if it is, Export the particular location of the position of the big data table and the database script to the big data table handling;
The 7th preset rules in the inspection rule storage unit are obtained, target is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in database script, if it is, the particular location for the SQL statement that output is not submitted.
It is corresponding with the above method, Data Check Unit specifically get the target database database script it Afterwards, before being checked according to database script inspection rule the database script, it is additionally operable to:
The database script is parsed, obtains the information of each part of SQL statement.
Corresponding with the above method, said apparatus also includes:
Display unit, for showing the database script of the target database and the inspection knot of Data Check Unit Fruit.
Corresponding with the above method, the display unit is specifically used for:
The database script of the target database is shown in the first display field, is used in the second display field to the mesh The form that mark wide area information server script is labeled shows inspection result, and marks and be unsatisfactory for the database script inspection The SQL statement of rule.
For convenience of description, it is divided into various modules during description system above with function to describe respectively.Certainly, this is being implemented The function of each module can be realized in same or multiple softwares and/or hardware during application.
Each embodiment in this specification is described by the way of progressive, identical similar portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.Especially for system or For system embodiment, because it is substantially similar to embodiment of the method, so describing fairly simple, related part is referring to method The part explanation of embodiment.System and system embodiment described above is only schematical, wherein the conduct The unit that separating component illustrates can be or may not be it is physically separate, can be as the part that unit is shown or Person may not be physical location, you can with positioned at a place, or can also be distributed on multiple NEs.Can root Factually border needs to select some or all of module therein realize the purpose of this embodiment scheme.Ordinary skill Personnel are without creative efforts, you can to understand and implement.
Professional further appreciates that, with reference to the unit of each example of the embodiments described herein description And algorithm steps, can be realized with electronic hardware, computer software or the combination of the two, in order to clearly demonstrate hardware and The interchangeability of software, the composition and step of each example are generally described according to function in the above description.These Function is performed with hardware or software mode actually, application-specific and design constraint depending on technical scheme.Specialty Technical staff can realize described function using distinct methods to each specific application, but this realization should not Think beyond the scope of this invention.
Directly it can be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processor Capable software module, or the two combination are implemented.Software module can be placed in random access memory (RAM), internal memory, read-only deposit Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology In any other form of storage medium well known in field.
It should also be noted that, herein, such as first and second or the like relational terms are used merely to one Entity or operation make a distinction with another entity or operation, and not necessarily require or imply between these entities or operation Any this actual relation or order be present.Moreover, term " comprising ", "comprising" or its any other variant are intended to contain Lid nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that Other identical element also be present in process, method, article or equipment including the key element.
The foregoing description of the disclosed embodiments, professional and technical personnel in the field are enable to realize or using the present invention. A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, it is of the invention The embodiments shown herein is not intended to be limited to, and is to fit to and principles disclosed herein and features of novelty phase one The most wide scope caused.

Claims (12)

  1. A kind of 1. database statement inspection method, it is characterised in that including:
    Obtain the database script of target database to be detected;
    Obtain pre-stored database script and check rule;
    Calling is checked the database script with the database script inspection rule that the database script matches, and is sentenced Disconnected database script coding whether there is problem, and outgoing inspection result.
  2. 2. database statement inspection method according to claim 1, it is characterised in that described to obtain number of targets to be detected According to the database script in storehouse, specifically include:
    The target database that user selects is obtained by way of input directory, the single script file of input or input SQL statement Database script, or obtain user input catalogue under one or more target databases database script.
  3. 3. database statement inspection method according to claim 1, it is characterised in that described by inspection rule storage unit The middle database script inspection rule for calling the database script to match is checked the database script, and is exported Inspection result, specifically include:
    The first preset rules in the inspection rule storage unit are obtained, are got according to the first preset rules inspection It whether there is the carriage return character in the database script of target database, if it is, exporting the database script includes the carriage return character The particular location of sentence;
    The second preset rules in the inspection rule storage unit are obtained, are got according to the second preset rules inspection Whether insert, select, merge in the database script of target database meet specification, if not, output does not meet rule Insert, select, merge of model particular location;
    The 3rd preset rules in the inspection rule storage unit are obtained, are got according to the 3rd preset rules inspection In the database script of target database insert, update, merge insertion, modification data item whether with presetting database Field definition type in table is consistent, if inconsistent, exports insert, update, merge insertion, modification data item Particular location;
    The 4th preset rules in the inspection rule storage unit are obtained, are got according to the 4th preset rules inspection Whether the off-balancesheet key in the database script of target database establishes index, if do not indexed, exports the specific position of off-balancesheet key Put;
    The 5th preset rules in the inspection rule storage unit are obtained, are got according to the 5th preset rules inspection The database script index implementation status of target database, export the particular location for the index that can not effectively perform;
    The 6th preset rules in the inspection rule storage unit are obtained, are got according to the 6th preset rules inspection The database script table implementation status of target database, export the particular location for the database script table that can not effectively perform;
    The 7th preset rules in the inspection rule storage unit are obtained, are got according to the 7th preset rules inspection Whether the operation of the big data table that to satisfaction imposes a condition is included in the database script of target database, if it is, output The position of the big data table and the particular location of database script to the big data table handling;
    The 7th preset rules in the inspection rule storage unit are obtained, target data is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in the script of storehouse, if it is, the particular location for the SQL statement that output is not submitted.
  4. 4. database statement inspection method according to claim 1, it is characterised in that getting the target database Database script after, before checking the database script according to database script inspection rule, in addition to:
    The database script is parsed, obtains the information of each part of SQL statement.
  5. 5. database statement inspection method according to claim 1, it is characterised in that after outgoing inspection result, also wrap Include:
    Show the database script of the target database and the inspection result of Data Check Unit.
  6. 6. database statement inspection method according to claim 5, it is characterised in that the display target database Database script and Data Check Unit inspection result, specifically include:
    The database script of the target database is shown in the first display field, is used in the second display field to the number of targets The form being labeled according to the database script in storehouse shows inspection result, and marks and be unsatisfactory for the database script inspection rule SQL statement.
  7. A kind of 7. database statement check device, it is characterised in that including:
    Data acquisition unit, for obtaining the database script of target database to be detected;
    Rule storage unit is checked, rule is checked for storing default database script;
    Data Check Unit, for obtaining the database script of the target database, by being called in inspection rule storage unit The database script inspection rule that the database script matches is checked the database script, judges database pin This coding whether there is problem, and outgoing inspection result.
  8. 8. database statement check device according to claim 7, it is characterised in that the data acquisition unit, specifically For:
    The target database that user selects is obtained by way of input directory, the single script file of input or input SQL statement Database script, or obtain user input catalogue under one or more target databases database script.
  9. 9. database statement check device according to claim 7, it is characterised in that the Data Check Unit is specifically used In:
    The first preset rules in the inspection rule storage unit are obtained, are got according to the first preset rules inspection It whether there is the carriage return character in the database script of target database, if it is, exporting the database script includes the carriage return character The particular location of sentence;
    The second preset rules in the inspection rule storage unit are obtained, are got according to the second preset rules inspection Whether insert, select, merge in the database script of target database meet specification, if not, output does not meet rule Insert, select, merge of model particular location;
    The 3rd preset rules in the inspection rule storage unit are obtained, are got according to the 3rd preset rules inspection In the database script of target database insert, update, merge insertion, modification data item whether with presetting database Field definition type in table is consistent, if inconsistent, exports insert, update, merge insertion, modification data item Particular location;
    The 4th preset rules in the inspection rule storage unit are obtained, are got according to the 4th preset rules inspection Whether the off-balancesheet key in the database script of target database establishes index, if do not indexed, exports the specific position of off-balancesheet key Put;
    The 5th preset rules in the inspection rule storage unit are obtained, are got according to the 5th preset rules inspection The database script index implementation status of target database, export the particular location for the index that can not effectively perform;
    The 6th preset rules in the inspection rule storage unit are obtained, are got according to the 6th preset rules inspection The database script table implementation status of target database, export the particular location for the database script table that can not effectively perform;
    The 7th preset rules in the inspection rule storage unit are obtained, are got according to the 7th preset rules inspection Whether the operation of the big data table that to satisfaction imposes a condition is included in the database script of target database, if it is, output The position of the big data table and the particular location of database script to the big data table handling;
    The 7th preset rules in the inspection rule storage unit are obtained, target data is checked according to the 7th preset rules With the presence or absence of the SQL statement do not submitted in the script of storehouse, if it is, the particular location for the SQL statement that output is not submitted.
  10. 10. database statement check device according to claim 7, it is characterised in that Data Check Unit is specifically obtaining After the database script for getting the target database, check that rule is carried out to the database script according to database script Before inspection, it is additionally operable to:
    The database script is parsed, obtains the information of each part of SQL statement.
  11. 11. database statement check device according to claim 7, it is characterised in that also include:
    Display unit, for showing the database script of the target database and the inspection result of Data Check Unit.
  12. 12. database statement check device according to claim 11, it is characterised in that the display unit is specifically used In:
    The database script of the target database is shown in the first display field, is used in the second display field to the number of targets The form being labeled according to the database script in storehouse shows inspection result, and marks and be unsatisfactory for the database script inspection rule SQL statement.
CN201711135570.1A 2017-11-16 2017-11-16 A kind of database statement inspection method and device Pending CN107844425A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711135570.1A CN107844425A (en) 2017-11-16 2017-11-16 A kind of database statement inspection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711135570.1A CN107844425A (en) 2017-11-16 2017-11-16 A kind of database statement inspection method and device

Publications (1)

Publication Number Publication Date
CN107844425A true CN107844425A (en) 2018-03-27

Family

ID=61679549

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711135570.1A Pending CN107844425A (en) 2017-11-16 2017-11-16 A kind of database statement inspection method and device

Country Status (1)

Country Link
CN (1) CN107844425A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446100A (en) * 2018-11-12 2019-03-08 郑州云海信息技术有限公司 The method and apparatus of the script file of management equipment
CN109460395A (en) * 2018-09-11 2019-03-12 浙江众合科技股份有限公司 A kind of signal maintenance system database multilingual information storage system and method
CN110413641A (en) * 2019-07-15 2019-11-05 苏州浪潮智能科技有限公司 A kind of database Caton processing method and device
CN110990284A (en) * 2019-12-09 2020-04-10 中国建设银行股份有限公司 Database standard checking method and device
CN111552698A (en) * 2020-04-21 2020-08-18 重庆富民银行股份有限公司 SQL version control system and method for solving environmental difference
CN111651364A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 SQL (structured query language) checking method and device under parallel development
CN111752923A (en) * 2020-06-28 2020-10-09 中国银行股份有限公司 Script monitoring method and device
CN111881017A (en) * 2020-06-24 2020-11-03 北京极简智能科技有限公司 Method and device for automatically evaluating SQL target code segment
CN111984536A (en) * 2020-08-17 2020-11-24 四川爱创科技有限公司 Equipment automation test system
WO2020259391A1 (en) * 2019-06-26 2020-12-30 深圳前海微众银行股份有限公司 Database script performance testing method and device
CN113138974A (en) * 2021-04-23 2021-07-20 建信金融科技有限责任公司 Database compliance detection method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053961A (en) * 2009-10-27 2011-05-11 中兴通讯股份有限公司 Method and device for SQL statements and system for improving database reliability
CN102073640A (en) * 2009-11-19 2011-05-25 阿里巴巴集团控股有限公司 Method, system and server for testing structured query language (SQL) statements
US20150081667A1 (en) * 2009-12-23 2015-03-19 Pivotal Software, Inc. Apparatus and method for analyzing query optimizer performance
CN105912594A (en) * 2016-04-05 2016-08-31 深圳市深信服电子科技有限公司 SQL sentence processing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102053961A (en) * 2009-10-27 2011-05-11 中兴通讯股份有限公司 Method and device for SQL statements and system for improving database reliability
CN102073640A (en) * 2009-11-19 2011-05-25 阿里巴巴集团控股有限公司 Method, system and server for testing structured query language (SQL) statements
US20150081667A1 (en) * 2009-12-23 2015-03-19 Pivotal Software, Inc. Apparatus and method for analyzing query optimizer performance
CN105912594A (en) * 2016-04-05 2016-08-31 深圳市深信服电子科技有限公司 SQL sentence processing method and system

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109460395A (en) * 2018-09-11 2019-03-12 浙江众合科技股份有限公司 A kind of signal maintenance system database multilingual information storage system and method
CN109446100A (en) * 2018-11-12 2019-03-08 郑州云海信息技术有限公司 The method and apparatus of the script file of management equipment
CN109446100B (en) * 2018-11-12 2022-06-07 郑州云海信息技术有限公司 Method and device for managing script file of equipment
WO2020259391A1 (en) * 2019-06-26 2020-12-30 深圳前海微众银行股份有限公司 Database script performance testing method and device
CN110413641A (en) * 2019-07-15 2019-11-05 苏州浪潮智能科技有限公司 A kind of database Caton processing method and device
CN110990284A (en) * 2019-12-09 2020-04-10 中国建设银行股份有限公司 Database standard checking method and device
CN111552698A (en) * 2020-04-21 2020-08-18 重庆富民银行股份有限公司 SQL version control system and method for solving environmental difference
CN111881017A (en) * 2020-06-24 2020-11-03 北京极简智能科技有限公司 Method and device for automatically evaluating SQL target code segment
CN111752923A (en) * 2020-06-28 2020-10-09 中国银行股份有限公司 Script monitoring method and device
CN111651364A (en) * 2020-07-01 2020-09-11 中国银行股份有限公司 SQL (structured query language) checking method and device under parallel development
CN111651364B (en) * 2020-07-01 2023-04-28 中国银行股份有限公司 SQL (structured query language) checking method and device under parallel development
CN111984536A (en) * 2020-08-17 2020-11-24 四川爱创科技有限公司 Equipment automation test system
CN113138974A (en) * 2021-04-23 2021-07-20 建信金融科技有限责任公司 Database compliance detection method and device
CN113138974B (en) * 2021-04-23 2023-08-22 建信金融科技有限责任公司 Method and device for detecting database compliance

Similar Documents

Publication Publication Date Title
CN107844425A (en) A kind of database statement inspection method and device
US11392558B2 (en) System and method for extracting a star schema from tabular data for use in a multidimensional database environment
US9811604B2 (en) Method and system for defining an extension taxonomy
CN101878461B (en) Method and system for analysis of system for matching data records
US7117430B2 (en) Spreadsheet error checker
US7822795B2 (en) Apparatus and methods for displaying and determining dependency relationships among subsystems in a computer software system
US7519585B2 (en) Selection context filtering
US7318162B2 (en) Computer-implemented system and method for managing data integrity validation rules
US9123024B2 (en) System for analyzing security compliance requirements
US8423586B2 (en) XBRL service system and method
US10585981B2 (en) Method of data capture, storage and retrieval through user created form templates and data item templates by executing computer-executable instructions stored on a non-transitory computer-readable medium
Hogan A practical guide to database design
US6760734B1 (en) Framework for storing metadata in a common access repository
US9940182B1 (en) Business rule engine validation systems and related methods
US20140280026A1 (en) Method and Structure for Managing Multiple Electronic Forms and Their Records Using a Static Database
US7197696B1 (en) System, method and computer program product to populate data into spreadsheets and execute functions and programs within the same
Dakrory et al. Automated ETL testing on the data quality of a data warehouse
Scaffidi et al. Intelligently creating and recommending reusable reformatting rules
US20160179476A1 (en) Method Of Operating A Software Engine For Storing, Organizing And Reporting Data In An Organizational Environment Through User Created Templates And Data Items By Executing Computer-Executable Instructions Stored On A Non-Transitory Computer-Readable Medium
US11704094B2 (en) Data integrity analysis tool
Jennings Microsoft Access 2010 in depth
Cornell Excel as your database
Scannapieco et al. IP-UML
Scannapieco et al. Ip-Uml: A Methodology for Quality Improvement Based on Information Product Maps and Unified Modeling Language
Wilder DATA MANAGEMENT LAYER

Legal Events

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

Application publication date: 20180327