CN108241622A - The generation method and device of a kind of query script - Google Patents
The generation method and device of a kind of query script Download PDFInfo
- Publication number
- CN108241622A CN108241622A CN201611204520.XA CN201611204520A CN108241622A CN 108241622 A CN108241622 A CN 108241622A CN 201611204520 A CN201611204520 A CN 201611204520A CN 108241622 A CN108241622 A CN 108241622A
- Authority
- CN
- China
- Prior art keywords
- data
- back end
- row
- parsing tree
- judge
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/242—Query formulation
- G06F16/2433—Query languages
- G06F16/244—Grouping and aggregation
Abstract
The invention discloses the generation methods and device of a kind of query script, are related to field of computer technology, and main purpose is to improve the query performance of database.The method includes:Receive the query argument of input;Obtain the metadata for describing data attribute;According to the query argument and the metadata structural analysis tree, the parsing tree has multiple back end;Judge whether each back end of the parsing tree meets preset polymerization condition;If it is, the back end for meeting preset polymerization condition is polymerize;Query script is generated according to the parsing tree after the polymerization.Present invention is mainly used for the generations of query script.
Description
Technical field
The present invention relates to computer realm, the generation method and device of especially a kind of query script.
Background technology
Database is to come tissue, storage and the warehouse for managing data according to data structure, type that there are many kinds of databases, from
The simplest table for being stored with various data is to can carry out the large-scale database system of mass data storage all in each side
Face is widely used, such as data query, generation database is needed to hold when the progress data query in software systems
The script of row inquiry operation, and then data query is realized by the query script of generation.
The query script generating mode of the prior art is mainly by generating the component of corresponding function, and then input in assembly
Query argument generation database performs the script of inquiry operation.However it is poly- to be related to grouping during query script is generated
Closing operation, and the operation of the packet aggregation is the last one step execution in script is generated, since packet aggregation operates
It needs the inquiry row not in aggregate function being all added in database script packet syntax so that database packet syntax
In alternative column it is excessive, the query performance for leading to database is poor.
Invention content
In view of the above problems, it is proposed that the present invention overcomes the above problem in order to provide one kind or solves at least partly
The generation method and device of a kind of script of problem are stated, the query performance of database can be improved.
On the one hand, the present invention provides a kind of generation method of query script, including:
Receive the query argument of input;
Obtain the metadata for describing data attribute;According to the query argument and the metadata structural analysis tree,
The parsing tree has multiple back end;
Judge whether each back end of the parsing tree meets preset polymerization condition;
If it is, the back end for meeting preset polymerization condition is polymerize;
Query script is generated according to the parsing tree after the polymerization.
Further, the back end of the parsing tree is corresponding with tables of data, the every number for judging the parsing tree
Include according to whether node meets preset polymerization condition:
The corresponding tables of data of the back end is obtained, and determines the inquiry row of the tables of data;
Judge to arrange with the presence or absence of index in the inquiry row, the row that the index row reference and data calculate;
If it is, judge that the back end meets preset polymerization condition;Otherwise, judge that the back end is not met
Preset polymerization condition.
Further, after being arranged in judging the inquiry row there are index, judging that it is default that the back end meets
Before polymerizing condition, the method further includes:
Obtain the data for including packet syntax field;
Judge that the data comprising packet syntax field whether there is in the corresponding tables of data of the back end;
If it is, judge that the back end meets preset polymerization condition;Otherwise, judge that the back end is not met
Preset polymerization condition.
Further, it is present in the corresponding data of the back end in the judgement data comprising packet syntax field
After in table, before judging that the back end meets preset polymerization condition, the method further includes:
Judge whether the inquiry row in the inquiry row in addition to index arranges include the packet syntax field;
If it is, judge that the back end meets preset polymerization condition;Otherwise, judge that the back end is not met
Preset polymerization condition.
Further, before the back end for meeting preset polymerization condition is polymerize, the method further includes:
Obtain the field for identifying whether that data aggregate can be carried out in the parsing tree;
Identify whether that the field that can carry out data aggregate is configured to carry out data aggregate by described;
The parsing tree generation query script according to after the polymerization includes:
Read the data information in the corresponding tables of data of each back end in the parsing tree after the polymerization;
Default template file is written into the data information, generates the query script.
On the other hand, the present invention provides a kind of generating means of query script, including:
Receiving unit, for receiving the query argument of input;
First acquisition unit, for obtaining the metadata for describing data attribute;
Structural unit, for according to the query argument and the metadata structural analysis tree, the parsing tree to have more
A back end;
Whether judging unit, each back end for judging the parsing tree meet preset polymerization condition;
Polymerized unit if each back end for the parsing tree meets preset polymerization condition, will meet pre-
If the back end of polymerizing condition is polymerize;
Generation unit, for generating query script according to the parsing tree after the polymerization.
Further, the back end of the parsing tree is corresponding with tables of data, and the judging unit includes:First obtains mould
Block for obtaining the corresponding tables of data of the back end, and determines the inquiry row of the tables of data;
First judgment module, for judging to arrange with the presence or absence of index in the inquiry row, the index row reference and data
The row of calculating;
First judgment module, if be additionally operable in the inquiry row, there are index row, judge the back end
Meet preset polymerization condition;
First judgment module, if be additionally operable in the inquiry row, there is no indexs to arrange, and judges the data section
Point does not meet preset polymerization condition.
Further, the judging unit further includes:
Second acquisition module, for after being arranged in judging the inquiry row there are index, judging the back end
Before meeting preset polymerization condition, the data for including packet syntax field are obtained;
Second judgment module, for judging that the data comprising packet syntax field whether there is in the back end
In corresponding tables of data;
Second judgment module, if being additionally operable to the data comprising packet syntax field is present in the data section
In the corresponding tables of data of point, then judge that the back end meets preset polymerization condition;
Second judgment module, if being additionally operable to the data comprising packet syntax field is not present in the data
In the corresponding tables of data of node, then judge that the back end does not meet preset polymerization condition.
Further, the judging unit further includes:
Third judgment module, for being present in the back end pair in the judgement data comprising packet syntax field
After in the tables of data answered, before judging that the back end meets preset polymerization condition, judge in the inquiry row except finger
Whether the inquiry row except mark row include the packet syntax field;
The third judgment module, if the inquiry being additionally operable in the inquiry row in addition to index arranges is arranged comprising described
Packet syntax field then judges that the back end meets preset polymerization condition;
The third judgment module, if the inquiry being additionally operable in the inquiry row in addition to index arranges is arranged not comprising described
Packet syntax field then judges that the back end does not meet preset polymerization condition.
Further, described device further includes:
Second acquisition unit, for obtaining the field for identifying whether that data aggregate can be carried out in the parsing tree;
Setting unit, for identifying whether that the field that can carry out data aggregate is configured to progress data and gathers by described
It closes;
The generation unit includes:
Read module, for reading the data in the parsing tree after the polymerization in the corresponding tables of data of each back end
Information;
Writing module for the data information to be written default template file, generates the query script.
By above-mentioned technical proposal, the generation method and device of a kind of query script provided by the invention are joined according to inquiry
Number and metadata structural analysis tree, the back end of the parsing tree here recording data information in the form of tables of data, by sentencing
Whether each data of disconnected parsing tree meet preset polymerization condition, and the back end for meeting preset polymerization condition is polymerize,
So that the parsing tree premature polymerization that will meet polymerizing condition as far as possible in the construction process of parsing tree, so according to polymerization after
Parsing tree generation query script, so as to avoid generation script when database packet syntax in inquiry columns it is excessive, influence
The query performance of database.Compared with the generation method of the query script of the prior art, the embodiment of the present invention in generation by looking into
By the parsing tree premature polymerization of qualified preset polymerization condition during inquiry script, in the query script for reducing generation
The columns of inquiry row in database packet syntax, and then improve the search efficiency of database.
Above description is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention,
And it can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, below the special specific embodiment for lifting the present invention.
Description of the drawings
By reading the detailed description of hereafter preferred embodiment, it is various other the advantages of and benefit it is common for this field
Technical staff will become clear.Attached drawing is only used for showing the purpose of preferred embodiment, and is not considered as to the present invention
Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 shows a kind of generation method flow diagram of query script provided in an embodiment of the present invention;
Fig. 2 shows the generation method flow diagrams of another query script provided in an embodiment of the present invention;
Fig. 3 shows a kind of structure diagram of parsing tree provided in an embodiment of the present invention;
Fig. 4 shows a kind of generating means structure diagram of query script provided in an embodiment of the present invention;
Fig. 5 shows the generating means structure diagram of another query script provided in an embodiment of the present invention.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
An embodiment of the present invention provides a kind of generation method flow diagram of query script, as shown in Figure 1, the method
Including:
101st, the query argument of input is received.
Wherein, the query argument that query argument is constructed for the business information in database, parameter query refer to
In some cases, inquiry that is multiple, but using different value every time can be used by needing to create, and different value is used every time to create
Inquiry, parameter can be used in queries, i.e., parameter is that the placeholder of value is provided when running and inquiring.It is inquired by obtaining
Parameter, to generate query script according to query argument and parsing tree.
102nd, the metadata for describing data attribute is obtained.
Wherein, metadata be mainly describe data attribute information, for support as be storage location, historical data,
Legend, libary catalog card and business card in the functions, such as daily life such as data-gathering, file record can be regarded as member
Data.In Relational DBMS, metadata describes the structure and meaning of data, such as is managing, safeguarding SQL
When Server either develops database application, we will often obtain some letters for being related to database schema
Breath, the index as defined on the table in some database and view number and title, some table, row in some view
Number etc..
103rd, according to the query argument and the metadata structural analysis tree.Wherein, parsing tree is the abstract of source code
The tree-shaped expression of syntactic structure, each analysis tree can include multiple back end, and each back end is represented in source code
A kind of structure, in addition, there is different hierarchical relationships up and down between different data node, a such as back end may have 1
A or multiple child nodes, can not also there are child nodes, the embodiment of the present invention to be not specifically limited.
In addition, the back end of parsing tree can in the form of tables of data recording data information, tables of data can be with table here
The form of lattice, such as dimensional table or bivariate table, the embodiment of the present invention do not limit the form of nodes records data information.
It should be noted that the figure that parsing tree is constructed for database root according to the data analysis of tree construction that data structure is established
Shape needs to be grouped converging operation to the back end in parsing tree, by multiple data sections when carrying out data query
Point, which performs packet aggregation operation, can reduce the data volume handled during inquiry, effectively improve search efficiency.
104th, judge whether each back end of the parsing tree meets preset polymerization condition.
It can include the step of whether each back end of specific discriminatory analysis tree meets preset polymerization condition but unlimited
Following three condition is formed on, first determines whether the tables of data in parsing tree is index table, index table here is includes finger
The tables of data of row is marked, illustrates to relate to the row of data calculating in the tables of data if the tables of data in parsing tree is index table,
Average mark is such as calculated, best result or the minimum inquiry row that grade is calculated, then judges the data for including packet syntax field
With the presence or absence of in the corresponding tables of data of back end, it is used to need the inquiry of packet aggregation comprising packet syntax field here
Row are polymerize, if the data comprising packet syntax field are to be present in the corresponding tables of data of back end, are illustrated current
Tables of data includes block function, finally judges whether remaining inquiry row is equal other than index arranges in the inquiry row of tables of data
Include database packet syntax field, if the inquiry of tables of data arranges whether remaining inquiry row other than index arranges wrap
Field containing packet syntax, if it is, illustrating to arrange in addition to calculative inquiry, remaining row is required to use and divide in tables of data
Group function, and then judge that each back end of the parsing tree meets preset polymerization condition.
Here preset polymerization condition is to meet preset polymerization item in parsing tree during structural analysis tree
The back end of part is polymerize in advance, excessive to reduce inquiry row in database packet syntax, so as to improve looking into for database
Ask performance.
If the 105, each back end of the parsing tree meets preset polymerization condition, preset polymerization condition will be met
Back end polymerize.
If it is determined that each back end of parsing tree meets preset polymerization condition, then illustrate each data of the parsing tree
Node is polymerizable, further polymerize the back end for meeting preset polymerization condition using aggregate function.
Above-mentioned common aggregate function and summing function sum, max function max, minimum value function min, average value letter
For number avg etc. for calculating the function of the every numerical value of inquiry row, the embodiment of the present invention does not do the type of selected aggregate function
It limits.
106th, query script is generated according to the parsing tree after the polymerization.
For the embodiment of the present invention, by being gathered in advance to the back end for meeting preset polymerization condition in parsing tree
It closes, by reading the data information in the parsing tree after polymerizeing in the corresponding tables of data of each back end, data information is write
Enter default template file generation query script, improve the performance that data query is carried out by query script.
The generation method of a kind of query script provided in an embodiment of the present invention, according to query argument and metadata structural analysis
Tree, the back end of the parsing tree here recording data information in the form of tables of data, passes through each data of discriminatory analysis tree
Whether meet preset polymerization condition, the back end for meeting preset polymerization condition is polymerize so that in the construction of parsing tree
The parsing tree premature polymerization that will meet polymerizing condition as far as possible in the process, and then according to the parsing tree generation inquiry foot after polymerization
This, it is excessive so as to avoid the inquiry columns in database packet syntax during generation script, influence the query performance of database.With
The generation method of the query script of the prior art is compared, and the embodiment of the present invention during query script is generated by that will meet
The parsing tree premature polymerization of the preset polymerization condition of condition reduces looking into database packet syntax in the query script of generation
The columns of row is ask, and then improves the search efficiency of database.
An embodiment of the present invention provides the generation method of another query script, as shown in Fig. 2, the method includes:
201st, the query argument of input is received.
This step is identical with the method described in step 101 described in Fig. 1, is not repeating here.
202nd, the metadata for describing data attribute is obtained
It should be noted that the embodiment of the present invention is not limited for describing the method for the metadata of data attribute obtaining
It is fixed, it can be obtained using the system stored procedures that SQL Sever are provided with system function, system stored procedures and system function
A level of abstraction is provided between system table and metadata so that without direct inquiry system table with regard to current database can be obtained
The metadata of object.
203rd, according to the query argument and the metadata structural analysis tree.
It is closed in the generating process of query script usually using the structure of parsing tree to characterize the association between certain data
System, such as can be department of the superior and the subordinate of enterprise, colume structure, commodity classification etc., and the database of current various local relationships,
All it is the records store data information in the form of tables of data, therefore the node of parsing tree here is also to be remembered in the form of tables of data
Record data information.
Illustratively, a food family tree is explained, as shown in figure 3, being eaten by classification, color, kind tissue
Product show the parsing tree using food as root node in the figure, food are divided into two major class of fruit and meat, respectively with fruit and
Meat is child node, further the banana of yellow and red cherry is divided into according to the fruit of different colours, similarly according to not
Congener meat is divided into beef and pork.
204th, the corresponding tables of data of the back end is obtained, and determines the inquiry row of the tables of data.
Here tables of data can be bivariate table, and every a line as a record or is a member in record bivariate table
Group records in bivariate table each row as a field or for an attribute.Here inquiry is classified as the field in bivariate table
Or attribute.
205th, judge to arrange with the presence or absence of index in the inquiry row.
It, can be judging tables of data judges to be in inquiry row by way of whether being index table for the embodiment of the present invention
No there are index row, and index table here is the tables of data for including index row, and index row refer to data involved in tables of data
The row of calculating, such as totalize, average value, be maximized or the inquiry of the numerical value such as minimum value row.
For the embodiment of the present invention, arranged by the inquiry row of tables of data in discriminatory analysis tree with the presence or absence of index, if in the presence of
Index row then illustrate that the tables of data in parsing tree is index table, with the presence or absence of calculative in further judging in tables of data
Index arranges, and needs the grouping by numerical value in other inquiry row if the numerical value for illustrating data calculating involved by index row in the presence of if
Converging operation is realized.
If the 206, there are index row in the inquiry row, the data for including packet syntax field are obtained.
Wherein, packet syntax field is that data are grouped with operation according to the rule specified, i.e., first by a data
Collection is divided into several zonules, then carries out data processing for several zonules, for example there is classification a, b, c, each
Classification is corresponding with respective subclass and each subclass is corresponding with respective quantity, classification is selected when performing, to classification a, b, c
Quantity carries out Classifying Sum, then returning the result is that a=18, b=19, c=37.
207th, judge that the data comprising packet syntax field whether there is in the corresponding tables of data of the back end
In.
For the embodiment of the present invention, judge whether the data comprising packet syntax field carry out the corresponding tables of data of back end
The step of can by data of the judgement comprising packet syntax field whether in the inquiry broomrape from tables of data, if it is not,
It then further determines whether in other broomrapes except tables of data inquiry row, if it is, illustrating packet syntax field certainty
Whether the tables of data in parsing tree, the embodiment of the present invention come from data section by data of the judgement comprising packet syntax field
The corresponding tables of data of point whether there is packet aggregation operation to judge to inquire row in tables of data.
If the 208, the data comprising packet syntax field are present in the corresponding tables of data of the back end, sentence
Whether the inquiry row in the disconnected inquiry row in addition to index arranges include the packet syntax field.
Whether the inquiry row in inquiry row of the embodiment of the present invention by judging tables of data other than index arranges include
Packet syntax field come further confirm that in tables of data in addition to index arrange other than remaining it is all inquiry row be involved in index row
Packet aggregation operation in, so as to illustrate the numerical value of inquiry class arrange according to non-index use aggregate function finger can be calculated
Mark the numerical value of row.
If the 209, whether the inquiry row in the inquiry row in addition to index arranges include the packet syntax field,
Judge that the back end meets preset polymerization condition.
Here the preset polymerization condition that meets refers to that the back end of parsing tree meets above-mentioned steps 205 to step 208
In all Rule of judgment, can determine that the back end of the parsing tree is polymerizable, for the embodiment of the present invention, sentence
After disconnected back end meets polymerizing condition, obtain and in parsing tree identify whether that the field of data aggregate can be carried out, by that will mark
The field whether knowledge can carry out data aggregate is configured to carry out data aggregate, i.e., will carry out the field of data aggregate
True is set as, while by the identification field of all immediate data nodes of the parsing tree also labeled as polymerizable.
210th, query script is generated according to the parsing tree after the polymerization.
For the embodiment of the present invention, following methods reality can be passed through according to the parsing tree generation query script after the polymerization
It is existing, the data information in each back end corresponding data table in polymerization post analysis tree is read first, then writes data information
Enter default template file, generate query script.
After it is polymerizable to judge the back end of parsing tree, by according to identification field by the data in parsing tree
Node carries out premature polymerization, can reduce inquiry row excessive in database packet syntax, improves the query performance of data.
For the embodiment of the present invention, specific application scenarios can be as follows, but not limited to this, including:It is looked into construction
Ask script parsing tree when, provide one include student name, numerical score, Chinese language score, average mark, total score attribute number
According to table, further according to query argument and metadata structural analysis tree, the inquiry row of tables of data whether there is in discriminatory analysis tree
It is related to the index row of data calculating, such as average or sum, if it does, further judging comprising library packet syntax
Whether the inquiry of the tables of data in parsing tree arranges the data of field, that is, judges that the row of the inquiry in tables of data include mathematics
Score and Chinese language score calculate total score by the sum of numerical value of numerical score and Chinese language score, pass through numerical score and Chinese language point
Several mean value calculation average marks, there are packet aggregation operation, in further discriminatory analysis tree the inquiry of tables of data arrange in addition to refer to
Whether remaining inquiry row includes the field of database packet syntax except mark row, that is, judges the inquiry row in tables of data
Remaining inquiry row student name, numerical score, Chinese language score are packet syntax other than average mark and total score attribute
Field, it is polymerizable finally to judge the back end of the parsing tree, and by the identification field of the parsing tree labeled as can
Polymerization, so as to be polymerize parsing tree according to identification field, by being generated according to the parsing tree after polymerization into query script.
Since the database of the prior art is during query script is generated, can be incited somebody to action when being related to packet aggregation operation
Packet aggregation operation is put into last execution, can the inquiry row not in aggregate function be added to number in being operated due to packet aggregation
According in the packet syntax of library so that the inquiry row in database packet syntax are excessive, and the query performance for leading to database is undesirable, right
In the generation method of another query script provided in an embodiment of the present invention, by that will meet during query script is generated
The back end of the parsing tree of the preset polymerization condition of condition is polymerize in advance, reduces database in the query script of generation
The columns of inquiry row in packet syntax, and then improve the search efficiency of database.
Further, the specific implementation as method shown in Fig. 1, the embodiment of the present invention provide a kind of generation of query script
Device, the device embodiment is corresponding with preceding method embodiment, and for ease of reading, the present apparatus is not in preceding method embodiment
Detail content repeated one by one, it should be understood that the device in the present embodiment can correspond to realize preceding method embodiment
In full content, as shown in figure 4, described device includes:
Receiving unit 31, can be used for receiving the query argument of input, and the receiving unit 31 is to receive to look into the present apparatus
The main functional modules of parameter are ask, wherein, the query argument that query argument is constructed for the business information in database;
First acquisition unit 32 can be used for obtaining the metadata for describing data attribute, the first acquisition unit
32 main functional modules to obtain metadata in the present apparatus, can specifically use the system stored procedures that SQLSever is provided with
System function obtains;
Structural unit 33 can be used for according to the query argument and the metadata structural analysis tree, the parsing tree
With multiple back end, the structural unit 33 is the main functional modules of structural analysis tree in the present apparatus;
Judging unit 34, can be used for judging whether each back end of the parsing tree meets preset polymerization condition,
The judging unit 34 is to judge whether back end meets the main functional modules of preset polymerization condition in the present apparatus, this is default
Qualified back end in order to polymerize by polymerizing condition in advance during structural analysis tree;
Polymerized unit 35, will if each back end that can be used for the parsing tree meets preset polymerization condition
The back end for meeting preset polymerization condition is polymerize, and the polymerized unit 35 is that will meet preset polymerization condition in the present apparatus
The main functional modules that are polymerize of back end, the back end of parsing tree is polymerize especially by aggregate function;
Generation unit 36 can be used for generating query script, the generation unit 36 according to the parsing tree after the polymerization
To generate the main functional modules of query script in the present apparatus, especially by each back end in the parsing tree read after polymerizeing
Default template file generation query script is written in data information by the data information in corresponding tables of data.
A kind of generating means of query script provided in an embodiment of the present invention,
According to query argument and metadata structural analysis tree, the back end of parsing tree here is remembered in the form of tables of data
Data information is recorded, whether meets preset polymerization condition by each data of discriminatory analysis tree, preset polymerization condition will be met
Back end is polymerize so that as far as possible gathers the parsing tree for meeting polymerizing condition in advance in the construction process of parsing tree
It closes, and then query script is generated according to the parsing tree after polymerization, so as to avoid in database packet syntax during generation script
It is excessive to inquire columns, influences the query performance of database.Compared with the generation method of the query script of the prior art, the present invention is real
Example is applied by, by the parsing tree premature polymerization of qualified preset polymerization condition, reducing during query script is generated
The columns of inquiry row in the query script of generation in database packet syntax, and then improve the search efficiency of database.
Further, as shown in figure 5, the embodiment of the present invention provides the generating means of another query script, the judgement
Unit 34 includes:
First acquisition module 341 can be used for obtaining the corresponding tables of data of the back end, and determine the tables of data
Inquiry row;
First judgment module 342 can be used for judging to arrange with the presence or absence of index in the inquiry row, the index row reference
And the row that data calculate;
First judgment module 342, if can be also used in the inquiry row, there are index row, judge the number
Meet preset polymerization condition according to node;
First judgment module 342, if can be also used for that index row are not present in the inquiry row, described in judgement
Back end does not meet preset polymerization condition.
Further, the judging unit 34 further includes:
Second acquisition module 343 after being arranged in the inquiry row are judged there are index, is judging the data section
Before point meets preset polymerization condition, for obtaining the data for including packet syntax field;
Second judgment module 344 can be used for judging that the data comprising packet syntax field whether there is in described
In the corresponding tables of data of back end;
Second judgment module 344, if can be also used for the data comprising packet syntax field is present in institute
It states in the corresponding tables of data of back end, then judges that the back end meets preset polymerization condition;
Second judgment module 344 is not present in if can be also used for the data comprising packet syntax field
In the corresponding tables of data of the back end, then judge that the back end does not meet preset polymerization condition.
Further, the judging unit 34 further includes:
Third judgment module 345 can be present in the data section judging the data comprising packet syntax field
After in the corresponding tables of data of point, before judging that the back end meets preset polymerization condition, for judging the inquiry
Whether the inquiry row in row in addition to index arranges include the packet syntax field;
The third judgment module 345, if the inquiry row that can be also used in the inquiry row in addition to index arranges are equal
Comprising the packet syntax field, then judge that the back end meets preset polymerization condition;
The third judgment module 345, if the inquiry that can be also used in the inquiry row in addition to index arranges arranges not
Comprising the packet syntax field, then judge that the back end does not meet preset polymerization condition.
Further, described device further includes:
Second acquisition unit 37 can be used for obtaining the word for identifying whether that data aggregate can be carried out in the parsing tree
Section;
Setting unit 38 can be used for identifying whether that the field that can carry out data aggregate is configured to carry out by described
Data aggregate;
The generation unit 36 includes:
Read module 361 can be used for reading the corresponding tables of data of each back end in the parsing tree after the polymerization
In data information;
Writing module 362 can be used for the data information default template file is written, generate the query script.
For the generation method of another query script provided in an embodiment of the present invention, by that will be accorded with during query script is generated
The back end of the parsing tree of the preset polymerization condition of conjunction condition is polymerize in advance, reduces data in the query script of generation
The columns of inquiry row in the packet syntax of library, and then improve the search efficiency of database.
Above-mentioned server includes processor and memory, above-mentioned receiving unit 31, first acquisition unit, structural unit
33rd, judging unit 34, polymerized unit 35 and generation unit 36 etc. store in memory as program unit, are held by processor
Above procedure unit stored in memory go to realize corresponding function.
Comprising kernel in processor, gone in memory to transfer corresponding program unit by kernel.Kernel can set one
Or more, it saves manpower by adjusting kernel parameter, realizes the query performance for improving database.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/
Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flashRAM), memory includes at least one storage
Chip.
Present invention also provides a kind of computer program products, first when being performed on data processing equipment, being adapted for carrying out
The program code of beginningization there are as below methods step:Receive the query argument of input;Obtain the metadata for describing data attribute;
According to the query argument and the metadata structural analysis tree, the parsing tree has multiple back end;Judge described point
Whether each back end of analysis tree meets preset polymerization condition;If it is, the back end that preset polymerization condition will be met
It is polymerize;Query script is generated according to the parsing tree after the polymerization.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or computer program
Product.Therefore, the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware can be used in the application
Apply the form of example.Moreover, the computer for wherein including computer usable program code in one or more can be used in the application
The computer program production that usable storage medium is implemented on (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
The application is with reference to the flow according to the method for the embodiment of the present application, equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram
The combination of flow and/or box in journey and/or box and flowchart and/or the block diagram.These computer programs can be provided
The processor of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices is generated for real
The device of function specified in present one flow of flow chart or one box of multiple flows and/or block diagram or multiple boxes.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction generation being stored in the computer-readable memory includes referring to
Enable the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one box of block diagram or
The function of being specified in multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps are performed on calculation machine or other programmable devices to generate computer implemented processing, so as in computer or
The instruction offer performed on other programmable devices is used to implement in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in a box or multiple boxes.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/
Or the forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flashRAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, CD-ROM read-only memory (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic tape cassette, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, available for storing the information that can be accessed by a computing device.It defines, calculates according to herein
Machine readable medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It these are only embodiments herein, be not limited to the application.To those skilled in the art,
The application can have various modifications and variations.All any modifications made within spirit herein and principle, equivalent replacement,
Improve etc., it should be included within the scope of claims hereof.
Claims (10)
1. a kind of generation method of query script, which is characterized in that including:
Receive the query argument of input;
Obtain the metadata for describing data attribute;
According to the query argument and the metadata structural analysis tree, the parsing tree has multiple back end;
Judge whether each back end of the parsing tree meets preset polymerization condition;
If it is, the back end for meeting preset polymerization condition is polymerize;
Query script is generated according to the parsing tree after the polymerization.
2. according to the method described in claim 1, it is characterized in that, the back end of the parsing tree is corresponding with tables of data, institute
It states and judges whether each back end of the parsing tree meets preset polymerization condition and include:
The corresponding tables of data of the back end is obtained, and determines the inquiry row of the tables of data;
Judge to arrange with the presence or absence of index in the inquiry row, the row that the index row reference and data calculate;
If it is, judge that the back end meets preset polymerization condition;Otherwise, it is default to judge that the back end is not met
Polymerizing condition.
3. according to the method described in claim 2, it is characterized in that, judge it is described inquiry row in there are index arrange after,
Before judging that the back end meets preset polymerization condition, the method further includes:
Obtain the data for including packet syntax field;
Judge that the data comprising packet syntax field whether there is in the corresponding tables of data of the back end;
If it is, judge that the back end meets preset polymerization condition;Otherwise, it is default to judge that the back end is not met
Polymerizing condition.
4. according to the method described in claim 3, it is characterized in that, judging the data presence comprising packet syntax field
It is described before judging that the back end meets preset polymerization condition after in the corresponding tables of data of the back end
Method further includes:
Judge whether the inquiry row in the inquiry row in addition to index arranges include the packet syntax field;
If it is, judge that the back end meets preset polymerization condition;Otherwise, it is default to judge that the back end is not met
Polymerizing condition.
5. according to the method described in any one of claim 2-4, which is characterized in that in the data that will meet preset polymerization condition
Before node is polymerize, the method further includes:
Obtain the field for identifying whether that data aggregate can be carried out in the parsing tree;
Identify whether that the field that can carry out data aggregate is configured to carry out data aggregate by described;
The parsing tree generation query script according to after the polymerization includes:
Read the data information in the corresponding tables of data of each back end in the parsing tree after the polymerization;
Default template file is written into the data information, generates the query script.
6. a kind of generating means of query script, which is characterized in that including:
Receiving unit, for receiving the query argument of input;
First acquisition unit, for obtaining the metadata for describing data attribute;
Structural unit, for according to the query argument and the metadata structural analysis tree, the parsing tree to have multiple numbers
According to node;
Whether judging unit, each back end for judging the parsing tree meet preset polymerization condition;
Polymerized unit if each back end for the parsing tree meets preset polymerization condition, will meet default poly-
The back end of conjunction condition is polymerize;
Generation unit, for generating query script according to the parsing tree after the polymerization.
7. device according to claim 6, which is characterized in that the back end of the parsing tree is corresponding with tables of data, institute
Judging unit is stated to include:
First acquisition module for obtaining the corresponding tables of data of the back end, and determines the inquiry row of the tables of data;
First judgment module, for judging to arrange with the presence or absence of index in the inquiry row, the index row reference and data calculate
Row;
First judgment module, if be additionally operable in the inquiry row, there are index row, judge that the back end meets
Preset polymerization condition;
First judgment module, if be additionally operable in the inquiry row, there is no indexs to arrange, and judges the back end not
Meet preset polymerization condition.
8. device according to claim 7, which is characterized in that the judging unit further includes:
Second acquisition module, for after being arranged in judging the inquiry row there are index, judging that the back end meets
Before preset polymerization condition, the data for including packet syntax field are obtained;
Second judgment module corresponds to for judging that the data comprising packet syntax field whether there is in the back end
Tables of data in;
Second judgment module, if being additionally operable to the data comprising packet syntax field is present in the back end pair
In the tables of data answered, then judge that the back end meets preset polymerization condition;
Second judgment module, if being additionally operable to the data comprising packet syntax field is not present in the back end
In corresponding tables of data, then judge that the back end does not meet preset polymerization condition.
9. device according to claim 8, which is characterized in that judge the back end meet preset polymerization condition it
Before, the judging unit further includes:
Third judgment module, for judging that it is corresponding that the data comprising packet syntax field are present in the back end
After in tables of data, judge whether the inquiry row in the inquiry row in addition to index arranges include the packet syntax field;
The third judgment module, if the inquiry row being additionally operable in the inquiry row in addition to index arranges include the grouping
Grammer field then judges that the back end meets preset polymerization condition;
The third judgment module, if the inquiry row being additionally operable in the inquiry row in addition to index arranges do not include the grouping
Grammer field then judges that the back end does not meet preset polymerization condition.
10. according to the device described in any one of claim 7-9, which is characterized in that described device further includes:
Second acquisition unit, for obtaining the field for identifying whether that data aggregate can be carried out in the parsing tree;
Setting unit, for identifying whether that the field that can carry out data aggregate is configured to carry out data aggregate by described;
The generation unit includes:
Read module, for reading the data letter in the parsing tree after the polymerization in the corresponding tables of data of each back end
Breath;
Writing module for the data information to be written default template file, generates the query script.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611204520.XA CN108241622B (en) | 2016-12-23 | 2016-12-23 | Query script generation method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201611204520.XA CN108241622B (en) | 2016-12-23 | 2016-12-23 | Query script generation method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108241622A true CN108241622A (en) | 2018-07-03 |
CN108241622B CN108241622B (en) | 2022-07-05 |
Family
ID=62703983
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201611204520.XA Active CN108241622B (en) | 2016-12-23 | 2016-12-23 | Query script generation method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108241622B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109840257A (en) * | 2018-12-15 | 2019-06-04 | 中国平安人寿保险股份有限公司 | Data base query method, device, computer installation and readable storage medium storing program for executing |
CN111782670A (en) * | 2020-06-29 | 2020-10-16 | 中国工商银行股份有限公司 | Method and device for automatically processing data resource operation |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101246495A (en) * | 2008-03-21 | 2008-08-20 | 深圳国人通信有限公司 | Method for constructing query scheme and executing data query and statistics |
US20130290929A1 (en) * | 2012-03-29 | 2013-10-31 | Lg Cns Co., Ltd. | Method of managing script, server performing the same and storage media storing the same |
US20140046876A1 (en) * | 2010-06-29 | 2014-02-13 | Morf Dynamics Pty Ltd | System and method of providing a computer-generated response |
CN105912595A (en) * | 2016-04-01 | 2016-08-31 | 华南理工大学 | Data origin collection method of relational databases |
-
2016
- 2016-12-23 CN CN201611204520.XA patent/CN108241622B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101246495A (en) * | 2008-03-21 | 2008-08-20 | 深圳国人通信有限公司 | Method for constructing query scheme and executing data query and statistics |
US20140046876A1 (en) * | 2010-06-29 | 2014-02-13 | Morf Dynamics Pty Ltd | System and method of providing a computer-generated response |
US20130290929A1 (en) * | 2012-03-29 | 2013-10-31 | Lg Cns Co., Ltd. | Method of managing script, server performing the same and storage media storing the same |
CN105912595A (en) * | 2016-04-01 | 2016-08-31 | 华南理工大学 | Data origin collection method of relational databases |
Non-Patent Citations (1)
Title |
---|
郭改改: "多Agent聚合模型的研究与实现", 《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109840257A (en) * | 2018-12-15 | 2019-06-04 | 中国平安人寿保险股份有限公司 | Data base query method, device, computer installation and readable storage medium storing program for executing |
CN109840257B (en) * | 2018-12-15 | 2023-11-21 | 中国平安人寿保险股份有限公司 | Database query method, database query device, computer device and readable storage medium |
CN111782670A (en) * | 2020-06-29 | 2020-10-16 | 中国工商银行股份有限公司 | Method and device for automatically processing data resource operation |
Also Published As
Publication number | Publication date |
---|---|
CN108241622B (en) | 2022-07-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11003636B2 (en) | Generating and reusing transformations for evolving schema mapping | |
US11593458B2 (en) | System for time-efficient assignment of data to ontological classes | |
US11847113B2 (en) | Method and system for supporting inductive reasoning queries over multi-modal data from relational databases | |
US8898104B2 (en) | Auto-mapping between source and target models using statistical and ontology techniques | |
US20170116203A1 (en) | Method of automated discovery of topic relatedness | |
US10061787B2 (en) | Unified data model for integration between relational and non-relational databases | |
US8484252B2 (en) | Generation of a multidimensional dataset from an associative database | |
US20080162455A1 (en) | Determination of document similarity | |
US8825621B2 (en) | Transformation of complex data source result sets to normalized sets for manipulation and presentation | |
US9406018B2 (en) | Systems and methods for semantic data integration | |
CN107491487A (en) | A kind of full-text database framework and bitmap index establishment, data query method, server and medium | |
US20180357278A1 (en) | Processing aggregate queries in a graph database | |
CN114064660B (en) | Data structured analysis method based on ElasticSearch | |
EP3635580A1 (en) | Functional equivalence of tuples and edges in graph databases | |
CN108241622A (en) | The generation method and device of a kind of query script | |
Talburt et al. | A practical guide to entity resolution with OYSTER | |
Chacko et al. | Capturing provenance for big data analytics done using SQL interface | |
US10417230B2 (en) | Transforming and evaluating missing values in graph databases | |
CN108241624A (en) | The generation method and device of a kind of query script | |
Sun et al. | Hierarchical text classification methods and their specification | |
Unbehauen et al. | SPARQL Update queries over R2RML mapped data sources | |
CN112527796A (en) | Data table processing method and device and computer readable storage medium | |
Mahmud | Towards a data generation tool for NoSQL data stores | |
Kotsev et al. | Benchmarking RDF Query Engines: The LDBC Semantic Publishing Benchmark. | |
Syamsiyah et al. | A native operator for process discovery |
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 | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |