CN106649301A - Data query method, device and system - Google Patents
Data query method, device and system Download PDFInfo
- Publication number
- CN106649301A CN106649301A CN201510712657.5A CN201510712657A CN106649301A CN 106649301 A CN106649301 A CN 106649301A CN 201510712657 A CN201510712657 A CN 201510712657A CN 106649301 A CN106649301 A CN 106649301A
- Authority
- CN
- China
- Prior art keywords
- request
- inquiry
- marks
- data
- query
- 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/95—Retrieval from the web
- G06F16/951—Indexing; Web crawling techniques
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a data query method, device and system, relates to the field of telecommunication technology and aims to solve the problem of non-correspondence, caused by delay, between a query result and query operation. The method comprises the steps that an unrepeatable request mark is generated for a query request to be sent; the query request carrying the request mark is sent to a server; a query response returned by the server is received, wherein the query response carries query data and the request mark carried by the query request corresponding to the query response; whether the received request mark is the same as the request mark carried by the query request sent the last time or not is judged; if the judgment result is yes, the query data is output. The data query method, device and system are mainly applied to the data query process based on an HTTP.
Description
Technical field
The present invention relates to technical field of telecommunications, more particularly to a kind of method of data query, device and
System.
Background technology
Data query is data interaction means the most basic in modern the Internet technology, should in browser
With and database inquiry system in be widely used in a variety of applications.Typical data query process is related to conduct
The client of query originator and the service end both sides as inquiry response side.Client is initiated one and is looked into
Request is ask, querying condition (for example needing the host address for accessing) is added in inquiry request and is sent
To service end.Service end is parsed to the content of inquiry request, is carried out data according to querying condition and is looked into
Ask, and Query Result (such as web data) is returned to into client by way of return inquiry response
End.
Inventor has found during existing data query:When client is successively initiated at short notice
Repeatedly during inquiry request, affected by various reasons, service end returns the sequencing of inquiry response and visitor
The sequencing of inquiry request is initiated at family end might not be ensure that unanimously.Specifically, in one kind
In the case of, when client by different HTTP (Hypertext Transfer Protocol,
Abbreviation HTTP) connection respectively to same service end send inquiry request when, by network transmission condition
Affect, the transmission speed of multiple HTTP connection can difference, inquiry request reaches the elder generation of service end
It is all irregular that afterwards order and inquiry response return to the sequencing of client, thus cause compared with
The early inquiry request for sending later may could obtain corresponding inquiry response.And in another case,
Client is connected respectively to different service end transmission inquiry requests by multiple HTTP.Pass in network
It is defeated it is consistent under conditions of, even if inquiry request can according to client send sequencing reach
Service end, but the loading level and processing speed of different service ends are had nothing in common with each other, and can equally be upset and be looked into
Ask the return order of response.For to sum up, no matter which kind of reason causes the appearance of the problems referred to above, as long as
Send inquiry request and receive and occur in that time delay between inquiry response, and client is during time delay
New inquiry request is initiated, then when formerly asking corresponding response to return, client will be by
Formerly response is exported as the Query Result in rear request, thus causes the inquiry knot that user sees
Fruit is not corresponding with the querying condition of input, so as to affect use of the user to inquiry service.
The content of the invention
The invention provides a kind of method of data query, apparatus and system, can solve the problem that because time delay is led
The Query Result of cause and the not corresponding problem of inquiry operation.
To solve the above problems, on the one hand, the invention provides a kind of method of data query, the party
Method includes:
Unduplicated request marks are generated for inquiry request to be sent;
The inquiry request for carrying request marks is sent to service end;
The inquiry response that service end is returned is received, inquiry data, and correspondence are carried in inquiry response
Request marks entrained by the inquiry request of inquiry response;
Judge that the request marks entrained by the inquiry request that the request marks for receiving send with last time are
It is no identical;
If the determination result is YES, then data are inquired about in output.
On the other hand, present invention also offers a kind of device of data query, the device includes:
Signal generating unit, for generating unduplicated request marks for inquiry request to be sent;
Transmitting element, for sending the inquiry request for carrying request marks to service end;
Receiving unit, for receiving the inquiry response of service end return, carries inquiry in inquiry response
Data, and the request marks entrained by the inquiry request of correspondence inquiry response;
Judging unit, for judging that the inquiry request that the request marks for receiving send with last time is taken
Whether the request marks of band are identical;
Output unit, for when judged result is to be, data to be inquired about in output.
Another further aspect, present invention also offers a kind of system of data query, the system includes client
And service end;
Client, for generating unduplicated request marks for inquiry request to be sent, to service end
Send the inquiry request for carrying request marks;
Service end, for responding inquiry request data query is carried out, and parsing inquiry request obtains request mark
Note, the inquiry that the inquiry data that request marks and data query are obtained are added to correspondence inquiry request is rung
Client is returned in answering;
Client, be additionally operable to receive service end return inquiry response, judge receive request marks with
Whether the request marks entrained by inquiry request that last time sends are identical, if the determination result is YES,
Data are inquired about in then output.
Method, the apparatus and system of the data query that the present invention is provided, can send to service end
Add a unique request marks in inquiry request, the request marks are added to into correspondence by service end
Client is returned in the inquiry response of the inquiry request.When inquiry response is received, client pair
Request marks in the inquiry request that request marks and last time send in inquiry response are compared.
If two request marks are identical, prove that the inquiry response for receiving is that correspondence last time inquiry please
The inquiry response asked, client is exported the Query Result in the inquiry response.With prior art
Compare, the present invention can be made corresponding to the client inquiry operation that directly output is finally performed with user
Query Result, thereby guarantees that the last inquiry operation of user is authentic and valid.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the present invention's
Technological means, and being practiced according to the content of specification, and in order to allow the above-mentioned of the present invention and
Other objects, features and advantages can become apparent, below especially exemplified by the specific embodiment of the present invention.
Description of the drawings
By the detailed description for reading hereafter preferred embodiment, various other advantage and benefit for
Those of ordinary skill in the art will be clear from understanding.Accompanying drawing is only used for illustrating the mesh of preferred embodiment
, and it is not considered as limitation of the present invention.And in whole accompanying drawing, with identical with reference to symbol
Number represent identical part.In the accompanying drawings:
Fig. 1 shows a kind of method flow diagram of data query provided in an embodiment of the present invention;
Fig. 2 shows the method flow diagram of another kind of data query provided in an embodiment of the present invention;
Fig. 3 shows a kind of composition frame chart of the device of data query provided in an embodiment of the present invention;
Fig. 4 shows the composition frame chart of the device of another kind of data query provided in an embodiment of the present invention;
Fig. 5 shows a kind of system block diagram of data query 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 showing in accompanying drawing
The exemplary embodiment of the disclosure is shown, it being understood, however, that may be realized in various forms the disclosure
And should not be limited by embodiments set forth here.On the contrary, there is provided these embodiments are able to more
Thoroughly understand the disclosure, and can be by the complete technology for conveying to this area of the scope of the present disclosure
Personnel.
Query Result to ensure client output is corresponding with the inquiry operation that user performs, the present invention
Embodiment gives a kind of method of data query.The core concept of the method is:Please by addition
The mode for seeking mark recognizes mutual corresponding inquiry request and inquiry response, and no matter user carry out it is several
Secondary inquiry operation, and the sequencing of inquiry response that service end is returned is how, client is only defeated
Go out Query Result corresponding with last time inquiry operation, thereby guarantee that user's last time inquiry operation
Validity.As shown in figure 1, the method includes:
101st, unduplicated request marks are generated for inquiry request to be sent.
Client is inquiry request to be sent and generates a request before inquiry request is initiated every time
Mark, the request marks are not repeatedly generated also not to be reused, and thereby guarantees that asking for each inquiry request
Ask mark unique effectively.
In practical application, client can temporarily generate a request marks before inquiry request is sent,
Multiple unduplicated request marks can also be previously generated, mark list or mark queue is pre-stored in
In, therefrom choose a request marks when inquiry request is initiated and distribute to inquiry request to be sent.
Opportunity of the present embodiment not to generating request marks limits.
102nd, the inquiry request for carrying request marks is sent to service end.
Client is added to the request marks of generation in the preset field of inquiry request, and to service end
Send the inquiry request for carrying request marks.In practical application, can be in client and service end both sides
Configuration identical proprietary protocol, it is intended that client adds the concrete field location of request marks, and clothes
The concrete field location of business end analysis request mark.And for cannot by rewrite agreement designated word section
Situation about putting, it is also possible to request marks are departed from and is individually sent in inquiry request.But to ensure
High relevancy between request marks and inquiry request, need to send request marks and inquiry request it
Between time interval strictly limited.Ideal, the time interval should be much smaller that artificial touching
Send out minimum interval that may be present between inquiry request twice.
It should be noted that the proprietary protocol described in the present embodiment refers to the protocol class that transport layer is used
Type, is including but not limited to transmission control protocol (Transmission Control Protocol, abbreviation TCP)
And UDP (User Datagram Protocol, abbreviation UDP), the present embodiment is not right
The such as HTTP (Hypertext Transfer Protocol, abbreviation HTTP) that application layer is used
Repelled etc. publicly-owned agreement.
103rd, the inquiry response that service end is returned is received.
Service end parses querying condition information after inquiry request is received, therefrom, and from specified
The request marks of client addition are parsed in field location.Then according to querying condition information searching pair
The inquiry data answered, and inquiry data are added in inquiry response as Query Result.It is different from existing
There is technology, service end can also be added to the request marks for parsing in inquiry response, so as to visitor
Family end subsequently recognizes that inquiry response is used.
Similar with step 102, the field location of service end addition request marks can also be by privately owned association
View is freely specified.In a kind of relatively simple implementation, client and service end can be added
The field location of request marks is appointed as same position.
104th, the request mark entrained by the inquiry request that the request marks for receiving send with last time is judged
Whether note is identical.
To realize the comparison to request marks, client needs the inquiry sent according to ordered pair when initiating
Request is cached.When inquiry response is received, client parses inquiry number from inquiry response
According to this and service end addition request marks, and parse and go to a party from the last item inquiry request of caching
The request marks that family end is added before this.Then two request marks to parsing respectively are compared.
It should be noted that the purpose of the present embodiment is to make client output with last time inquiry behaviour
Make corresponding Query Result, therefore no matter user carried out before this inquiry operation several times, need not
The request marks of parsing are compared with the request marks in formerly request.
105th, if the determination result is YES, then data are inquired about in output.
If two request marks are identical, then it represents that service end returns correspondence last time inquiry request
Inquiry response, what the inquiry data in the inquiry response necessarily to be obtained for last time inquiry operation
Query Result, therefore the inquiry data output is fed back to user by client.
If two request marks differences, then it represents that service end returns the inquiry of the first inquiry request of correspondence
Response.Because user has been initiated at least one times in rear inquiry operation after first inquiry operation is initiated again,
It is now without practical significance therefore objective to user by the corresponding inquiry data feedback of first inquiry operation
Family end can be especially processed the inquiry response of the first inquiry request of correspondence.In practical application, compared with
Processing mode to save storage resource is directly to abandon the inquiry data in first inquiry response.
Certainly, in the case of some consider inquiry service quality, client can also be to first inquiry response
In inquiry data preserved, fed back to user subsequently to select a good opportunity.
It should be noted that all data of the method for the present embodiment offer suitable for real life are looked into
Scene is ask, these scenes are including but not limited to:By browse request web page contents, by APP
Carry out vertical search and data base querying etc. is carried out in private network.
Explanation is compared to prior art and Fig. 1 methods below by a simple example:
Assume that user sends inquiry request 1,16 sections of Audi A4L of requesting query to vertical search server
Price H of complete set vehicle, because now server load is higher, therefore does not do to inquiry request 1
Go out to timely respond to;Hereafter user sends inquiry request 2,15 sections of benz C200 of requesting query to server again
Price L of complete set vehicle.After client sends inquiry request 2, server is to inquiry request 1
Respond, price H is added in inquiry response 1 and returns to client.In the prior art,
Client is directly exported after inquiry response 1 is received to price H therein, but now
User makes second inquiry operation for producing inquiry request 2, and its Query Result expected is right
Price L of second inquiry operation is answered, in this case carries out price H to export obviously not proper.
And in method shown in Fig. 1, client with the addition of request marks in the inquiry request 1 for sending
" 110 ", in the inquiry request 2 for sending request marks " 203 " are with the addition of.Server is in response inquiry
When asking 1, request marks therein " 110 " are added in inquiry response 1, together with price H mono-
It is same to return to client.Client after inquiry response 1 is received, by request marks therein " 110 "
Compare with the request marks " 203 " in the inquiry request 2 of rear transmission, it is found that both are different,
Client abandons price H.Hereafter, server returns carrying request marks " 203 " and price L again
Inquiry response 2.Client will respond asking in request marks " 203 " and inquiry request 2 in 2
Ask mark " 203 " to compare, find both identical, client export prices L, price L is just
It is Query Result that user is currently expected.
By above-mentioned example it can be seen that:In prior art, Query Result and user that client is exported
The inquiry operation " dislocation " for carrying out, from the angle that inquiry is expected, this mode obtains cannot user
Obtain effective Query Result.Comparatively, although method shown in Fig. 1 sacrifices first Query Result
Output, but ensure that the last time inquiry operation of user can obtain corresponding Query Result,
So as to the validity of the guarantee section inquiry operation under conditions of it cannot avoid responding time delay.
Further, as the refinement to method shown in Fig. 1, the embodiment of the present invention additionally provides one kind
The method of data query.As shown in Fig. 2 the method includes:
201st, unduplicated request marks are generated for inquiry request to be sent.
Can be able to be that pseudo random number, information are plucked as the parameter that request marks are used in the present embodiment
Want algorithm (Message-Digest Algorithm 5, abbreviation MD5) value or timestamp.Divide below
Use not against three kinds of parameters is introduced:
1st, pseudo random number
The characteristics of client-side is implanted with a pseudo random number generating functon, the function itself is each
The pseudo random number of generation does not repeat mutually.When data query is carried out, client can Dan Qiyi line
The running status of the programs such as range monitoring browser.When inquiry request is produced, the thread passes through hook letters
Number sending action is intercepted and captured, and redirect call pseudo random number generating functon generate pseudo random number.
In a kind of implementation of the present embodiment, when being compiled using C language, can be direct
Pseudorandom number generator function being provided using C language compiler, based on ansi standards.This letter
Number is made up of two sub- functions of srand () and rand ().It is first srand () when pseudo random number is generated
Offer one entitled " seed ", the initial value that type is unsigned int, the value of the initial value
Scope is 0~65535.Can at random be divided using quick counter register or shift register under normal circumstances
With the seed.Then rand () is called, a pseudo random number is returned according to the seed of srand (), should
Pseudo random number is randomly selected in 0~32767 span.When need to generate it is next pseudo- with
Repeat to call rand () during machine number, a new pseudorandom is still randomly choosed out from above-mentioned span
Number.Because there is in theory rand () mechanism for not repeating selection (repeatedly to call what rand () was selected
Although pseudo random number is all fallen within above range, will not repeat each other), therefore the present embodiment
In multiple different pseudo random numbers can be generated based on seed.
But in actual applications, the above-mentioned mechanism for not repeating selection is not a full probability event,
Multiple pseudo random numbers for selecting have the possibility that repeats compared with small probability, and (this is also " pseudo random number " name
The origin of title).In particular with being on the increase for generation pseudo random number quantity, subsequently selected pseudo random number
Span will be less and less, therefore repeat select pseudo random number probability will be increasing.
To prevent the pseudo random number of repetition, in a kind of improvement project of the present embodiment, can be according to pre-
If generation number of times change seed.For example 1000 pseudo random numbers are being generated by a seed
Afterwards, for srand () be randomly assigned a new seed again, and by rand () according to new seed after
It is continuous to generate pseudo random number.The random change of seed can further improve the degree of randomization of rand (),
Thus the probability that pseudo random number repeats is reduced.
In practical application, default generation number of times, example can be set according to the span of pseudo random number
Such as can will generate number of times and be set as 32768/2=16384, or 32768/4=8192.Certainly generate secondary
Number can also be a fixed value, such as 1000 in above-mentioned example time, the present embodiment is not given birth to default
Concrete numerical value into number of times is limited.
2nd, MD5 values
In the present embodiment, MD5 computings can also be carried out to the querying condition in inquiry request, will be obtained
MD5 values use as request marks.Due to the querying condition of different inquiry requests it is different, because
The MD5 values that this is calculated will not repeat.
In practical application, for the inquiry request of requested webpage content, unification that can be to wherein carrying
URLs (Uniform Resource Locator, abbreviation URL) does MD5 computings, such as right
URL“http://localhost:7777/user.doName=uu&sex=male" do MD5 computings;Also may be used
Only to carry out MD5 computings to the inquiry string in URL, such as in above-mentioned URL
" name=uu&sex=male " does MD5 computings.For data base querying request, then can be by wherein
Inquiry field carry out MD5 computings.The present embodiment is not limited the concrete object of MD5 computings.
3rd, timestamp
Timestamp can be generated with the time produced according to inquiry request in the present embodiment, timestamp is used
As request marks.The generation time of the inquiry request produced generally, based on user operation is different,
In other words user typically cannot initiate multiple inquiry request simultaneously on synchronization.Therefore inquiry request
Generation time be unique.In practical application, client can be obtained in request when inquiry request is generated
Current system clock is taken, the system time value of acquisition is used as timestamp.Additionally, client
Can also be counted by an independent thread upon actuation, when inquiry request is generated, be read
Current count value is used as relative time stamp.
It should be noted that there may be in practical application by application process while triggering multiple backstages looking into
The situation of request is ask, that is, there is the concurrent inquiry request of non-artificial triggering.Due to concurrent inquiry request
Timestamp is identical, therefore is not used as request marks.To this such case, client can be by the time
The information of the relative uniqueness that stamp can embody inquiry request with other is combined, used as request marks
Use.It is exemplary, can be used as request marks information combination can for " timestamp+process numbering/
Title " or " timestamp+host domain name ".
The implementation that pseudo random number, MD5 values and timestamp are used as request marks is carried out above
Introduce.In practical application, above-mentioned three kinds of parameters individually or can be mutually combined and be used as request marks.
202nd, request marks are added in inquiry request.
At present, the most commonly used application layer protocol that data query technique is used is http protocol, this
Embodiment will be illustrated by taking http protocol as an example.
HTTP request includes request row, head field (head) and the part of body field (body) three.Its
In, request row is to record request type, access the information such as resource and HTTP versions, head field
To illustrate the additional information that server is used, arbitrary data message can be then added in body field.
Client can be added to request marks in body field in the present embodiment.Further, since in lead-in section
Content can also be appropriately modified, therefore request marks are added in lead-in section in practical application
It is also feasible.
203rd, the inquiry request for carrying request marks is sent to service end.
204th, the inquiry request for having sent is added into local storehouse.
Inquiry request needs to be stored in client locally after service end is sent to, for follow-up ratio
Request marks are used.In the present embodiment, client is according to the sequencing for sending by different inquiries
Request order is added in storehouse and is preserved.Storehouse has characteristic " first-in last-out ", sends out earliest
The inquiry request sent deposits in stack bottom, and the inquiry request for sending the latest then deposits in stack top.Using the spy
Property, last time is obtained by client directly reads the content in stack top when request marks are compared and is sent out
The inquiry request sent.
205th, the inquiry response that service end is returned is received.
For single client, by protecting to pseudo random number, the isoparametric use of MD5 values
The request marks demonstrate,proved in each inquiry request do not repeat.But service end can be carried out with substantial amounts of client
Interaction, the process that request marks are generated between each client is separate, it is impossible to ensure different
Request marks in the inquiry request of client do not repeat.In the present embodiment, it is not necessary that ensure
The request marks that different clients are generated are necessarily different, and service end is without the need for the request mark to different clients
Note makes a distinction, even without the particular content of concern request marks, it is only necessary to will solve in inquiry request
The request marks " remaining untouched " of precipitation are added to should be in the inquiry response of inquiry request.
206th, asking entrained by the inquiry request that the request marks for receiving are preserved with local storehouse stack top is judged
Ask mark whether it is identical.
Affected by network delay or service end load state, inquiry response return order may be disturbed.
Client is without the need for judging also judge which inquiry request the inquiry response for receiving corresponds to.Therefore,
Client is intended to once read the stack top content of storehouse when inquiry response is received every time,
The last inquiry request for sending is obtained, and therefrom parses corresponding request marks.Then this is marked
Mutually compare with the request marks parsed in inquiry response.If both are identical, then it represents that reception is looked into
Ask response corresponding with the last inquiry request for sending, execution step 207 is exported in the inquiry response
Inquiry data;If both are different, then it represents that the inquiry response of reception is the first inquiry request of correspondence
Inquiry response, because now user is it is contemplated that the corresponding inquiry data of last time inquiry operation, defeated
The inquiry data for going out first inquiry operation are nonsensical, therefore client executing step 208, will inquire about
Inquiry data in response are abandoned.
207th, if the determination result is YES, then data are inquired about in output.
Output described in the present embodiment includes carrying out not similar shape to data message by different types of peripheral hardware
The displaying of formula, client can carry out image output by display in practical application, it is also possible to pass through
Loudspeaker carries out audio output.For the relatively conventional image way of output, client will can be inquired about
Data display or in the window of APP, then or is displayed in specific data in browser page
In library inquiry interface.The present embodiment is not limited the mode and peripheral type of output inquiry data.
If the 208, judged result is no, inquiry data are abandoned.
Further, it is contemplated that user is carried out sometimes for the inquiry data to some first inquiry operations
Check, be to improve the incomplete problem of Query Result feedback caused by formerly inquiry data that abandons, as
The replacement of step 208, the present embodiment can also delay to the corresponding Query Result of first inquiry operation
Deposit, in case subsequently select a good opportunity carrying out output displaying.Specifically, after performing step 206, if
Request marks are compared and differed, then client is successively read the remaining inquiry request deposited in storehouse, and
Request marks in each inquiry request are parsed and is compared with the request marks in the inquiry response
It is right.Because the request marks in inquiry response are that client is generated when inquiry request is sent, therefore
The inquiry request comprising the request marks necessarily can be found in storehouse.Please when corresponding inquiry is found
When asking, client using the inquiry data in inquiry response as historical query data, with looking into for finding
The attribute information for asking request is associated output.Wherein, the attribute information is mainly used in for user couple
Inquiry operation is distinguished, and it is the querying condition in inquiry request that can be, but not limited to, such as URL or
Inquiry field etc..By the attribute information and the row included in certain window/interface for inquiring about data correlation
In table, so that user checks to the Query Result of all previous inquiry operation.
In last a kind of implementation of the present embodiment, if not using the alternative of step 208,
So in execution step 204, it is also possible to do not use storehouse to preserve inquiry request.Due to without the need for past
Secondary inquiry request is recalled, therefore client to all inquiry requests without the need for all preserving, only
Need to preserve the inquiry request that last time sends.Thus in this implementation, client is opened
Warding off a fritter can store the spatial cache of an inquiry request.When have sent new inquiry request
Afterwards, client will be stored in the memory space in rear inquiry request, the first inquiry to original storage
Request is replaced.Because at any time client need to only preserve an inquiry request, therefore this
Implementation can reduce the occupancy degree to caching, while the complexity that may be omitted with clearing up caching is patrolled
Volume, the internal memory that can significantly optimize client is used.
Further, as the realization to method shown in Fig. 1 or Fig. 2, another embodiment of the present invention is also
There is provided a kind of device of data query.This device embodiment is corresponding with preceding method embodiment, can
Realize the full content in preceding method embodiment.For ease of reading, this device embodiment is only to aforementioned
Content in embodiment of the method carries out summary description, the detail content in embodiment of the method is not carried out
Repeat one by one.As shown in figure 3, the device includes:Signal generating unit 31, transmitting element 32, reception are single
Unit 33, judging unit 34 and output unit 35.Wherein,
Signal generating unit 31, for generating unduplicated request marks for inquiry request to be sent;
Transmitting element 32, for sending the inquiry request for carrying request marks to service end;
Receiving unit 33, for receiving the inquiry response of service end return, carries in inquiry response and looks into
Ask data, and the request marks entrained by the inquiry request of correspondence inquiry response;
Judging unit 34, for judging the inquiry request institute that the request marks for receiving send with last time
Whether the request marks of carrying are identical;
Output unit 35, for when judged result is to be, data to be inquired about in output.
Further, as shown in figure 4, signal generating unit 31, including:
First generation module 311, for generating pseudo random number by pseudo random number generating functon;
Second generation module 312, for carrying out message digest algorithm to the querying condition in inquiry request
MD5 is calculated, and generates MD5 values;
3rd generation module 313, the time for being produced according to inquiry request generates timestamp.
Further, the first generation module 311, is used for:When request marks are pseudo random number, according to
Default generation number of times changes seed.
Further, as shown in figure 4, the device is further included:
Unit 36 is added, for before the inquiry response that service end is returned is received, by looking into for having sent
Ask request and add local storehouse;
Judging unit 34, for judging that the inquiry that the request marks for receiving and local storehouse stack top are preserved please
Whether the request marks entrained by asking are identical.
Further, as shown in figure 4, the device is further included:
Searching unit 37, for when judged result is no, searching corresponding with the request marks for receiving
Inquiry request;
Output unit 35, for data will to be inquired about as historical query data, please with the inquiry for finding
The attribute information asked is associated output.
The device of the data query includes processor and memory, and above-mentioned signal generating unit 31, transmission are single
Unit 32, receiving unit 33, judging unit 34, output unit 35 etc. are stored in as program unit
In memory, corresponding work(is realized by computing device storage said procedure unit in memory
Energy.
Kernel is included in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can
To arrange one or more, client directly output and last initiation are ensured by adjusting kernel parameter
Inquiry request corresponding to Query Result.
Memory potentially includes the volatile memory in computer-readable medium, random access memory
The form such as device (RAM) and/or Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash
RAM), memory includes at least one storage chip.
Present invention also provides a kind of computer program, when performing on data processing equipment,
It is adapted for carrying out initializing the program code of there are as below methods step:Generate not for inquiry request to be sent
The request marks for repeating;The inquiry request for carrying request marks is sent to service end;Receive service end to return
The inquiry response for returning, carries inquiry data in inquiry response, and the inquiry of correspondence inquiry response please
Seek entrained request marks;Judge the inquiry request institute that the request marks for receiving send with last time
Whether the request marks of carrying are identical;If the determination result is YES, then data are inquired about in output.
Further, as the realization to method shown in Fig. 1 or Fig. 2, another embodiment of the present invention is also
There is provided a kind of system of data query.The system embodiment is corresponding with preceding method embodiment, can
Realize the full content in preceding method embodiment.For ease of reading, the system embodiment is only to aforementioned
Content in embodiment of the method carries out summary description, the detail content in embodiment of the method is not carried out
Repeat one by one.As shown in figure 5, the system includes:Client 51 and service end 52, wherein, client
End 51 includes the device shown in aforementioned Fig. 3 or Fig. 4, or independently of the device but with the device it
Between have data interaction relation, to the repertoire for realizing the device.Specifically:
Client 51, for generating unduplicated request marks for inquiry request to be sent, to service
End 52 sends the inquiry request for carrying request marks;
Service end 52, for responding inquiry request data query is carried out, and parsing inquiry request is asked
The inquiry data that request marks and data query are obtained are added to the inquiry of correspondence inquiry request by mark
Client 51 is returned in response;
Client 51, is additionally operable to receive the inquiry response that service end 52 is returned, and judges the request mark for receiving
Remember whether the request marks entrained by the inquiry request sent with last time are identical, if judged result is
It is, then output inquiry data.
The apparatus and system of data query provided in an embodiment of the present invention, can send to service end
Add a unique request marks in inquiry request, the request marks are added to into correspondence by service end
Client is returned in the inquiry response of the inquiry request.When inquiry response is received, client pair
Request marks in the inquiry request that request marks and last time send in inquiry response are compared.
If two request marks are identical, prove that the inquiry response for receiving is that correspondence last time inquiry please
The inquiry response asked, client is exported the Query Result in the inquiry response.With prior art
Compare, the embodiment of the present invention can make the client inquiry operation institute that directly output is finally performed with user
Corresponding Query Result, thereby guarantees that the last inquiry operation of user is authentic and valid.
Those skilled in the art it should be appreciated that embodiments herein can be provided as method, system,
Or computer program.Therefore, the application can be implemented using complete hardware embodiment, complete software
Example or with reference to the form of the embodiment in terms of software and hardware.And, the application can be adopted at one
Or it is multiple wherein include computer usable program code computer-usable storage medium (including but not
Be limited to magnetic disc store, CD-ROM, optical memory etc.) on the computer program implemented
Form.
The application is with reference to the method according to the embodiment of the present application, equipment (system) and computer program
The flow chart and/or block diagram of product is describing.It should be understood that can be realized flowing by computer program instructions
In each flow process and/or square frame and flow chart and/or block diagram in journey figure and/or block diagram
Flow process and/or square frame combination.Can provide these computer program instructions to all-purpose computer, specially
With the processor of computer, Embedded Processor or other programmable data processing devices producing one
Machine so that produced by the instruction of computer or the computing device of other programmable data processing devices
It is raw to be used to realize in one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or multiple sides
The device of the function of specifying in frame.
These computer program instructions may be alternatively stored in can guide computer or other programmable datas to process
In the computer-readable memory that equipment works in a specific way so that be stored in the computer-readable and deposit
Instruction in reservoir is produced and includes the manufacture of command device, and command device realization is in flow chart one
The function of specifying in flow process or one square frame of multiple flow processs and/or block diagram or multiple square frames.
These computer program instructions can also be loaded into computer or other programmable data processing devices
On so that series of operation steps is performed on computer or other programmable devices to produce computer
The process of realization, so as to the instruction performed on computer or other programmable devices is provided for realizing
Specify in one flow process of flow chart or one square frame of multiple flow processs and/or block diagram or multiple square frames
The step of function.
In a typical configuration, computing device include one or more processors (CPU), input/
Output interface, network interface and internal memory.
Memory potentially includes the volatile memory in computer-readable medium, random access memory
The form such as device (RAM) and/or Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash
RAM).Memory is the example of computer-readable medium.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be with
Information Store is realized by any method or technique.Information can be computer-readable instruction, data knot
Structure, the module of program or other data.The example of the storage medium of computer includes, but are not limited to phase
Become internal memory (PRAM), static RAM (SRAM), dynamic random access memory
(DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electricity can
Erasable programmable read-only memory (EPROM) (EEPROM), fast flash memory bank or other memory techniques, read-only light
Disk read-only storage (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.Define according to herein, computer-readable
Medium does not include temporary computer readable media (transitory media), the such as data-signal and load of modulation
Ripple.
Embodiments herein is these are only, the application is not limited to.For this area skill
For art personnel, the application can have various modifications and variations.It is all spirit herein and principle it
Interior made any modification, equivalent substitution and improvements etc., should be included in claims hereof model
Within enclosing.
Claims (10)
1. a kind of method of data query, it is characterised in that methods described includes:
Unduplicated request marks are generated for inquiry request to be sent;
The inquiry request for carrying the request marks is sent to service end;
The inquiry response that the service end is returned is received, inquiry data is carried in the inquiry response,
And the request marks entrained by the inquiry request of the correspondence inquiry response;
Judge that the request marks entrained by the inquiry request that the request marks for receiving send with last time are
It is no identical;
If the determination result is YES, then the inquiry data are exported.
2. method according to claim 1, it is characterised in that it is described please for inquiry to be sent
Unduplicated request marks are sought survival into, including:
Pseudo random number is generated by pseudo random number generating functon;Or,
The calculating of message digest algorithm MD5 is carried out to the querying condition in the inquiry request, MD5 is generated
Value;Or,
Timestamp is generated according to the time that the inquiry request is produced.
3. method according to claim 2, it is characterised in that if the request marks for it is pseudo- with
Machine number, then methods described further include:
Seed is changed according to default generation number of times.
4. method according to claim 1, it is characterised in that receive the service end described
Before the inquiry response of return, methods described is further included:
The inquiry request for having sent is added into local storehouse;
The request mark entrained by inquiry request that the request marks for judging to receive send with last time
Whether note is identical, including:
Judge the request mark entrained by the inquiry request that the request marks for receiving are preserved with local storehouse stack top
Whether note is identical.
5. method according to any one of claim 1 to 4, it is characterised in that if judging knot
Fruit is no, then methods described is further included:
Search inquiry request corresponding with the request marks for receiving;
Using the inquiry data as historical query data, the attribute with the inquiry request for finding
Information is associated output.
6. a kind of device of data query, it is characterised in that described device includes:
Signal generating unit, for generating unduplicated request marks for inquiry request to be sent;
Transmitting element, for sending the inquiry request for carrying the request marks to service end;
Receiving unit, for receiving the inquiry response that the service end is returned, takes in the inquiry response
With inquiry data, and the correspondingly request marks entrained by the inquiry request of the inquiry response;
Judging unit, for judging that the inquiry request that the request marks for receiving send with last time is taken
Whether the request marks of band are identical;
Output unit, for when judged result is to be, exporting the inquiry data.
7. device according to claim 6, it is characterised in that signal generating unit, including:
First generation module, for generating pseudo random number by pseudo random number generating functon;
Second generation module, for carrying out message digest algorithm to the querying condition in the inquiry request
MD5 is calculated, and generates MD5 values;
3rd generation module, the time for being produced according to the inquiry request generates timestamp.
8. device according to claim 6, it is characterised in that described device is further included:
Unit is added, for before the inquiry response that the service end is returned is received, by what is sent
Inquiry request adds local storehouse;
The judging unit, for judging the inquiry that the request marks for receiving are preserved with local storehouse stack top
Whether the entrained request marks of request are identical.
9. the device according to any one of claim 6 to 8, it is characterised in that described device
Further include:
Searching unit, for when judged result is no, searching looks into corresponding with the request marks for receiving
Ask request;
The output unit, as historical query data, and finds for using the inquiry data
The attribute information of the inquiry request is associated output.
10. a kind of system of data query, it is characterised in that the system includes client and service
End;
The client, for generating unduplicated request marks for inquiry request to be sent, to institute
State service end and send the inquiry request for carrying the request marks;
The service end, for responding the inquiry request data query is carried out, and parsing the inquiry please
The acquisition request marks are sought, the inquiry data that the request marks and data query are obtained are added to
The client is returned in the inquiry response of the correspondence inquiry request;
The client, is additionally operable to receive the inquiry response that the service end is returned, and judges that what is received asks
Ask and mark the request marks entrained by the inquiry request sent with last time whether identical, if judging knot
Fruit is yes, then export the inquiry data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510712657.5A CN106649301B (en) | 2015-10-28 | 2015-10-28 | Data query method, device and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510712657.5A CN106649301B (en) | 2015-10-28 | 2015-10-28 | Data query method, device and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106649301A true CN106649301A (en) | 2017-05-10 |
CN106649301B CN106649301B (en) | 2020-09-11 |
Family
ID=58816124
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510712657.5A Active CN106649301B (en) | 2015-10-28 | 2015-10-28 | Data query method, device and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106649301B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109299117A (en) * | 2017-07-25 | 2019-02-01 | 北京国双科技有限公司 | The treating method and apparatus of request of data, storage medium, processor |
CN109361767A (en) * | 2018-12-06 | 2019-02-19 | 苏州思必驰信息科技有限公司 | Optimize server-side, client process method and the server of client data display error, be able to carry out the client that data are shown |
CN109428919A (en) * | 2017-08-28 | 2019-03-05 | 阿里巴巴集团控股有限公司 | The treating method and apparatus and electronic equipment of Web Page Processing request |
CN110147509A (en) * | 2019-04-04 | 2019-08-20 | 浙江口碑网络技术有限公司 | Page furbishing method and device |
CN112395316A (en) * | 2020-11-10 | 2021-02-23 | 杭州萤石软件有限公司 | Data query method and device |
CN112506696A (en) * | 2021-01-22 | 2021-03-16 | 马瑞利汽车电子(广州)有限公司 | Method for preventing request between modules from being lost |
WO2021082600A1 (en) * | 2019-10-28 | 2021-05-06 | 北京字节跳动网络技术有限公司 | Webpage image monitoring method and apparatus, electronic device, and computer readable storage medium |
CN116132248A (en) * | 2022-10-11 | 2023-05-16 | 马上消费金融股份有限公司 | Information pushing method and computer readable storage medium |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11338712A (en) * | 1998-05-22 | 1999-12-10 | Nec Corp | Interruption sequence saving circuit |
CN101505478A (en) * | 2009-03-06 | 2009-08-12 | 成都市华为赛门铁克科技有限公司 | Method, apparatus and system for filtering packets |
CN101938693A (en) * | 2010-08-18 | 2011-01-05 | 惠州Tcl移动通信有限公司 | Mobile terminal position information query method and system |
CN103078873A (en) * | 2013-01-29 | 2013-05-01 | 大唐移动通信设备有限公司 | Asynchronous fault tolerance method, device and equipment for message |
US20130166370A1 (en) * | 2011-12-22 | 2013-06-27 | Sohalo | Rewards system and method |
CN103399832A (en) * | 2013-08-21 | 2013-11-20 | 中国人民解放军国防科学技术大学 | Ordering method of out-of-order return data between buses |
CN104394227A (en) * | 2014-12-05 | 2015-03-04 | 北京奇虎科技有限公司 | Method and system for transmitting user data of browser and browser |
CN104657364A (en) * | 2013-11-18 | 2015-05-27 | 华为技术有限公司 | Log-structured database system query processing method and device |
-
2015
- 2015-10-28 CN CN201510712657.5A patent/CN106649301B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH11338712A (en) * | 1998-05-22 | 1999-12-10 | Nec Corp | Interruption sequence saving circuit |
CN101505478A (en) * | 2009-03-06 | 2009-08-12 | 成都市华为赛门铁克科技有限公司 | Method, apparatus and system for filtering packets |
CN101938693A (en) * | 2010-08-18 | 2011-01-05 | 惠州Tcl移动通信有限公司 | Mobile terminal position information query method and system |
US20130166370A1 (en) * | 2011-12-22 | 2013-06-27 | Sohalo | Rewards system and method |
CN103078873A (en) * | 2013-01-29 | 2013-05-01 | 大唐移动通信设备有限公司 | Asynchronous fault tolerance method, device and equipment for message |
CN103399832A (en) * | 2013-08-21 | 2013-11-20 | 中国人民解放军国防科学技术大学 | Ordering method of out-of-order return data between buses |
CN104657364A (en) * | 2013-11-18 | 2015-05-27 | 华为技术有限公司 | Log-structured database system query processing method and device |
CN104394227A (en) * | 2014-12-05 | 2015-03-04 | 北京奇虎科技有限公司 | Method and system for transmitting user data of browser and browser |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109299117A (en) * | 2017-07-25 | 2019-02-01 | 北京国双科技有限公司 | The treating method and apparatus of request of data, storage medium, processor |
CN109428919A (en) * | 2017-08-28 | 2019-03-05 | 阿里巴巴集团控股有限公司 | The treating method and apparatus and electronic equipment of Web Page Processing request |
CN109428919B (en) * | 2017-08-28 | 2022-02-25 | 阿里巴巴集团控股有限公司 | Webpage processing request processing method and device and electronic equipment |
CN109361767A (en) * | 2018-12-06 | 2019-02-19 | 苏州思必驰信息科技有限公司 | Optimize server-side, client process method and the server of client data display error, be able to carry out the client that data are shown |
CN110147509A (en) * | 2019-04-04 | 2019-08-20 | 浙江口碑网络技术有限公司 | Page furbishing method and device |
WO2021082600A1 (en) * | 2019-10-28 | 2021-05-06 | 北京字节跳动网络技术有限公司 | Webpage image monitoring method and apparatus, electronic device, and computer readable storage medium |
CN112395316A (en) * | 2020-11-10 | 2021-02-23 | 杭州萤石软件有限公司 | Data query method and device |
CN112395316B (en) * | 2020-11-10 | 2023-08-29 | 杭州萤石软件有限公司 | Data query method and device |
CN112506696A (en) * | 2021-01-22 | 2021-03-16 | 马瑞利汽车电子(广州)有限公司 | Method for preventing request between modules from being lost |
CN116132248A (en) * | 2022-10-11 | 2023-05-16 | 马上消费金融股份有限公司 | Information pushing method and computer readable storage medium |
CN116132248B (en) * | 2022-10-11 | 2024-05-24 | 马上消费金融股份有限公司 | Information pushing method and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN106649301B (en) | 2020-09-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106649301A (en) | Data query method, device and system | |
US20230169084A1 (en) | Interactive visualization of a relationship of isolated execution environments | |
US20220035600A1 (en) | API Specification Generation | |
CN105959433B (en) | A kind of domain name analytic method and its domain name analysis system | |
CN105404622B (en) | A kind of customer terminal webpage display methods, apparatus and system | |
CN101409706B (en) | Method, system and relevant equipment for distributing data of edge network | |
CN103365865B (en) | Date storage method, data download method and its device | |
US8037076B2 (en) | Federated indexing from hashed primary key slices | |
CN104714965B (en) | Static resource De-weight method, static resource management method and device | |
CN108737534B (en) | Block chain-based data transmission method and device and block chain system | |
US20140372472A1 (en) | Data augmentation | |
CN106649304A (en) | Method, device and system for data query | |
US8176097B2 (en) | Maintaining data coherency within related multi-perspective user interfaces via session-less queries | |
CN108429785A (en) | A kind of generation method, reptile recognition methods and the device of reptile identification encryption string | |
US11347808B1 (en) | Dynamically-adaptive bloom-filter | |
CN102882974A (en) | Method for saving website access resource by website identification version number | |
CN109657174A (en) | Method and apparatus for more new data | |
CN107070988A (en) | Message processing method and device | |
CN107046551B (en) | A kind of request of data, update method and related device | |
CN111966967A (en) | Copyright storage method and system based on block chain technology and CDN | |
US20170374154A1 (en) | Generating a response to a client device in an internet of things domain | |
US10491606B2 (en) | Method and apparatus for providing website authentication data for search engine | |
CN109343975A (en) | Method and apparatus for asynchronous communication between the page | |
CN107844488A (en) | Data query method and apparatus | |
CN110020243A (en) | Querying method, device, Internet of Things server and the storage medium of internet of things data |
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 |