CN107861956A - A kind of bayonet socket crosses the querying method and device of car data record - Google Patents

A kind of bayonet socket crosses the querying method and device of car data record Download PDF

Info

Publication number
CN107861956A
CN107861956A CN201610839845.9A CN201610839845A CN107861956A CN 107861956 A CN107861956 A CN 107861956A CN 201610839845 A CN201610839845 A CN 201610839845A CN 107861956 A CN107861956 A CN 107861956A
Authority
CN
China
Prior art keywords
field
file
record
checked
name
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
Application number
CN201610839845.9A
Other languages
Chinese (zh)
Other versions
CN107861956B (en
Inventor
张记伟
谢巧
王宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Hikvision Digital Technology Co Ltd
Hangzhou Hikvision System Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201610839845.9A priority Critical patent/CN107861956B/en
Publication of CN107861956A publication Critical patent/CN107861956A/en
Application granted granted Critical
Publication of CN107861956B publication Critical patent/CN107861956B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24535Query rewriting; Transformation of sub-queries or views
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation

Abstract

The embodiments of the invention provide the querying method and device that a kind of bayonet socket crosses car data record, include the step of methods described:Receive inquiry request;The index file corresponding to field to be checked is obtained, record number corresponding to the content of the field to be checked is inquired about in the index file;According to default offset, calculate successively in all record numbers to be checked, the position of each record number in the data file;In the position, the context number and field name of the field corresponding to the record number are searched;Corresponding with field name field file is obtained according to field name, the context number of the field from the field file is inquired according to the context number of the field corresponding to content;Export field to be checked and aiming field corresponding with the field to be checked.Using the embodiment of the present invention reduce storage card make a slip of the tongue car data record memory space and hardware cost, improve inquirying card make a slip of the tongue car data record speed.

Description

A kind of bayonet socket crosses the querying method and device of car data record
Technical field
The present invention relates to field of computer technology, the querying method and dress of car data record are crossed more particularly to a kind of bayonet socket Put.
Background technology
With the fast development of monitoring trade, intelligent transportation, intelligent bayonet equipment increase, and generate more and more mistake The problem of car data records, and the record of car data excessively for how efficiently to store and inquire about these magnanimity is current main.
Generally, the data that car data record refers to a structuring are crossed for one, for example, one is crossed car data record and refers to car Information caused by one electronics bayonet socket of process, it can include:By the time of bayonet socket, the number-plate number, the volume by bayonet socket Number, the field such as vehicle color and type of vehicle.In actual applications, the magnanimity bayonet socket mistake that Database Systems will automatically generate daily Car data record stores in the specific format, is easy to user to inquire about these later and crosses car data record.
In actual applications, the application to crossing car data record is fairly simple, typically only relates to increase, deletes, changes, looking into several work( Can, and complex process need not be carried out to crossing car data.But traditional database system structure is complicated, it generally supports big And full function, thus the querying method supported using traditional data place had both been difficult to effectively be managed crossing car data, and Inquiry velocity is slower, and also needs to take a large amount of memory spaces.
The content of the invention
The purpose of the embodiment of the present invention is to provide querying method and device that a kind of bayonet socket crosses car data record, lifting card The retrieval rate of car data of making a slip of the tongue record, reduce the memory space that bayonet socket crosses car data record.Concrete technical scheme is as follows:
On the one hand, the embodiment of the invention discloses the querying method that a kind of bayonet socket crosses car data record, including:
Inquiry request is received, a field to be checked is comprised at least in the inquiry request;
The index file corresponding to the field to be checked is obtained, is inquired about in the index file in the field to be checked Record number corresponding to appearance, obtain all record numbers to be checked;
According to default offset, calculate successively in all record numbers to be checked, each record number is in number According to the position in file;In the position, according to record number, the context number of field and the field stored in data file The corresponding relation of title, search the context number and field name of the field corresponding to the record number;
Field file corresponding with the field name is obtained according to the field name, compiled according to the content of the field The content corresponding to the context number of the field number is inquired from the field file;
The field to be checked and aiming field corresponding with the field to be checked are exported, wherein, the aiming field Field file name where context number including the field and the content corresponding to the context number of the field.
Preferably, when inquiry request includes two or more field to be checked, the field to be checked more than described two Record number corresponding to the content of the field to be checked is inquired about in corresponding index file, obtains all record numbers to be checked The step of include:
Inquired about in the index file more than described two after record number corresponding to the content of field to be checked, to each Record corresponding to inquiry field takes common factor;
Using all record numbers taken after occuring simultaneously as all record numbers to be checked obtained.
Preferably, field file corresponding with the field name is obtained according to the field name, including:
If field corresponding to the field name is first kind field, obtained in internal memory corresponding to the field name Field file;
If field corresponding to the field name is Second Type field, obtained in disk corresponding to the field name Field file.
Preferably, the context number institute of the field is inquired from the field file according to the context number of the field Corresponding content, including:
If the field file is in internal memory, in the field file, by the context number of the field and the field Numbering in file is compared, and obtains the content corresponding to the context number with the field;
If the field file in disk, calculates offset of the context number of the field in the field file, Obtain content corresponding to the context number of the field.
Preferably, the aiming field is all fields crossed recorded in car data record, or in inquiry request Indicated field shown in Query Result.
On the other hand, the embodiment of the invention also discloses the inquiry unit that a kind of bayonet socket crosses car data record, including:
Receiving unit, for receiving inquiry request, a field to be checked is comprised at least in the inquiry request;
Search index file unit, for obtaining the index file corresponding to the field to be checked, in the index file Record number corresponding to the middle content for inquiring about the field to be checked, obtains all record numbers to be checked;
Data file unit is inquired about, for according to default offset, calculating all records to be checked successively and compiling In number, the position of each record number in the data file;In the position, compiled according to the record stored in data file Number, the corresponding relation of the context number of field and field name, search the context number of the field corresponding to the record number And field name;
Inquiry word segment file unit, for obtaining field text corresponding with the field name according to the field name Part, the context number of the field from the field file is inquired according to the context number of the field corresponding to content;
Output unit, for exporting the field to be checked and aiming field corresponding with the field to be checked, wherein, The context number institute of field file name and the field where context number of the aiming field including the field is right The content answered.
Preferably, described device also includes:
First search index file unit, for being inquired about in the index file more than described two in field to be checked After record number corresponding to appearance, common factor is taken to record corresponding to each inquiry field;
Common factor unit is taken, for being compiled all record numbers taken after occuring simultaneously as all records to be checked obtained Number.
Preferably, the inquiry word segment file unit, including:
First inquiry word segment file subelement, if being first kind field for field corresponding to the field name, Field file corresponding to the field name is obtained in internal memory;
Second inquiry word segment file subelement, if being Second Type field for field corresponding to the field name, Field file corresponding to the field name is obtained in disk.
Preferably, the inquiry word segment file unit, in addition to:
3rd inquiry word segment file subelement, if for the field file in internal memory, will in the field file The context number of the field is compared with the numbering in the field file, obtains corresponding to the context number with the field Content;
4th inquiry word segment file subelement, if calculating the content of the field in disk for the field file The offset in the field file is numbered, obtains content corresponding to the context number of the field.
A kind of bayonet socket provided in an embodiment of the present invention crosses the querying method and device of car data record, and car number is crossed according to bayonet socket The characteristics of high according to the field repeatability of record, the content of the high field of repeatability is stored on internal memory and disk simultaneously, looked into When inquiry bayonet socket crosses car data record, the content of the high fields of these repeatability is read in internal memory, realizes quick search bayonet socket mistake Car data records.Using the embodiment of the present invention can reduce storage card make a slip of the tongue car data record memory space, meanwhile, reduce Hardware cost, improve inquirying card make a slip of the tongue car data record speed.Certainly, any product or method for implementing the present invention must not It is certain to need to reach all the above advantage simultaneously.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is the flow chart for the querying method that bayonet socket provided in an embodiment of the present invention crosses car data record;
Fig. 2 is the structural representation for the inquiry unit that bayonet socket provided in an embodiment of the present invention crosses car data record;
Fig. 3 is the inquiry word segment file unit for the inquiry unit that bayonet socket provided in an embodiment of the present invention crosses car data record Structural representation.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete Site preparation describes, it is clear that described embodiment is only part of the embodiment of the present invention, rather than whole embodiments.It is based on Embodiment in the present invention, those of ordinary skill in the art are obtained every other under the premise of creative work is not made Embodiment, belong to the scope of protection of the invention.
In actual applications, car data note is crossed in car data record is nearest a period of time storage that what user's inquiry was most cross Record, fewer in the case of car data record queries excessively more remote, according to this characteristic, the embodiment of the present invention is storing When bayonet socket crosses car data record, by all car data record storages of crossing in certain period of time under a catalogue, such as one Stored under catalogue one day cross car data record or a catalogue under store one week mistake car data record or a mesh Car data record etc. is crossed in the lower storage of record one month.So, when inputting when spending the car time of car data record, can quickly determine Corresponding catalogue file is arrived in position, reduces the reading of a large amount of unnecessary disks.Meanwhile the car data of crossing of these last few days records phase For it is all cross car datas record for, small number, be present in caching, can accelerate to read these and cross car data record Speed.
Bayonet socket crosses the data that car data record is structuring, crosses car data record for every and is stored in the form of multiple fields, For example, one is crossed car data record and represented in the form of 6 fields, specifically include:Cross the car time, bayonet socket title, the number-plate number, Vehicle color, type of vehicle and mistake car picture URL (Uniform Resource Locator, url).This In, car data record citing, specific as shown in table 1, " spending the car time " in table 1, " bayonet socket title ", " car were crossed with January 1 Trade mark code ", " vehicle color ", " type of vehicle " and " car picture url " expressions field name excessively.
Table 1
Record number Spend the car time Bayonet socket title The number-plate number Vehicle color Type of vehicle Cross car picture url
01 On January 18:00 X bayonet sockets A12345 It is red Car Xxx
02 On January 1 10:00 Y bayonet sockets B23456 White Lorry Yyy
03 On January 1 12:00 Z bayonet sockets C34567 Black Bus Vvv
04 On January 1 14:00 U bayonet sockets D45678 Yellow Truck Ddd
05 On January 1 15:00 W bayonet sockets E78910 Blueness Small truck Bbb
…….
11 On January 1 20:00 M bayonet sockets A45678 It is red Offroad vehicle Ppp
12 On January 1 22:00 N bayonet sockets C78910 Black Taxi Qqq
……...
In the present embodiment, when storing car data record, using one day as a storage catalogue, the storage same day all mistakes Car data records.It is to be appreciated that the bayonet socket quantity in a city is certain, vehicle color most ten is several, vehicle class Type at most hundreds of, so bayonet socket title, vehicle color and type of vehicle are the relatively small number of fields of effective total quantity, i.e., it Duplicate data it is a lot;And it is the relatively more word of effective total quantity to cross car time, the number-plate number and cross car picture url Section, i.e., they duplicate data it is less.Here, it is first kind field by the more field definition of duplicate data, by repeat number It is Second Type field according to less field definition, that is to say, that bayonet socket title, vehicle color, type of vehicle are defined as One type field;Car time, the number-plate number, car picture url excessively it will be defined as Second Type field excessively.
Specifically, when obtaining a car data record excessively, car data record is crossed to this and is numbered, this is obtained and crosses car number According to record number corresponding to record.For example, when being a storage catalogue with one day, car data record is crossed to first of acquisition Be numbered, obtain this cross car data record corresponding to record number be " 01 ", the Article 2 of acquisition is crossed car data record into Line number, obtain this cross car data record corresponding to record number be " 02 ".
After to crossing car data record number, each first kind field is extracted from crossing in car data record, is judged every Whether the content of individual first kind field all exists in internal memory, if the content of the first kind field is not present in internal memory, Then the content of the first kind field is stored into internal memory in field file corresponding to the first kind field;If the first kind The content of type-word section has existed in internal memory, then from being somebody's turn to do corresponding to the first kind field in internal memory in field file The content of first kind field corresponding field number in the field file, and update the first kind stored in disk Field file corresponding to field.
Second Type field is extracted from crossing in car data record, the content of the Second Type field is numbered, and By the content of the Second Type field and its corresponding numbering storage field file corresponding to the Second Type field into disk In.
It is understood that internal memory is one of part important in computer, in computer the operation of all programs be all Carried out in internal memory.Internal memory (Memory) is also referred to as built-in storage, and it is to be used to temporarily deposit in central processing unit that it, which is acted on, Operational data, and data exchanged with external memory storages such as hard disks.As long as computer is in operation, central processing unit will Computing is carried out needing the data of computing to be transferred in internal memory, central processing unit again sends out result after the completion of computing, interior The operation deposited also determines the stable operation of computer.The embodiment of the present invention, the first kind field crossed in car data record are same When be stored in internal memory and disk, be easy to user inquired about car data record when, the first kind is quickly read from internal memory Type-word section.It should be noted that when having served as the power-off of car data record queries device, the first kind field in internal memory will lose Lose, now, user can inquire about the first kind field on disk.Here, disk is used for storing car data record for a long time, Even if cross the power-off of car data record queries device, losing for each field for crossing car data record on disk will not be also caused Lose.
Here, above-mentioned field file is used to store the content of each field of car data record and its corresponding numbering.
Such as obtain one it is following cross car data record, it is 1 that the record number for crossing car data record, which is 01, spends the car time On the moon 18:00th, the entitled X bayonet sockets of bayonet socket, number-plate number A12345, vehicle color be red, type of vehicle be car and It is Xxx to cross car picture url.This cross car data record in extract first kind field (bayonet socket title, vehicle color and car Type), the content of the bayonet socket title of the first kind field is X bayonet sockets, and the content of vehicle color is red, type of vehicle Content is car;This cross car data record in extract Second Type field (cross the car time, the number-plate number and cross car picture Url), the content for spending the car time of the Second Type field is on January 18:00, the content of the number-plate number is A12345, vehicle face The content of color is red.
Specifically, by the content of bayonet socket title and its corresponding numbering, bayonet socket corresponding to bayonet socket title in internal memory is stored In name field file, and update in disk and include corresponding to bayonet socket title the step of bayonet socket name field file:If cross car Data record is to cross car data record from what " X bayonet sockets " obtained, then judges the content for crossing the bayonet socket title of car data record " X bayonet sockets " whether there is in internal memory, if it does not exist, then " X bayonet sockets " is numbered, obtain numbering corresponding to " X bayonet sockets ", By " X bayonet sockets " and its it is corresponding numbering storage into the bayonet socket name field file of internal memory, if " X bayonet sockets " in internal memory In the presence of then obtaining out of internal memory bayonet socket name field file and number corresponding to the bayonet socket title i.e. " X bayonet sockets ", update in disk Bayonet socket name field file.Table 2 is the context number of bayonet socket title and the content of bayonet socket title in bayonet socket name field file Corresponding relation, wherein, the entitled bayonet socket title of bayonet socket name field file.
Table 2
The context number of bayonet socket title The content of bayonet socket title
01 A bayonet sockets
02 B bayonet sockets
03 C bayonet sockets
04 D bayonet sockets
05 E bayonet sockets
We are again by taking vehicle color field file as an example, if it is " red that what is obtained, which crosses the vehicle color of car data record, Color ", then judge that the content " red " for crossing the vehicle color of car data record whether there is in internal memory, if it does not exist, then " red " is numbered, obtains numbering corresponding to " red ", and " red " storage will be somebody's turn to do to the vehicle color field text of internal memory In part, exist if being somebody's turn to do " red " in internal memory, the vehicle color is obtained out of internal memory vehicle color field file Numbered corresponding to " red ", update the vehicle color field file in disk.Table 3 is vehicle face in vehicle color field file The corresponding relation of the context number of color and the content of vehicle color, wherein, vehicle color field file name is vehicle color.Example Such as in following table 3, vehicle color numbering is " 02 " corresponding to white vehicle.
Table 3
The context number of vehicle color The content of vehicle color
01 It is red
02 White
03 Black
04 Yellow
05 Blueness
Next, with the content of the number-plate number and its corresponding numbering storage car plate corresponding to the number-plate number into disk Illustrated exemplified by number field file.If the content of the number-plate number for crossing car data record of acquisition is " A12345 ", Then judge that " A12345 " whether there is in disk, if it does not, " A12345 " is numbered, it is corresponding to obtain " A12345 " Numbering, and by " A12345 " and its it is corresponding numbering storage into disk vehicle number field file;If it is present from magnetic Obtain in " A12345 " corresponding number-plate number field file in disk and numbered corresponding to " A12345 ".For example, table 4 shows license plate number The corresponding relation of the context number of the number-plate number in code word segment file and the content of the number-plate number, wherein, number-plate number field File name is the number-plate number.
Table 4
The context number of the number-plate number The content of the number-plate number
01 A12345
02 B23456
03 C34567
04 D45678
05 E78910
In addition, numbering of the content for each field crossed in car data record in its corresponding field file is write into number According in file, wherein, the data file includes data file head and content data file, specifically, data file head is used for Associate each field file;Content data file is used in corresponding to the record number for storing car data record and each field Numbering corresponding to Rong Qi in field file.Illustrated below by taking data file as an example, as shown in table 5, table 5 was shown The record number of car data record is with crossing the context number of each field in car data record and the corresponding pass of field name System, wherein, data file head includes:Field name corresponding to record number, each field contents numbering (crosses car time, bayonet socket Title, the number-plate number, vehicle color, type of vehicle and vehicle pictures url), the data file head of table 5 also includes, each word The memory length that the context number of section takes.Accounted for for example, data file head takes memory length for 32bit, every record number The memory length that memory length is 64bit, the context number of car time excessively takes is 64bit, the content of bayonet socket title is compiled Number take memory length be 8bit, the context number of the number-plate number take memory length be 16bit, the content of vehicle color The memory length that the memory length that numbering takes is 8bit, the context number of type of vehicle takes is 8bit and vehicle pictures The memory length that url context number takes is 64bit, then crosses the storage length that car data record takes in the data file for one Spend for 232bit.In actual applications, the context number of every record number for crossing car data record and each field is in number It can include other memory lengths according to memory length shared in file.Table 5 shows that the shared of data file head is deposited Storage length is 32bit, specifically, the memory length shared by data file head can include other memory lengths.
Table 5
Record number Spend the car time Bayonet socket title The number-plate number Vehicle color Type of vehicle Vehicle pictures url
11 11 12 23 01 09 11
12 12 22 15 03 13 12
When obtaining car data record, the content storage for each field crossed in car data record is indexed to corresponding In file, specifically, each corresponding index file of each field crossed in car data record.For example, car plate color is corresponding Car plate color index file, the number-plate number correspond to number-plate number index file, and type of vehicle corresponds to type of vehicle index file.This In, the index file is used to store the content of each field and its corresponding record number.Text is indexed with the number-plate number below Illustrated exemplified by part (content of the number-plate number and the corresponding relation of record number), as shown in table 6.
Table 6
When there is one to cross car data record input, in number-plate number index file, look into this and cross in car data record The content of the number-plate number whether there is, if it does not, the content of the number-plate number and the record for crossing car data record are compiled Number it is deposited into number-plate number index file;Compiled if it is present inserting the record for crossing car data record after the number-plate number Number.
Specifically, table 6 is shown, in number-plate number index file, inserted after the content " C34567 " of the number-plate number Record number " 03 ", record number " 08 ".When record number is for the content of the field for crossing car data record of " 11 " When " C34567 ", the content " C34567 " of the number-plate number that the record number " 11 " is inserted in number-plate number index file it Afterwards.Here, the record number after the content of the number-plate number in number-plate number index file represents, mistake corresponding to the record number The content of the field of car data record includes the number-plate number.
Above is by taking the part field in car data record excessively as an example, specifically illustrate and how to record a car data excessively Store in the associated documents (that is, field file, data file and index file) to database.When needs inquired about car number According to the field in record content when, inquired about according to method shown in following examples of the present invention.
Referring to Fig. 1, Fig. 1 is the flow chart for the querying method that bayonet socket provided in an embodiment of the present invention crosses car data record, is wrapped Include following steps:
S101, inquiry request is received, a field to be checked is comprised at least in the inquiry request;
A field to be checked is comprised at least in inquiry request, it can be understood as, one can be included in the inquiry request It can include wrapping in two fields to be checked or the inquiry request in field to be checked or the inquiry request More fields to be checked can be included by including in three fields to be checked or the inquiry request.Here, word to be checked Section can be the number-plate number, vehicle color, cross the car time, bayonet socket title, type of vehicle and cross car picture in one or more Individual field.
S102, the index file corresponding to the field to be checked is obtained, the word to be checked is inquired about in the index file Record number corresponding to the content of section, obtain all record numbers to be checked;
Specifically, each corresponding index file of field to be checked, i.e. the number-plate number corresponds to number-plate number index text Part, vehicle color correspond to vehicle color index file.According to the field name of field to be checked, in corresponding index file, Inquire about record number corresponding to the content of the field to be checked.For example, when user inquires about the number-plate number, the number-plate number is inputted Database inquiry system, according to the field name (number-plate number) of the field to be checked, in number-plate number index file, inquiry Record number corresponding to the content of the number-plate number.For example, when the content that user will inquire about the number-plate number is " A12345 ", Number-plate number index file (table 6) obtains record number " 01 " and record number corresponding to the content " A12345 " of the number-plate number “06”。
Preferably, according to the field name of the field to be checked, by dichotomy, in number-plate number index file, look into Ask record number corresponding to the content of the number-plate number.
In a kind of possible implementation of the embodiment of the present invention, include two or more field to be checked in inquiry request When, inquire about to record corresponding to the content of the field to be checked in index file corresponding to field to be checked more than described two and compile Number, the step of obtaining all record numbers to be checked, includes:Word to be checked more than described two is inquired about in the index file After record number corresponding to the content of section, common factor is taken to record corresponding to each inquiry field;All records after occuring simultaneously will be taken Numbering is as all record numbers to be checked obtained.
Specifically, when including two fields of inputting license plate number and bayonet socket title simultaneously in the inquiry request, respectively The content of two fields of the number-plate number and bayonet socket title is inquired about in number-plate number index file and bayonet socket name index file Corresponding record number, then common factor is taken to the record number, obtain all notes for crossing car data record for including the two fields Record numbering.For example, when inquiry request includes two fields of the number-plate number and bayonet socket title, and the number-plate number and bayonet socket title The content of the two fields is respectively " C34567 " and " Z bayonet sockets ", respectively in car plate index file and bayonet socket index file, is looked into Ask the number-plate number content " C34567 " and bayonet socket title content " Z bayonet sockets " corresponding to record number " 03 ", " 08 ", " 11 " and Record number " 03 ", " 06 ", " 11 ", friendship is taken to record number " 03 ", " 08 ", " 11 " and record number " 03 ", " 06 ", " 11 " Collection, obtain taking the record number " 03 " after occuring simultaneously and " 11 ", wherein, car data record is crossed corresponding to record number " 03 " and " 11 " The content of interior field includes the number-plate number " C34567 " and " Z bayonet sockets " simultaneously.
S103, according to default offset, calculate successively in all record numbers to be checked, each record number Position in the data file;In the position, according to stored in data file record number, the context number of field and The corresponding relation of field name, search the context number and field name of the field corresponding to the record number;
Here, by taking table 5 as an example, it is assumed that the context number institute of every record number for crossing car data record and each field The memory length sum of occupancy is 232bit, then default bias amount is 232bit, the memory length shared by data file head For 32bit.After all record numbers to be checked are obtained in indexed file, according to default bias amount, calculate successively described in In all record numbers to be checked, the position of each record number in the data file.Here, suppose that what is obtained is to be checked Record number is " 04 " and " 08 ", then the position of record number " 04 " in the data file:32+232 × (4-1)=728bit, Wherein, 4 record number " 04 " is represented;The position of record number " 08 " in the data file:32+232 × (8-1)=1656bit, Wherein, 8 record number " 08 " is represented.728bit in the data file and 1656bit position, according to the record stored The corresponding relation of " 04 " and " 08 ", the context number of field and field name is numbered, it is right to search record number " 04 " and " 08 " institute The context number and field name for the field answered.
S104, field file corresponding with the field name is obtained according to the field name, according to the field Context number inquires the content corresponding to the context number of the field from the field file;
In a kind of possible implementation of the embodiment of the present invention, obtained and the field name pair according to field name The field file answered, including:If field corresponding to the field name is first kind field, the field is obtained in internal memory Field file corresponding to title;If field corresponding to the field name is Second Type field, the word is obtained in disk Field file corresponding to name section.
Specifically, the field name of acquisition is associated with field file corresponding to the field name.For example, by field name Vehicle color field file is associated with for vehicle color, is that the number-plate number is associated with number-plate number field text by field name Part.Specifically, the field name of first kind field is associated with internal memory word corresponding to the field name of first kind field Segment file, the field name of the second class field is associated with disk field text corresponding to the field name of Second Type field Part.
In a kind of possible implementation of the embodiment of the present invention, according to the context number of the field from the field The content corresponding to the context number of the field is inquired in file, including:If the field file is in internal memory, in the word In segment file, the context number of the field is compared with the numbering in the field file, obtained interior with the field Hold the corresponding content of numbering;If the field file in disk, calculates the context number of the field in the field file In offset, obtain content corresponding to the context number of the field.
It should be noted that inquired about in field file in internal memory in corresponding to the context number of first kind field Rong Shi, the context number of field and the numbering corresponding to the content of the field in corresponding field file are compared, obtain the content The corresponding content of numbering.When the content of Second Type field is inquired about in the field file in disk, according to second obtained The context number of class field, offset of the numbering in corresponding field file is calculated, according to the offset, in corresponding word In segment file, the context number corresponding content of Second Type field is obtained.For example, as shown in table 5, remembered in the data file The context number of each field corresponding to record numbering " 11 " includes:Cross the context number " 11 " of car time, bayonet socket title it is interior Hold numbering " 12 ", the context number " 23 " of the number-plate number, context number " 01 ", the context number of type of vehicle of vehicle color " 09 " and vehicle pictures url context number " 11 ".By the context number " 12 " of bayonet socket title and bayonet socket name field file In numbering " 12 " be compared, obtain in bayonet socket name field file number " 12 " corresponding to bayonet socket title content " M cards Mouthful ", " the M bayonet sockets " is the content of the bayonet socket title of crossing car data record of the record number corresponding to " 11 ";In car plate When field file corresponding to number is in disk, the context number of the number-plate number is calculated in number-plate number field file Offset.For example, offset of the content of the number-plate number in number-plate number field file is 64 × (23-1)=1408bit, According to corresponding to obtaining in number-plate number field file of the context number " 23 " of the number-plate number in disk the offset The content " A45678 " of the number-plate number.
S105, the field to be checked and aiming field corresponding with the field to be checked are exported, wherein, the target Field file name where context number of the field including the field and the content corresponding to the context number of the field.
Here, aiming field refers to when inputting field to be checked, specifies the field crossed in car data record to be inquired about. For example, inquiry request includes the number-plate number and bayonet socket title, aiming field includes:Vehicle color, type of vehicle, spend the car time And the field crossed in car picture url or multiple fields.Aiming field, exactly user are indicated in inquiry request In the result of inquiry, the field to be shown.
It can be seen that bayonet socket provided in an embodiment of the present invention crosses the querying method of car data record, car data note is crossed according to bayonet socket The characteristics of field repeatability of record is high, inquirying card make a slip of the tongue car data record when, read in internal memory in the high field of repeatability Hold, realize that quick search bayonet socket crosses car data record.Using the embodiment of the present invention can reduce storage card make a slip of the tongue car data record Memory space, meanwhile, reduce hardware cost, improve inquirying card make a slip of the tongue car data record speed.
Referring to Fig. 2, Fig. 2 is the structural representation for the inquiry unit that bayonet socket provided in an embodiment of the present invention crosses car data record Figure, including:
Receiving unit 210, for receiving inquiry request, a field to be checked is comprised at least in the inquiry request;
Search index file unit 220, for obtaining the index file corresponding to the field to be checked, in index text Record number corresponding to the content of the field to be checked is inquired about in part, obtains all record numbers to be checked;
Data file unit 230 is inquired about, for according to default offset, calculating all records to be checked successively In numbering, the position of each record number in the data file;In the position, compiled according to the record stored in data file Number, the corresponding relation of the context number of field and field name, search the context number of the field corresponding to the record number And field name;
Inquiry word segment file unit 240, for obtaining field corresponding with the field name according to the field name File, the context number of the field from the field file is inquired according to the context number of the field corresponding in Hold;
Output unit 250, for exporting the field to be checked and aiming field corresponding with the field to be checked, its In, the context number institute of field file name and the field where context number of the aiming field including the field Corresponding content.
In a kind of possible implementation of the embodiment of the present invention, described device also includes:
First search index file unit, for being inquired about in the index file more than described two in field to be checked After record number corresponding to appearance, common factor is taken to record corresponding to each inquiry field;
Common factor unit is taken, for being compiled all record numbers taken after occuring simultaneously as all records to be checked obtained Number.
Referring to Fig. 3, Fig. 3 is the inquiry field text for the inquiry unit that bayonet socket provided in an embodiment of the present invention crosses car data record The structural representation of part unit, is specifically included:
First inquiry word segment file subelement 310, if being first kind type-word for field corresponding to the field name Section, obtains field file corresponding to the field name in internal memory;
Second inquiry word segment file subelement 320, if being Second Type word for field corresponding to the field name Section, obtains field file corresponding to the field name in disk.
3rd inquiry word segment file subelement 330, if for the field file in internal memory, in the field file In, the context number of the field is compared with the numbering in the field file, obtains the context number with the field Corresponding content;
4th inquiry word segment file subelement 340, if calculating the interior of the field in disk for the field file Hold offset of the numbering in the field file, obtain content corresponding to the context number of the field.
It can be seen that bayonet socket provided in an embodiment of the present invention crosses the inquiry unit of car data record, car data note is crossed according to bayonet socket The characteristics of field repeatability of record is high, inquirying card make a slip of the tongue car data record when, read in internal memory in the high field of repeatability Hold, realize that quick search bayonet socket crosses car data record.Using the embodiment of the present invention can reduce storage card make a slip of the tongue car data record Memory space, meanwhile, reduce hardware cost, improve inquirying card make a slip of the tongue car data record speed.
For device embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, it is related Part illustrates referring to the part of embodiment of the method.
It should be noted that herein, such as first and second or the like relational terms are used merely to a reality Body or operation make a distinction with another entity or operation, and not necessarily require or imply and deposited between these entities or operation In any this actual relation or order.Moreover, term " comprising ", "comprising" or its any other variant are intended to Nonexcludability includes, so that process, method, article or equipment including a series of elements not only will including those Element, but also the other element including being not expressly set out, or it is this process, method, article or equipment also to include Intrinsic key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that Other identical element also be present in process, method, article or equipment including the key element.
Each embodiment in this specification is described by the way of related, identical similar portion between each embodiment Divide mutually referring to what each embodiment stressed is the difference with other embodiment.It is real especially for system For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, related part is referring to embodiment of the method Part explanation.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent substitution and improvements made within the spirit and principles in the present invention etc., are all contained in protection scope of the present invention It is interior.

Claims (9)

1. a kind of bayonet socket crosses the querying method of car data record, it is characterised in that including:
Inquiry request is received, a field to be checked is comprised at least in the inquiry request;
The index file corresponding to the field to be checked is obtained, the content pair of the field to be checked is inquired about in the index file The record number answered, obtain all record numbers to be checked;
According to default offset, calculate successively in all record numbers to be checked, each record number is in data text Position in part;In the position, according to record number, the context number of field and the field name stored in data file Corresponding relation, search the context number and field name of the field corresponding to the record number;
Corresponding with field name field file is obtained according to the field name, according to the context number of the field from The content corresponding to the context number of the field is inquired in the field file;
The field to be checked and aiming field corresponding with the field to be checked are exported, wherein, the aiming field includes Field file name where the context number of the field and the content corresponding to the context number of the field.
2. according to the method for claim 1, it is characterised in that include two or more field to be checked in inquiry request When, inquire about to record corresponding to the content of the field to be checked in index file corresponding to field to be checked more than described two and compile Number, the step of obtaining all record numbers to be checked, includes:
Inquired about in the index file more than described two after record number corresponding to the content of field to be checked, to each inquiry Record takes common factor corresponding to field;
Using all record numbers taken after occuring simultaneously as all record numbers to be checked obtained.
3. according to the method for claim 1, it is characterised in that described to be obtained and the field name according to the field name Field file corresponding to title, including:
If field corresponding to the field name is first kind field, field corresponding to the field name is obtained in internal memory File;
If field corresponding to the field name is Second Type field, field corresponding to the field name is obtained in disk File.
4. according to the method for claim 1, it is characterised in that the context number according to the field is from the field The content corresponding to the context number of the field is inquired in file, including:
If the field file is in internal memory, in the field file, by the context number of the field and the field file In numbering be compared, obtain and the content corresponding to the context number of the field;
If the field file in disk, calculates offset of the context number of the field in the field file, obtain Content corresponding to the context number of the field.
5. according to the method for claim 1, it is characterised in that the aiming field is crossed during car data records by one to be remembered All fields of record, or field shown in Query Result indicated in inquiry request.
6. a kind of bayonet socket crosses the inquiry unit of car data record, it is characterised in that including:
Receiving unit, for receiving inquiry request, a field to be checked is comprised at least in the inquiry request;
Search index file unit, for obtaining the index file corresponding to the field to be checked, looked into the index file Record number corresponding to the content of the field to be checked is ask, obtains all record numbers to be checked;
Data file unit is inquired about, for according to default offset, calculating successively in all record numbers to be checked, The each position of record number in the data file;In the position, according to record number, the field stored in data file Context number and field name corresponding relation, search the context number and field name of the field corresponding to the record number Claim;
Inquiry word segment file unit, for obtaining field file corresponding with the field name, root according to the field name The content corresponding to the context number of the field is inquired from the field file according to the context number of the field;
Output unit, for exporting the field to be checked and aiming field corresponding with the field to be checked, wherein, it is described Field file name where the context number of aiming field including the field and corresponding to the context number of the field Content.
7. device according to claim 6, it is characterised in that described device also includes:
First search index file unit, for inquiring about the content pair of field to be checked more than described two in the index file After the record number answered, common factor is taken to record corresponding to each inquiry field;
Take common factor unit, for will take occur simultaneously after all record numbers as all record numbers to be checked obtained.
8. device according to claim 6, it is characterised in that the inquiry word segment file unit, including:
First inquiry word segment file subelement, if being first kind field for field corresponding to the field name, inside Deposit and obtain field file corresponding to the field name;
Second inquiry word segment file subelement, if being Second Type field for field corresponding to the field name, in magnetic Field file corresponding to the field name is obtained in disk.
9. device according to claim 6, it is characterised in that the inquiry word segment file unit, in addition to:
3rd inquiry word segment file subelement, if for the field file in internal memory, in the field file, by described in The context number of field is compared with the numbering in the field file, obtain with it is interior corresponding to the context number of the field Hold;
4th inquiry word segment file subelement, if calculating the context number of the field in disk for the field file Offset in the field file, obtains content corresponding to the context number of the field.
CN201610839845.9A 2016-09-22 2016-09-22 Method and device for inquiring data record of bayonet passing vehicle Active CN107861956B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610839845.9A CN107861956B (en) 2016-09-22 2016-09-22 Method and device for inquiring data record of bayonet passing vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610839845.9A CN107861956B (en) 2016-09-22 2016-09-22 Method and device for inquiring data record of bayonet passing vehicle

Publications (2)

Publication Number Publication Date
CN107861956A true CN107861956A (en) 2018-03-30
CN107861956B CN107861956B (en) 2020-10-02

Family

ID=61698599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610839845.9A Active CN107861956B (en) 2016-09-22 2016-09-22 Method and device for inquiring data record of bayonet passing vehicle

Country Status (1)

Country Link
CN (1) CN107861956B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111179603A (en) * 2018-11-09 2020-05-19 杭州海康威视数字技术股份有限公司 Vehicle identification method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120150869A1 (en) * 2010-12-10 2012-06-14 Inventec Corporation Method for creating a index of the data blocks
CN102929936A (en) * 2012-09-26 2013-02-13 东软集团股份有限公司 Log recording method, log inquiring method and system
CN103617275A (en) * 2013-12-06 2014-03-05 中国联合网络通信集团有限公司 Internet-surfing detailed record query method and system for mobile terminal
CN105718436A (en) * 2015-12-18 2016-06-29 武汉开目信息技术有限责任公司 New type table data management method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120150869A1 (en) * 2010-12-10 2012-06-14 Inventec Corporation Method for creating a index of the data blocks
CN102929936A (en) * 2012-09-26 2013-02-13 东软集团股份有限公司 Log recording method, log inquiring method and system
CN103617275A (en) * 2013-12-06 2014-03-05 中国联合网络通信集团有限公司 Internet-surfing detailed record query method and system for mobile terminal
CN105718436A (en) * 2015-12-18 2016-06-29 武汉开目信息技术有限责任公司 New type table data management method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111179603A (en) * 2018-11-09 2020-05-19 杭州海康威视数字技术股份有限公司 Vehicle identification method and device, electronic equipment and storage medium
CN111179603B (en) * 2018-11-09 2021-03-02 杭州海康威视数字技术股份有限公司 Vehicle identification method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN107861956B (en) 2020-10-02

Similar Documents

Publication Publication Date Title
CN101036141B (en) A database management system with persistent, user- accessible bitmap values
CN109299100B (en) Managing internal memory data and the method and system for safeguarding data in memory
CN101916261B (en) Data partitioning method for distributed parallel database system
CN102799634B (en) Data storage method and device
CN104685498B (en) The hardware implementation mode of polymerization/division operation:Hash table method
CN103299303B (en) Extendible RDF data storehouse
JP7011848B2 (en) Systems, methods, and data structures for fast retrieval or filtering of large datasets
US6339777B1 (en) Method and system for handling foreign key update in an object-oriented database environment
US9218409B2 (en) Method for generating and using a reusable custom-defined nestable compound data type as database qualifiers
US20160259838A1 (en) Reporting and summarizing metrics in sparse relationships on an oltp database
CN107818115A (en) A kind of method and device of processing data table
US20140337287A1 (en) Virtual repository management
CN103559323B (en) Database implementation method
CN100390790C (en) Method and mechanism of storing and accessing data and improving performance of database query language statements
US20040139046A1 (en) Data organization in a fast query system
CN104866521B (en) Handle the device and method of the inquiry in the database with mixing memory
CN101876983A (en) Method for partitioning database and system thereof
US7480662B2 (en) Fact table storage in a decision support system environment
CN102193983B (en) Relation path-based node data filtering method of graphic database
WO2009120172A1 (en) Semantic relational database
CN104573022A (en) Data query method and device for HBase
CN101706801A (en) Method and system for managing memory database data
CN102375827A (en) Method for fast loading versioned electricity network model database
CN102346744A (en) Device for processing materialized table in multi-tenancy (MT) application system
CN101963993B (en) Method for fast searching database sheet table record

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