CN106933842A - A kind of data base query method and device - Google Patents
A kind of data base query method and device Download PDFInfo
- Publication number
- CN106933842A CN106933842A CN201511019215.9A CN201511019215A CN106933842A CN 106933842 A CN106933842 A CN 106933842A CN 201511019215 A CN201511019215 A CN 201511019215A CN 106933842 A CN106933842 A CN 106933842A
- Authority
- CN
- China
- Prior art keywords
- unidirectional
- view
- physical table
- action statement
- associated view
- 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/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/9032—Query formulation
- G06F16/90332—Natural language query formulation or dialogue systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
Abstract
This application provides a kind of data base query method and a kind of database inquiry device, it is related to database technical field.The application unidirectional associated view defined in database, the action statement so submitted to for user, after judging that the action statement is directed to the action statement of unidirectional associated view, according to the query object in the action statement, such as the action statement needs the critical field of inquiry, remove middle each physical table for determining to need defined in corresponding unidirectional associated view, it is then based on above-mentioned each physical table, the action statement is reconstructed into unidirectional operation associated sentence, then the action statement of the unidirectional association is performed again, so when the action statement that the user submits to pertains only to part physical table, the embodiment of the present application only retrieves the physical table of the part, without being retrieved to the whole physical table being related in the unidirectional associated view definition, reduce range of search, improve recall precision, reduce the occupancy of resource.
Description
Technical field
The application is related to database technical field, more particularly to a kind of data base query method and a kind of number
According to library inquiry device.
Background technology
In database, either relevant database or distributed data-storage system, physical table and
View is the most frequently used data storage and query scheme.View (View) be from one or more tables (or
View) derived from table.View (is to be distinguished with view, also referred to as table is physical table --- Base with table sometimes
Table) different, view is that the data corresponding to empty table, i.e. a view do not carry out actual storage, number
According to the definition that view is only stored in storehouse, when the data to view are operated, system is determined according to view
Justice removes the physical table that operation is associated with view.View looks the physical table of extraordinary image database, to it
Operation it is the same with any other table.When data are changed by view, actually changing physics
Data in table;On the contrary, the change of physical table data can be also automatically reflected in by regarding that physical table is produced
In figure.
In first technology, for the data base manipulation statement that user sends, if the action statement is directed to
View, then database can then perform all physical tables being related in the definition of the view all according to its logic
Retrieval one time, particularly when the definition of view is especially complex, even if the content of user's inquiry is only to regard
A field in figure, every time to the operation of view, still can be wherein all of content retrieval one time.
Therefore, to the action statement of view, slowly, resource occupation is high for the recall precision of database for first technology.
The content of the invention
In view of the above problems, it is proposed that the embodiment of the present application overcomes above mentioned problem or extremely to provide one kind
A kind of data base query method and a kind of corresponding data base querying dress for partially solving the above problems
Put.
In order to solve the above problems, this application discloses a kind of data base query method, it is characterised in that
Including:
Judge whether the action statement submitted to by user is action statement for unidirectional associated view;It is described
It is unidirectional operation associated between each physical table defined in unidirectional associated view;
If the action statement is directed to unidirectional associated view, the inquiry in the action statement is right
As and unidirectional associated view definition, determine each physical table to be checked;
Based on the action statement, with each physical table to be checked as the object to be operated, reconstruct is unidirectional
Operation associated sentence.
Disclosed herein as well is a kind of database inquiry device, it is characterised in that including:
Action statement judge module, whether the action statement for judging to be submitted to by user is for unidirectional pass
Join the action statement of view;It is unidirectional association behaviour between each physical table defined in the unidirectional associated view
Make;
Physical table determining module, if being directed to unidirectional associated view for the action statement, according to institute
The definition of the query object and unidirectional associated view in action statement is stated, each physics to be checked is determined
Table;
Unidirectional operation associated sentence reconstructed module, for based on the action statement, with described to be checked
Each physical table is the object to be operated, the unidirectional operation associated sentence of reconstruct.
The embodiment of the present application includes advantages below:
The embodiment of the present application, the unidirectional associated view defined in database, then carried for user
The action statement of friendship, such as SQL (Structured Query Language, SQL)
Sentence, after judging that the action statement is directed to the action statement of unidirectional associated view, according to the behaviour
Make the query object in sentence, such as the action statement needs the critical field of inquiry, goes corresponding
Middle each physical table for determining to need, is then based on above-mentioned each physics defined in unidirectional associated view
The action statement, is reconstructed into unidirectional operation associated sentence by table, then performs the behaviour of the unidirectional association
Make sentence, then when the action statement that the user submits to pertains only to part physical table, the application reality
The physical table that example only retrieves the part is applied, without complete to what is be related in the unidirectional associated view definition
The physical table in portion is retrieved, and reduces range of search, improves recall precision, reduces resource
Occupancy.
Brief description of the drawings
The step of Fig. 1 is a kind of data base query method embodiment of the application flow chart;
The left associated view of Figure 1A the application defines example architecture;
The step of Fig. 2 is another data base query method embodiment of the application flow chart;
The step of Fig. 3 is another data base query method embodiment of the application flow chart;
Fig. 4 is a kind of structured flowchart of database inquiry device embodiment of the application.
Specific embodiment
To enable above-mentioned purpose, the feature and advantage of the application more obvious understandable, below in conjunction with the accompanying drawings
The application is described in further detail with specific embodiment.
One of core idea of the embodiment of the present application is, such as left by pre-defining unidirectional associated view
Associated view or right associated view, in the definition of the unidirectional associated view, define each physical table it
Between be unidirectional operation associated.So receive user for the unidirectional associated view action statement it
The definition of query object and unidirectional associated view afterwards, in the action statement, determines to be checked
Each physical table, is then based on the action statement, with each physical table to be checked be operated it is right
As the unidirectional operation associated sentence of reconstruct then performs the unidirectional operation associated sentence.If in this way, with
The action statement that family is submitted to, pertains only to the operation of the part physical table in being defined to unidirectional associated view, by
These physical tables are reconstructed with unidirectional operation associated sentence in the embodiment of the present application, so that system can be examined only
All tables defined in unidirectional associated view will not be retrieved by the physical table of the rope part, reduce inspection
The scope of the physical table of rope, improves retrieval rate, reduces the occupancy of system resource.
Embodiment one
Reference picture 1, flow chart the step of show a kind of data base query method embodiment of the application,
Specifically may include steps of:
Step 110, judges whether the action statement submitted to by user is operation for unidirectional associated view
Sentence;If the action statement is directed to unidirectional associated view, into step 120.
In the embodiment of the present application, can unidirectional associated view, the unidirectional pass defined in database in advance
Join in the definition of view, be unidirectional operation associated between each physical table.Than if any Table A, table B, table C,
Then Table A, B, C, then the unidirectional contingency table B of Table A, the unidirectional contingency table C of Table A.
Wherein, in the embodiment of the present application, the unidirectional associated view includes that left associated view or right association are regarded
Figure.
Wherein, the view of the embodiment of the present application can be the view of mysql databases, or other
The view of database.Aforesaid operations sentence such as SQL statement.The embodiment of the present application is not any limitation as to it.
In the preferred embodiment of the application one, before step 110, including:
Step 100, creates unidirectional associated view in database;Defined in the unidirectional associated view most
The primary physical table of outer layer is respectively with respectively from physical form to operation associated, and definition is described from physical table correspondence institute
It is major key field, the critical field that definition is respectively retrieved to state unidirectional operation associated critical field.
In the embodiment of the present application, in order that system can be quickly found out the physical table of needs, and data
The regulation of the unidirectional association in storehouse, can set a primary physical table, be then the primary physical table by other tables
From table, then when creating unidirectional associated view in database, it is fixed as follows to be that unidirectional associated view is carried out
Justice:
1st, in form clause, outermost layer by the primary physical table respectively with respectively from physical form to associating.
Such as primary physical table be a, the primary physical table from physical table include b, c, d, e, then primary physical table
A is unidirectional respectively to be associated from physical table b.And do not associated unidirectionally between physical table b, c, d, e.So
Ensure that each physical table is unidirectionally associated in outermost layer.
2nd, the definition of the sentence according to unidirectional association, the critical field from physical table for unidirectionally being associated is needed
It to be major key field.The row 1 of such as primary physical table 1 associate the row 1 from physical table 2, then from physics
The row 1 of table 2 are needed as major key field, and such database can retrieve phase according to corresponding action statement
The physical table answered.
3rd, in the select clause of definition, the critical field that definition is respectively retrieved, the pass being retrieved
Key field is the query object defined in view.
By taking left associated view as an example, its definition structure such as Figure 1A, (master meter is foregoing primary physical to master meter 1
Table) the left association of outermost layer difference each from table (should from table be foregoing from physical table), from the corresponding of table
Row critical field col i are major key field (such as in figure from table i.col j, i, j be the integer more than 0),
The false code that it creates left associated view is as follows:
Specification is needed, for being associated from physical table, can be carried out in internal layer further
Limit, such as:
Other situations are similar to, and the embodiment of the present application is not limited to it.
It is, of course, understood that for right associated view, its form clause is such as:
from
a right outer join b
On a.***=b.***
right outer join c
On a.***=c.***
……
The grammer of its right association is conversely, other principles are similar.
Certainly, above-mentioned false code is only a kind of example of the embodiment of the present application, and different databases may be specific
Grammer may be different, the embodiment of the present application is not any limitation as to it.
After the above-mentioned unidirectional associated view defined in database, user can be received submit in the client
One-way operation sentence, such as SQL statement.Its form can be as follows:
select sum(pv_itm)
,avg(gmv_slr)
from leftpkview_test
Certainly, in practice, user passes data processing request on the client, and treatment request includes above-mentioned SQL
Sentence, then the system of the embodiment of the present application therefrom extracts SQL after the data processing request is received
Sentence, then parses to it.
In actual applications, after the from clause in the SQL statement that can be submitted to from user, quilt is extracted
The view name or table name of retrieval.Such as above-mentioned example, title leftpkview_test, Ran Houcong are extracted
Matched in the view name recorded in system, then leftpkview_test is one as previously described
Left associated view, then then determine that this SQL statement that user submits to is directed to left associated view.
Certainly, if matching the title of non-unidirectional associated view, processed according to traditional processing mode
The SQL statement.
SQL statement for right associated view is similar to, and no longer goes to live in the household of one's in-laws on getting married chat herein.
So, when it is determined that user submit to SQL statement, after being directed to the SQL statement of unidirectional associated view,
Then enter step 120.
Step 120, the definition of query object and unidirectional associated view in the action statement,
Determine each physical table to be checked;Between each physical table it is unidirectional defined in the unidirectional associated view
It is operation associated.
In the embodiment of the present application, each query object can be extracted from the action statement for receiving, then
Go to analyze the corresponding each physical table of above-mentioned query object from the definition of unidirectional associated view.
In the preferred embodiment of the application one, step 120 includes:
Sub-step 121, each critical field in the select clause in the action statement of user, with
Each critical field being retrieved in unidirectional associated view definition is compared, and determines primary physical table to be operated
And it is corresponding from physical table.
In actual applications, by taking SQL statement as an example, it includes select clause, is write out in the clause
Need each critical field of inquiry.By taking foregoing SQL statement as an example:
select sum(pv_itm)
,avg(gmv_slr)
from leftpkview_test
Therein, the pv_itm in sum (pv_itm) is critical field, in avg (gmv_slr)
Gmv_slr is critical field.
So combine the key defined in the select in foregoing left associated view leftpkview_test
Field, pv_itm in select clause and gmv_slr in the SQL statement that user submits to it is left
Critical field defined in associated view leftpkview_test is matched, it is found that pv_itm belongs to
Table b, gmv_slr belong to table e, add primary physical table a, then can determine the SQL languages that the user submits to
Sentence needs table a, b, e, it is not necessary to table c, d.
Certainly, for right associated view, the determination principle of its physical table and the determination process of left associated view
It is similar.
Step 130, based on the action statement, with each physical table to be checked as the object to be operated,
The unidirectional operation associated sentence of reconstruct.
It is determined that after each physical table for corresponding to the action statement of user, then the action statement of user can be entered
Line reconstruction, is reconstructed into unidirectional operation associated sentence.The unidirectional operation associated sentence is with the action statement of user
In query object and corresponding physical table, be reconstructed into and corresponding query object inquired about from corresponding physical table
Action statement.
In actual applications, the application can provide one and recompile parsing interface and carry out the weight of step 130
Structure is operated.
In another preferred embodiment of the application, step 130 includes:
Sub-step 131, the from clause in the action statement that user is submitted to is reconstructed into unidirectional associated view
Defined in the primary physical table and the corresponding unidirectional association from clause from physical table;
By taking foregoing left associated view leftpkview_test as an example, determine in the step 120 table a, b,
e。
It is possible to extract a, b, e language from the from clause of the definition of leftpkview_test
Sentence, i.e.,
from
a left outer join b
On a.item_id=b.item_id
left outer join e
On a.seller_id=e.seller_id
As left association from clause.
Certainly, for right associated view, right association from clause can be obtained according to above-mentioned principle.
Sub-step 132, select clause and the unidirectional association in the action statement that user is submitted to
From clause, is reconstructed into unidirectional operation associated sentence.
Select clause in the SQL statement submitted to then in conjunction with user, and above-mentioned unidirectional association from
The unidirectional association SQL statement of clause's reconstruct, the SQL statement such as submitted to foregoing left associated view and user,
After based on step 110 and 120 treatment, left association SQL statement is reconstructed into this step:
Certainly, for right associated view, right association SQL statement can be obtained according to similar principles.
In this way, obtaining the system of the embodiment of the present application after unidirectional operation associated sentence again by the unidirectional association behaviour
Sent to database as sentence, database then performs the unidirectional operation associated sentence, database lookup result
Afterwards, then client is returned to, client is then shown at view operation interface to the returning result.
It should be noted that in the embodiment of the present application, in the unidirectional operation associated sentence of reconstruct, can be with
It is reconstructed into the unidirectional operation associated sentence in opposite direction with unidirectional associated view.Such as unidirectional associated view
It is left associated view, then b left outer can be equivalent to based on a left outer join b when reconstructing
The principle of join a, is reconstructed into right operation associated sentence, such as by the SQL statement that user submits to:
The right association clauses of from can be first changed in previous example:
Then reconstruct obtains right association SQL statement such as:
When certainly, for right associated view, the left operation associated sentence for reconstructing left associated view is similar to,
It is herein described it not to be any limitation as.
In addition, in another preferred embodiment of the application, when unidirectional associated view is defined, unidirectional
Also include defined in associated view:
Define the access rights of user.
Further, before step 120, also include:
Step 115, the access rights of the user of the definition according to the unidirectional associated view judge described
Whether user possesses the authority for accessing the unidirectional associated view;If the user possesses the access list
To the authority of associated view, then into step 120;If the user possesses the access unidirectional association
The authority of view, then into step 116.
Step 116, the action statement that refusal treatment user submits to.
In the embodiment of the present application, can be operational view when view is defined for view
User sets access rights.The access rights such as such as inquire about, update, deleting, inserting in authority
Individual or multiple.
So after the SQL statement for receiving user's submission, the ID is obtained, while obtaining the SQL
The action type of sentence, then the authority with the user in definition matched, if by if illustrate
User possesses the operating right, then can enter step 120.If do not passed through, illustrate not allow this
User performs corresponding operating, then the action statement that rejection treatment user submits to.
The embodiment of the present application unidirectional associated view defined in database, then submitted to for user
Action statement, such as SQL (Structured Query Language, SQL) language
Sentence, after judging that the action statement is directed to the action statement of unidirectional associated view, according to the operation
Query object in sentence, such as the action statement need the critical field of inquiry, remove corresponding list
To middle each physical table for determining to need defined in associated view, above-mentioned each physical table is then based on,
The action statement is reconstructed into unidirectional operation associated sentence, then by the unidirectional operation associated sentence hair
Execution in database is delivered to, so that the embodiment of the present application possesses following advantage:
The embodiment of the present application only retrieves the physical table of the part, without fixed to the unidirectional associated view
The whole physical table being related in justice is retrieved, and reduces range of search, improves recall precision,
Reduce the occupancy of resource.
For clearer description the embodiment of the present application, separately below with left associated view and right associated view
Application scenarios the application is described:
Embodiment two
It is illustrated with left associated view.
Reference picture 2, flow chart the step of show a kind of data base query method embodiment of the application,
Specifically may include steps of:
Step 210, judges whether the action statement submitted to by user is operation language for left associated view
Sentence;Outermost primary physical table is grasped from the left association of physical table respectively with respectively defined in the left associated view
Make, the definition critical field operation associated from the physical table correspondence left side is major key field, and definition is each
The critical field being retrieved.
Certainly, in the embodiment of the present application, can include with pre-defined left associated view, its definition:Outermost
The primary physical table of layer respectively with it is respectively operation associated from a physical table left side, definition is described from the physical table correspondence left side
Operation associated critical field is major key field, the critical field that definition is respectively retrieved.
Step 220, if the action statement is directed to left associated view, according to the action statement of user
In select clause in each critical field, with each keyword for being retrieved in the definition of left associated view
Section is compared, and determines primary physical table to be operated and corresponding from physical table;
Step 230, the from clause in the action statement that user is submitted to determines in being reconstructed into left associated view
The primary physical table of justice and the corresponding left association from clause from physical table;
Step 240, select clause and the left association from the action statement that user is submitted to
Clause, is reconstructed into left operation associated sentence.
The concrete principle of above-mentioned steps is no longer gone to live in the household of one's in-laws on getting married chat herein with reference to the description of embodiment one.
If the action statement of user's submission in the embodiment of the present application, in pertaining only to define left associated view
Part physical table operation, because the embodiment of the present application is reconstructed left operation associated language to these physical tables
Sentence, so that system can only retrieve the physical table of the part, will not be to all defined in left associated view
Table is retrieved, and reduces the scope of the physical table of retrieval, improves retrieval rate, reduces accounting for for system resource
With.
Embodiment three
It is illustrated with right associated view.
Reference picture 3, flow chart the step of show a kind of data base query method embodiment of the application,
Specifically may include steps of:
Step 310, judges whether the action statement submitted to by user is operation language for right associated view
Sentence;Outermost primary physical table is grasped from the right association of physical table respectively with respectively defined in the right associated view
Make, the definition critical field operation associated from the physical table correspondence right side is major key field, and definition is each
The critical field being retrieved.
Certainly, in the embodiment of the present application, can include with pre-defined right associated view, its definition:Outermost
The primary physical table of layer respectively with it is respectively operation associated from the physical table right side, definition is described from the physical table correspondence right side
Operation associated critical field is major key field, the critical field that definition is respectively retrieved.
Step 320, if the action statement is directed to right associated view, according to the action statement of user
In select clause in each critical field, with each keyword for being retrieved in the definition of right associated view
Section is compared, and determines primary physical table to be operated and corresponding from physical table;
Step 330, the from clause in the action statement that user is submitted to determines in being reconstructed into right associated view
The primary physical table of justice and the corresponding right association from clause from physical table;
Step 340, select clause and the right association from the action statement that user is submitted to
Clause, is reconstructed into right operation associated sentence.
The concrete principle of above-mentioned steps is no longer gone to live in the household of one's in-laws on getting married chat herein with reference to the description of embodiment one.
If the action statement of user's submission in the embodiment of the present application, in pertaining only to define right associated view
Part physical table operation, because the embodiment of the present application is reconstructed right operation associated language to these physical tables
Sentence, so that system can only retrieve the physical table of the part, will not be to all defined in right associated view
Table is retrieved, and reduces the scope of the physical table of retrieval, improves retrieval rate, reduces accounting for for system resource
With.
It should be noted that for embodiment of the method, in order to be briefly described, therefore it is all expressed as one it is
The combination of actions of row, but those skilled in the art should know, and the embodiment of the present application is not by described
Sequence of movement limitation because according to the embodiment of the present application, some steps can using other orders or
Person is carried out simultaneously.Secondly, those skilled in the art should also know, embodiment described in this description
Preferred embodiment is belonged to, necessary to involved action not necessarily the embodiment of the present application.
Example IV
Reference picture 4, shows a kind of structured flowchart of database inquiry device embodiment of the application, tool
Body can include such as lower module:
Action statement judge module 410, whether the action statement for judging to be submitted to by user is for list
To the action statement of associated view;It is unidirectional closing between each physical table defined in the unidirectional associated view
Connection operation;
Physical table determining module 420, if being directed to unidirectional associated view, root for the action statement
According to the definition of the query object in the action statement and unidirectional associated view, to be checked each is determined
Physical table;
Unidirectional operation associated sentence reconstructed module 430, for based on the action statement, with described to be checked
Each physical table ask is the object to be operated, the unidirectional operation associated sentence of reconstruct.
In another preferred embodiment of the application, before action statement judge module 410, also include:
Unidirectional associated view creation module, for creating unidirectional associated view in database;It is described unidirectional
Defined in associated view outermost primary physical table respectively with respectively from physical form to operation associated, define institute
It is major key field to state from the physical table correspondence unidirectional operation associated critical field, what definition was respectively retrieved
Critical field.
In another preferred embodiment of the application, the physical table determining module 420 includes:
First physical table determining module, in the select clause in the action statement according to user
Each critical field being retrieved in each critical field, with the definition of unidirectional associated view is compared, it is determined that treating
The primary physical table of operation and corresponding from physical table.
In another preferred embodiment of the application, the unidirectional operation associated sentence reconstructed module 430 is wrapped
Include:
From clause reconstructs submodule, is reconstructed for the from clause in the action statement of submitting user to
The primary physical table and the corresponding unidirectional association from physical table defined in unidirectional associated view
From clause;
Complete clause's reconstructed module, for the select clause in the action statement of submitting user to and institute
Unidirectional association from clause is stated, unidirectional operation associated sentence is reconstructed into.
In another preferred embodiment of the application, also include defined in unidirectional associated view:
Define the access rights of user.
In another preferred embodiment of the application, before physical table determining module 420, also include:
Access privilege judge module, for the visit of the user of the definition according to the unidirectional associated view
Authority is asked, judges whether the user possesses the authority for accessing the unidirectional associated view;If the use
Family possesses the authority for accessing the unidirectional associated view, then into action statement judge module;If described
User possesses the authority for accessing the unidirectional associated view, then the action statement that refusal treatment user submits to.
In another preferred embodiment of the application, the unidirectional associated view includes left associated view or the right side
Associated view.
In another preferred embodiment of the application, when the unidirectional associated view is left associated view, institute
It is left association from clause to state unidirectional association from clause, and the unidirectional operation associated sentence is left association
Action statement;
When the unidirectional relationship view is right associated view, the unidirectional association from clause is right association
From clause, the unidirectional operation associated sentence is right operation associated sentence.
For device embodiment, because it is substantially similar to embodiment of the method, so the comparing of description
Simply, the relevent part can refer to the partial explaination of embodiments of method.
Each embodiment in this specification is described by the way of progressive, and each embodiment is stressed
Be all difference with other embodiment, between each embodiment identical similar part mutually referring to
.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present application can be provided as method, dress
Put or computer program product.Therefore, the embodiment of the present application can using complete hardware embodiment, completely
The form of the embodiment in terms of software implementation or combination software and hardware.And, the embodiment of the present application
Can use can be situated between in one or more computers for wherein including computer usable program code with storage
The computer program implemented in matter (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
In a typical configuration, the computer equipment includes one or more processors
(CPU), input/output interface, network interface and internal memory.Internal memory potentially includes computer-readable Jie
Volatile memory in matter, the shape such as random access memory (RAM) and/or Nonvolatile memory
Formula, such as read-only storage (ROM) or flash memory (flash RAM).Internal memory is computer-readable medium
Example.Computer-readable medium includes permanent and non-permanent, removable and non-removable media
Information Store can be realized by any method or technique.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
It is not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic randon access
Memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM),
Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, only
Read compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic
Cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus or any other non-transmission medium,
Can be used to store the information that can be accessed by a computing device.Defined according to herein, computer can
Read the medium not computer readable media (transitory media) including non-standing, such as modulation
Data-signal and carrier wave.
The embodiment of the present application is with reference to the method according to the embodiment of the present application, terminal device (system) and meter
The flow chart and/or block diagram of calculation machine program product is described.It should be understood that can be by computer program instructions
Realize each flow and/or square frame and flow chart and/or the square frame in flow chart and/or block diagram
The combination of flow and/or square frame in figure.Can provide these computer program instructions to all-purpose computer,
The processor of special-purpose computer, Embedded Processor or other programmable data processing terminal equipments is producing
One machine so that by the computing device of computer or other programmable data processing terminal equipments
Instruction produce for realizing in one flow of flow chart or multiple one square frame of flow and/or block diagram or
The device of the function of being specified in multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or other programmable datas to process
In the computer-readable memory that terminal device works in a specific way so that storage is in the computer-readable
Instruction in memory is produced and includes the manufacture of command device, and command device realization is in flow chart one
The function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can also be loaded into computer or other programmable data processing terminals set
It is standby upper so that execution series of operation steps is in terms of producing on computer or other programmable terminal equipments
The treatment that calculation machine is realized, so as to the instruction performed on computer or other programmable terminal equipments provides use
In realization in one flow of flow chart or multiple one square frame of flow and/or block diagram or multiple square frames
The step of function of specifying.
Although having been described for the preferred embodiment of the embodiment of the present application, those skilled in the art are once
Basic creative concept is known, then other change and modification can be made to these embodiments.So,
Appended claims are intended to be construed to include preferred embodiment and fall into the institute of the embodiment of the present application scope
Have altered and change.
Finally, in addition it is also necessary to explanation, herein, such as first and second or the like relational terms
It is used merely to make a distinction an entity or operation with another entity or operation, and not necessarily requires
Or imply between these entities or operation there is any this actual relation or order.And, art
Language " including ", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion so that
Process, method, article or the terminal device of a series of key elements must be included not only includes those key elements, and
And also include other key elements being not expressly set out, or also include being this process, method, article
Or the intrinsic key element of terminal device.In the absence of more restrictions, by sentence " including
It is individual ... " limit key element, it is not excluded that at the process including the key element, method, article or end
Also there is other identical element in end equipment.
Above to a kind of data base query method and a kind of database inquiry device provided herein, enter
Go and be discussed in detail, specific case used herein has been explained the principle and implementation method of the application
State, the explanation of above example is only intended to help and understands the present processes and its core concept;Meanwhile,
For those of ordinary skill in the art, according to the thought of the application, in specific embodiment and model is applied
Place and will change, in sum, this specification content should not be construed as the limitation to the application.
Claims (16)
1. a kind of data base query method, it is characterised in that including:
Judge whether the action statement submitted to by user is action statement for unidirectional associated view;It is described
It is unidirectional operation associated between each physical table defined in unidirectional associated view;
If the action statement is directed to unidirectional associated view, the inquiry in the action statement is right
As and unidirectional associated view definition, determine each physical table to be checked;
Based on the action statement, with each physical table to be checked as the object to be operated, reconstruct is unidirectional
Operation associated sentence.
2. method according to claim 1, it is characterised in that in the behaviour for judging to be submitted to by user
Before making the step of whether sentence is the action statement for unidirectional associated view, also include:
Unidirectional associated view is created in database;Outermost principal goods defined in the unidirectional associated view
Reason table is respectively with respectively from physical form to operation associated, and definition is described from the physical table correspondence unidirectional association
The critical field of operation is major key field, the critical field that definition is respectively retrieved.
3. method according to claim 2, it is characterised in that described according to the action statement
In query object and unidirectional associated view definition, wrap the step of determine each physical table to be checked
Include:
Each critical field in select clause in the action statement of user, regards with unidirectional association
Each critical field for being retrieved is compared in figure definition, determines primary physical table to be operated and corresponding
From physical table.
4. method according to claim 2, it is characterised in that described based on the action statement,
Wrapped with each physical table to be checked as the object to be operated, the step of reconstruct unidirectional operation associated sentence
Include:
From clause in the action statement that user is submitted to is reconstructed into the institute defined in unidirectional associated view
State primary physical table and the corresponding unidirectional association from clause from physical table;
Select clause in the action statement that user is submitted to it is described it is unidirectional associate from clause, weigh
Structure is unidirectional operation associated sentence.
5. according to the method that one of claim 1-4 is described, it is characterised in that unidirectional association is regarded
Also include defined in figure:
Define the access rights of user.
6. method according to claim 5, it is characterised in that according in the action statement
Query object and unidirectional associated view definition, the step of determine each physical table to be checked it
Before, also include:
The access rights of the user of the definition according to the unidirectional associated view, judge whether the user has
The standby authority for accessing the unidirectional associated view;
If the user possesses the authority for accessing the unidirectional associated view, into according to the operation
The definition of query object and unidirectional associated view in sentence, determines each step of physical table to be checked
Suddenly;
If the user possesses the authority for accessing the unidirectional associated view, refusal treatment user submit to
Action statement.
7. the method according to claim 1-4, it is characterised in that the unidirectional associated view bag
Include left associated view or right associated view.
8. method according to claim 7, it is characterised in that
When the unidirectional associated view is left associated view, the unidirectional association from clause is left association
From clause, the unidirectional operation associated sentence is left operation associated sentence;
When the unidirectional relationship view is right associated view, the unidirectional association from clause is right association
From clause, the unidirectional operation associated sentence is right operation associated sentence.
9. a kind of database inquiry device, it is characterised in that including:
Action statement judge module, whether the action statement for judging to be submitted to by user is for unidirectional pass
Join the action statement of view;It is unidirectional association behaviour between each physical table defined in the unidirectional associated view
Make;
Physical table determining module, if being directed to unidirectional associated view for the action statement, according to institute
The definition of the query object and unidirectional associated view in action statement is stated, each physics to be checked is determined
Table;
Unidirectional operation associated sentence reconstructed module, for based on the action statement, with described to be checked
Each physical table is the object to be operated, the unidirectional operation associated sentence of reconstruct.
10. device according to claim 9, it is characterised in that action statement judge module it
Before, also include:
Unidirectional associated view creation module, for creating unidirectional associated view in database;It is described unidirectional
Defined in associated view outermost primary physical table respectively with respectively from physical form to operation associated, define institute
It is major key field to state from the physical table correspondence unidirectional operation associated critical field, what definition was respectively retrieved
Critical field.
11. devices according to claim 10, it is characterised in that the physical table determining module
Including:
First physical table determining module, in the select clause in the action statement according to user
Each critical field being retrieved in each critical field, with the definition of unidirectional associated view is compared, it is determined that treating
The primary physical table of operation and corresponding from physical table.
12. devices according to claim 10, it is characterised in that the unidirectional operation associated language
Sentence reconstructed module includes:
From clause reconstructs submodule, is reconstructed for the from clause in the action statement of submitting user to
The primary physical table and the corresponding unidirectional association from physical table defined in unidirectional associated view
From clause;
Complete clause's reconstructed module, for the select clause in the action statement of submitting user to and institute
Unidirectional association from clause is stated, unidirectional operation associated sentence is reconstructed into.
13. according to one of claim 9-12 described device, it is characterised in that unidirectional association
Also include defined in view:
Define the access rights of user.
14. devices according to claim 13, it is characterised in that physical table determining module it
Before, also include:
Access privilege judge module, for the visit of the user of the definition according to the unidirectional associated view
Authority is asked, judges whether the user possesses the authority for accessing the unidirectional associated view;If the use
Family possesses the authority for accessing the unidirectional associated view, then into action statement judge module;If described
User possesses the authority for accessing the unidirectional associated view, then the action statement that refusal treatment user submits to.
15. device according to claim 9-12, it is characterised in that the unidirectional associated view
Including left associated view or right associated view.
16. devices according to claim 15, it is characterised in that
When the unidirectional associated view is left associated view, the unidirectional association from clause is left association
From clause, the unidirectional operation associated sentence is left operation associated sentence;
When the unidirectional relationship view is right associated view, the unidirectional association from clause is right association
From clause, the unidirectional operation associated sentence is right operation associated sentence.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511019215.9A CN106933842B (en) | 2015-12-29 | 2015-12-29 | Database query method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511019215.9A CN106933842B (en) | 2015-12-29 | 2015-12-29 | Database query method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106933842A true CN106933842A (en) | 2017-07-07 |
CN106933842B CN106933842B (en) | 2020-09-22 |
Family
ID=59441558
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201511019215.9A Active CN106933842B (en) | 2015-12-29 | 2015-12-29 | Database query method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106933842B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107480199A (en) * | 2017-07-17 | 2017-12-15 | 深圳先进技术研究院 | Query Reconstruction method, apparatus, equipment and the storage medium of database |
CN110399387A (en) * | 2019-07-26 | 2019-11-01 | 北京明略软件系统有限公司 | Method and device based on table incidence relation dynamic generation query SQL |
CN112905627A (en) * | 2021-03-23 | 2021-06-04 | 金岭教育科技(北京)有限公司 | Data processing method, data processing device, computer equipment and storage medium |
CN113032642A (en) * | 2019-12-24 | 2021-06-25 | 医渡云(北京)技术有限公司 | Data processing method, device and medium for target object and electronic equipment |
WO2023056934A1 (en) * | 2021-10-09 | 2023-04-13 | 北京字跳网络技术有限公司 | Data processing method and apparatus, and electronic device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102163195A (en) * | 2010-02-22 | 2011-08-24 | 北京东方通科技股份有限公司 | Query optimization method based on unified view of distributed heterogeneous database |
CN103617175A (en) * | 2013-11-04 | 2014-03-05 | 广东电子工业研究院有限公司 | Method for virtualization of large-scale distributed heterogeneous data |
US20150149436A1 (en) * | 2013-11-27 | 2015-05-28 | Paraccel Llc | Rewrite Constraints For Database Queries |
CN104714972A (en) * | 2013-12-17 | 2015-06-17 | 中国银联股份有限公司 | Database sub-table establishing and searching method |
US20150363399A1 (en) * | 2014-06-12 | 2015-12-17 | International Business Machines Corporation | Generating and accessing a data table |
-
2015
- 2015-12-29 CN CN201511019215.9A patent/CN106933842B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102163195A (en) * | 2010-02-22 | 2011-08-24 | 北京东方通科技股份有限公司 | Query optimization method based on unified view of distributed heterogeneous database |
CN103617175A (en) * | 2013-11-04 | 2014-03-05 | 广东电子工业研究院有限公司 | Method for virtualization of large-scale distributed heterogeneous data |
US20150149436A1 (en) * | 2013-11-27 | 2015-05-28 | Paraccel Llc | Rewrite Constraints For Database Queries |
CN104714972A (en) * | 2013-12-17 | 2015-06-17 | 中国银联股份有限公司 | Database sub-table establishing and searching method |
US20150363399A1 (en) * | 2014-06-12 | 2015-12-17 | International Business Machines Corporation | Generating and accessing a data table |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107480199A (en) * | 2017-07-17 | 2017-12-15 | 深圳先进技术研究院 | Query Reconstruction method, apparatus, equipment and the storage medium of database |
CN107480199B (en) * | 2017-07-17 | 2020-06-12 | 深圳先进技术研究院 | Query reconstruction method, device, equipment and storage medium of database |
CN110399387A (en) * | 2019-07-26 | 2019-11-01 | 北京明略软件系统有限公司 | Method and device based on table incidence relation dynamic generation query SQL |
CN113032642A (en) * | 2019-12-24 | 2021-06-25 | 医渡云(北京)技术有限公司 | Data processing method, device and medium for target object and electronic equipment |
CN113032642B (en) * | 2019-12-24 | 2024-02-09 | 医渡云(北京)技术有限公司 | Data processing method and device for target object, medium and electronic equipment |
CN112905627A (en) * | 2021-03-23 | 2021-06-04 | 金岭教育科技(北京)有限公司 | Data processing method, data processing device, computer equipment and storage medium |
WO2023056934A1 (en) * | 2021-10-09 | 2023-04-13 | 北京字跳网络技术有限公司 | Data processing method and apparatus, and electronic device |
Also Published As
Publication number | Publication date |
---|---|
CN106933842B (en) | 2020-09-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11341263B2 (en) | Efficient data query and utilization through a semantic storage model | |
US20200226151A1 (en) | System and method for supporting queries having sub-select constructs in a multidimensional database environment | |
Curé et al. | RDF database systems: triples storage and SPARQL query processing | |
US11520760B2 (en) | System and method for providing bottom-up aggregation in a multidimensional database environment | |
Rudolf et al. | The graph story of the SAP HANA database | |
Lee et al. | RFID data processing in supply chain management using a path encoding scheme | |
Bhogal et al. | Handling big data using NoSQL | |
Ma et al. | Storing massive Resource Description Framework (RDF) data: a survey | |
CN106933842A (en) | A kind of data base query method and device | |
US9684699B2 (en) | System to convert semantic layer metadata to support database conversion | |
US10452632B1 (en) | Multi-input SQL-MR | |
CN106557486A (en) | A kind of storage method and device of data | |
Frozza et al. | An approach for schema extraction of JSON and extended JSON document collections | |
US9176997B2 (en) | Universe migration from one database to another | |
US10360232B2 (en) | Semantic mapping of data from an entity-relationship model to a graph-based data format to facilitate simplified querying | |
Khan et al. | Predictive performance comparison analysis of relational & NoSQL graph databases | |
CN109101512A (en) | The construction method of law databases, law data query method and device | |
CN108241620B (en) | Query script generation method and device | |
Chevalier et al. | Document-oriented data warehouses: Complex hierarchies and summarizability | |
US20090049034A1 (en) | Ontology system providing enhanced search capability | |
US20190130020A1 (en) | Systems and methods for dynamic hierarchical metadata storage and retrieval | |
Hasan et al. | Data transformation from sql to nosql mongodb based on r programming language | |
Neznanov et al. | Advancing FCA workflow in FCART system for knowledge discovery in quantitative data | |
Serrano et al. | From relations to multi-dimensional maps: A SQL-to-hbase transformation methodology | |
CN103870497B (en) | Column intelligent mechanism for per-column database |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20211110 Address after: Room 16, room 1, 31st floor, changchanghui T2 office building, No. 9, Zhongbei Road, Wuchang District, Wuhan City, Hubei Province Patentee after: Alibaba (Hubei) Co., Ltd Address before: P.O. Box 847, 4th floor, Grand Cayman capital building, British Cayman Islands Patentee before: Alibaba Group Holdings Limited |
|
TR01 | Transfer of patent right |