CN107861956B - Method and device for inquiring data record of bayonet passing vehicle - Google Patents

Method and device for inquiring data record of bayonet passing vehicle Download PDF

Info

Publication number
CN107861956B
CN107861956B CN201610839845.9A CN201610839845A CN107861956B CN 107861956 B CN107861956 B CN 107861956B CN 201610839845 A CN201610839845 A CN 201610839845A CN 107861956 B CN107861956 B CN 107861956B
Authority
CN
China
Prior art keywords
field
file
content
record
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.)
Active
Application number
CN201610839845.9A
Other languages
Chinese (zh)
Other versions
CN107861956A (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 System Technology Co Ltd
Original Assignee
Hangzhou Hikvision System 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 System Technology Co Ltd filed Critical Hangzhou Hikvision System 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

Images

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 embodiment of the invention provides a method and a device for inquiring data records of a bayonet passing vehicle, wherein the method comprises the following steps: receiving a query request; acquiring an index file corresponding to a field to be queried, and querying a record number corresponding to the content of the field to be queried in the index file; sequentially calculating the position of each record number in the record numbers to be inquired in the data file according to a preset offset; searching the content number and the field name of the field corresponding to the record number at the position; acquiring a field file corresponding to the field name according to the field name, and inquiring the content corresponding to the content number of the field from the field file according to the content number of the field; and outputting the field to be queried and a target field corresponding to the field to be queried. By applying the embodiment of the invention, the storage space and hardware cost of the data record of the vehicle passing through the memory card port are reduced, and the speed of inquiring the data record of the vehicle passing through the memory card port is improved.

Description

Method and device for inquiring data record of bayonet passing vehicle
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for inquiring bayonet vehicle passing data records.
Background
With the rapid development of the monitoring industry and the increase of intelligent transportation and intelligent card port equipment, more and more vehicle passing data records are generated, and the main problem of how to efficiently store and query the mass vehicle passing data records is at present.
Generally, a vehicle-passing data record refers to a structured data, for example, a vehicle-passing data record refers to information generated by a vehicle passing through an electronic gate, which may include: time passing through the gate, license plate number, number passing through the gate, vehicle color, vehicle type and other fields. In practical application, the database system stores the massive checkpoint vehicle passing data records automatically generated every day in a specific format, so that a user can conveniently inquire the vehicle passing data records in the future.
In practical application, the application of the vehicle-passing data record is simple, generally only involves adding, deleting, modifying and checking a few functions, and does not need to perform complex processing on the vehicle-passing data. However, the conventional database system has a complex structure and generally supports large and full functions, so that it is difficult to effectively manage the vehicle passing data by using the query method supported by the conventional database system, the query speed is slow, and a large amount of storage space is occupied.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for inquiring a data record of a bayonet passing vehicle, which can improve the retrieval speed of the data record of the bayonet passing vehicle and reduce the storage space of the data record of the bayonet passing vehicle. The specific technical scheme is as follows:
on one hand, the embodiment of the invention discloses a method for inquiring data records of a bayonet passing vehicle, which comprises the following steps:
receiving a query request, wherein the query request at least comprises a field to be queried;
acquiring an index file corresponding to the field to be queried, querying a record number corresponding to the content of the field to be queried in the index file, and acquiring all record numbers to be queried;
sequentially calculating the position of each record number in the record numbers to be inquired in the data file according to a preset offset; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
acquiring a field file corresponding to the field name according to the field name, and inquiring the content corresponding to the content number of the field from the field file according to the content number of the field;
and outputting the field to be queried and a target field corresponding to the field to be queried, wherein the target field comprises a field file name of the field with the content number of the field and the content corresponding to the content number of the field.
Preferably, when the query request includes more than two fields to be queried, querying the record number corresponding to the content of the field to be queried in the index file corresponding to the more than two fields to be queried, and obtaining all record numbers to be queried includes:
after the record numbers corresponding to the contents of the more than two fields to be inquired are inquired in the index file, the intersection of the records corresponding to the inquiry fields is taken;
and taking all the record numbers after intersection as all the obtained record numbers to be inquired.
Preferably, obtaining the field file corresponding to the field name according to the field name includes:
if the field corresponding to the field name is the first type field, acquiring a field file corresponding to the field name in the memory;
and if the field corresponding to the field name is the second type field, acquiring the field file corresponding to the field name in the disk.
Preferably, the querying the content corresponding to the content number of the field from the field file according to the content number of the field includes:
if the field file is in the memory, comparing the content number of the field with the number in the field file to obtain the content corresponding to the content number of the field;
and if the field file is in the disk, calculating the offset of the content number of the field in the field file, and obtaining the content corresponding to the content number of the field.
Preferably, the target fields are all fields recorded in one vehicle passing data record or fields indicated in the query request and displayed in the query result.
On the other hand, the embodiment of the invention also discloses a device for inquiring the data record of the bayonet passing vehicle, which comprises the following components:
the device comprises a receiving unit, a query unit and a query unit, wherein the receiving unit is used for receiving a query request which at least comprises a field to be queried;
the index file inquiring unit is used for acquiring an index file corresponding to the field to be inquired, inquiring the record number corresponding to the content of the field to be inquired in the index file and acquiring all the record numbers to be inquired;
the query data file unit is used for sequentially calculating the position of each record number in the data file in all the record numbers to be queried according to a preset offset; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
a field file inquiry unit, configured to obtain a field file corresponding to the field name according to the field name, and inquire, from the field file, a content corresponding to the content number of the field according to the content number of the field;
and the output unit is used for outputting the field to be queried and a target field corresponding to the field to be queried, wherein the target field comprises a field file name where the content number of the field is located and content corresponding to the content number of the field.
Preferably, the apparatus further comprises:
the first query index file unit is used for querying record numbers corresponding to the contents of the more than two fields to be queried in the index file and then taking an intersection of records corresponding to the query fields;
and the intersection taking unit is used for taking all the record numbers after intersection taking as all the obtained record numbers to be inquired.
Preferably, the query field file unit includes:
a first query field file subunit, configured to, if a field corresponding to the field name is a first type field, obtain, in the memory, a field file corresponding to the field name;
and the second field file query subunit is used for acquiring the field file corresponding to the field name in the disk if the field corresponding to the field name is the second type field.
Preferably, the query field file unit further includes:
a third field file query subunit, configured to, if the field file is in the memory, compare the content number of the field with the number in the field file, and obtain content corresponding to the content number of the field;
and the fourth field file inquiring subunit is used for calculating the offset of the content number of the field in the field file if the field file is in the disk, and acquiring the content corresponding to the content number of the field.
According to the method and the device for inquiring the data record of the passing car of the bayonet, provided by the embodiment of the invention, the contents of the fields with high repeatability are simultaneously stored in the memory and the magnetic disk according to the characteristic of high field repeatability of the data record of the passing car of the bayonet, and the contents of the fields with high repeatability are read in the memory when the data record of the passing car of the bayonet is inquired, so that the data record of the passing car of the bayonet is quickly inquired. By applying the embodiment of the invention, the storage space of the vehicle-passing data record of the memory card port can be reduced, meanwhile, the hardware cost is reduced, and the speed of inquiring the vehicle-passing data record of the memory card port is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for querying a checkpoint passing data record according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a device for querying a checkpoint passing data record according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a query field file unit of the query device for the vehicle passing data record of the gate according to the embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In practical application, the vehicle passing data records which are most inquired by a user are stored in a recent period of time, and the condition of inquiring the vehicle passing data records which are relatively long is less, according to the characteristic, when the memory card is used for storing the vehicle passing data records, all the vehicle passing data records in a certain period of time are stored in one directory, for example, the vehicle passing data records of one day are stored in one directory, the vehicle passing data records of one week are stored in one directory, the vehicle passing data records of one month are stored in one directory, and the like. Therefore, when the passing time recorded by the passing data is input, the corresponding directory file can be quickly positioned, and the reading of a large number of unnecessary disks is reduced. Meanwhile, compared with all vehicle passing data records, the vehicle passing data records in the last few days are small in number and exist in the cache, and the speed of reading the vehicle passing data records can be increased.
The bayonet vehicle-passing data records are structured data, and each vehicle-passing data record is stored in a form of a plurality of fields, for example, one vehicle-passing data record is represented in a form of 6 fields, and specifically comprises the following steps: a passing time, a bayonet name, a license plate number, a vehicle color, a vehicle type, and a passing picture Uniform Resource Locator (url). Here, taking the past vehicle data records of 1 month and 1 day as an example, specifically, as shown in table 1, "time of passage", "gate name", "license plate number", "vehicle color", "vehicle type", and "picture url of passage" in table 1 indicate field names.
TABLE 1
Record number Passing vehicle time Name of bayonet License plate number Vehicle color Type of vehicle Passing picture url
01 1 month, 1 day, 8:00 X bayonet A12345 Red colour Car (R.C.) Xxx
02 1 month and 1 day 10:00 Y bayonet B23456 White colour Truck Yyy
03 1 month, 1 day, 12:00 Z bayonet C34567 Black color Bus vehicle Vvv
04 1 month and 1 day 14:00 U bayonet D45678 Yellow colour Large truck Ddd
05 1 month, 1 day, 15:00 W bayonet E78910 Blue color Small truck Bbb
…….
11 1 month and 1 day 20:00 M bayonet A45678 Red colour Off-road vehicle Ppp
12 1 month and 1 day 22:00 N bayonet C78910 Black color Taxi Qqq
……...
In this embodiment, when the vehicle data records are stored, all the vehicle data records of the current day are stored by using the current day as a storage directory. It should be understood that the number of bayonets in a city is certain, the vehicle color is at most dozens, and the vehicle type is at most hundreds, so the name of the bayonets, the vehicle color and the vehicle type are fields with relatively small total number, i.e. they are duplicated much; the car passing time, the license plate number and the car passing picture url are fields with relatively more effective total number, namely, the repeated data is less. Here, a field with more repeated data is defined as a first type field, and a field with less repeated data is defined as a second type field, that is, a bayonet name, a vehicle color, and a vehicle type are defined as first type fields; and defining the passing time, the license plate number and the passing picture url as a second type field.
Specifically, when a vehicle passing data record is obtained, the vehicle passing data record is numbered to obtain a record number corresponding to the vehicle passing data record. For example, when the storage directory is one day, the obtained first passing data record is numbered to obtain a record number "01" corresponding to the passing data record, and the obtained second passing data record is numbered to obtain a record number "02" corresponding to the passing data record.
After numbering the vehicle passing data records, extracting each first type field from the vehicle passing data records, judging whether the content of each first type field exists in the memory, and if the content of the first type field does not exist in the memory, storing the content of the first type field into a field file corresponding to the first type field in the memory; if the content of the first type field already exists in the memory, the field number of the content of the first type field in the field file is obtained from the field file corresponding to the first type field in the memory, and the field file corresponding to the first type field stored in the disk is updated.
And extracting a second type field from the vehicle passing data record, numbering the content of the second type field, and storing the content of the second type field and the number corresponding to the content into a field file corresponding to the second type field in the disk.
It is understood that the memory is one of the important components in the computer, and all the programs in the computer are executed in the memory. A Memory (Memory) is also called an internal Memory and temporarily stores data calculated by a central processing unit and data exchanged with an external Memory such as a hard disk. As long as the computer is in operation, the central processing unit transfers data to be operated to the memory for operation, and after the operation is completed, the central processing unit transmits the result, and the operation of the memory also determines the stable operation of the computer. According to the embodiment of the invention, the first type field in the vehicle-passing data record is simultaneously stored in the memory and the magnetic disk, so that a user can conveniently and quickly read the first type field from the memory when inquiring the vehicle-passing data record. It should be noted that when the vehicle-passing data record query device is powered off, the first type field in the memory is lost, and at this time, the user can query the first type field on the disk. Here, the magnetic disk is used for storing the vehicle-passing data records for a long time, and even if the vehicle-passing data record inquiry device is powered off, each field of the vehicle-passing data records on the magnetic disk cannot be lost.
Here, the field file is used to store the contents of each field of the past vehicle data record and the corresponding number thereof.
For example, a passing data record is obtained with a record number of 01, a passing time of 1 month, 1 day, 8:00, a bayonet name of X bayonet, a license plate number of a12345, a vehicle color of red, a vehicle type of car, and a passing picture url of xxxx. Extracting a first type field (a gate name, a vehicle color and a vehicle type) from the vehicle passing data record, wherein the content of the gate name of the first type field is X gate, the content of the vehicle color is red, and the content of the vehicle type is a car; and extracting a second type field (a passing time, a license plate number and a passing picture url) from the passing data record, wherein the content of the passing time of the second type field is 1 month, 1 day and 8:00, the content of the license plate number is A12345, and the content of the color of the vehicle is red.
Specifically, the step of storing the content of the bayonet name and the corresponding serial number thereof in the bayonet name field file corresponding to the bayonet name in the memory, and updating the bayonet name field file corresponding to the bayonet name in the disk includes: if the vehicle passing data record is the vehicle passing data record obtained from the X bayonet, judging whether the content of the bayonet name of the vehicle passing data record, namely the X bayonet, exists in the memory or not, if not, numbering the X bayonet to obtain the number corresponding to the X bayonet, storing the X bayonet and the number corresponding to the X bayonet into a bayonet name field file of the memory, if the X bayonet exists in the memory, obtaining the bayonet name, namely the number corresponding to the X bayonet, from the bayonet name field file of the memory, and updating the bayonet name field file in the disk. Table 2 shows a correspondence between the content number of the card port name and the content of the card port name in the card port name field file, where the name of the card port name field file is the card port name.
TABLE 2
Content numbering of bayonet names Content of bayonet names
01 A bayonet
02 B bayonet
03 C bayonet
04 D bayonet
05 E bayonet
Taking the vehicle color field file as an example again, if the vehicle color of the obtained vehicle passing data record is "red", judging whether the content "red" of the vehicle color of the vehicle passing data record exists in the memory, if not, numbering the "red" to obtain a number corresponding to the "red", storing the "red" in the vehicle color field file of the memory, if the "red" already exists in the memory, obtaining the vehicle color, namely the number corresponding to the "red", from the vehicle color field file of the memory, and updating the vehicle color field file in the disk. Table 3 shows the correspondence between the content number of the vehicle color and the content of the vehicle color in the vehicle color field file, where the name of the vehicle color field file is the vehicle color. For example, in table 3 below, the white vehicle corresponds to a vehicle color number of "02".
TABLE 3
Content numbering of vehicle colors Content of vehicle color
01 Red colour
02 White colour
03 Black color
04 Yellow colour
05 Blue color
Next, the content of the license plate number and the number corresponding to the content are stored in a license plate number field file corresponding to the license plate number in the disk. If the obtained license plate number recorded by the vehicle passing data is 'A12345', judging whether the 'A12345' exists in the disk or not, if not, numbering the 'A12345', obtaining a number corresponding to the 'A12345', and storing the 'A12345' and the number corresponding to the 'A12345' into a vehicle number field file in the disk; and if so, acquiring the number corresponding to the A12345 from the license plate number field file corresponding to the A12345 in the disk. For example, table 4 shows the correspondence between the content number of the license plate number and the content of the license plate number in the license plate number field file, where the name of the license plate number field file is the license plate number.
TABLE 4
Content numbering of license plate numbers Content of license plate number
01 A12345
02 B23456
03 C34567
04 D45678
05 E78910
In addition, the number of the content of each field in the vehicle passing data record in the corresponding field file is written into a data file, wherein the data file comprises a data file header and the content of the data file, and specifically, the data file header is used for associating each field file; the data file content is used for storing the record number of the vehicle passing data record and the number of the content corresponding to each field in the corresponding field file. In the following description, taking data files as an example, as shown in table 5, table 5 shows the correspondence between the record number of the vehicle passing data record and the content number and field name of each field in the vehicle passing data record, where the data file header includes: the record number, the field name (passing time, mount name, license plate number, vehicle color, vehicle type, and vehicle picture url) corresponding to each field content number, and the data file header of table 5 further includes the storage length occupied by each field content number. For example, if the storage length occupied by the header of the data file is 32 bits, the storage length occupied by each recording number is 64 bits, the storage length occupied by the content number of the passing time is 64 bits, the storage length occupied by the content number of the bayonet name is 8 bits, the storage length occupied by the content number of the license plate number is 16 bits, the storage length occupied by the content number of the vehicle color is 8 bits, the storage length occupied by the content number of the vehicle type is 8 bits, and the storage length occupied by the content number of the vehicle picture url is 64 bits, then the storage length occupied by one piece of passing data recorded in the data file is 232 bits. In practical applications, the storage length occupied by the record number of each passing data record and the content number of each field in the data file may include other storage lengths. Table 5 shows that the storage length occupied by the data file header is 32 bits, and specifically, the storage length occupied by the data file header may include other storage lengths.
TABLE 5
Record number Passing vehicle time Name of bayonet License plate number Vehicle color Type of vehicle Vehicle picture url
11 11 12 23 01 09 11
12 12 22 15 03 13 12
When the vehicle passing data records are obtained, the content of each field in each vehicle passing data record is stored in a corresponding index file, and specifically, each field in each vehicle passing data record corresponds to one index file. For example, the license plate color corresponds to a license plate color index file, the license plate number corresponds to a license plate number index file, and the vehicle type corresponds to a vehicle type index file. Here, the index file is used to store the contents of each field and its corresponding record number. The following description will be given taking a license plate number index file (correspondence between the contents of license plate numbers and record numbers) as an example, as shown in table 6.
TABLE 6
Figure BDA0001118575550000091
Figure BDA0001118575550000101
When a passing data record is input, checking whether the content of the license plate number in the passing data record exists in a license plate number index file, if not, storing the content of the license plate number and the record number of the passing data record into the license plate number index file; if the license plate number exists, the record number of the vehicle passing data record is filled in the license plate number.
Specifically, table 6 shows that the record number "03" and the record number "08" are filled in the license number index file after the content "C34567" of the license number. When the content of the field of the passing data record with the record number "11" is "C34567", the record number "11" is filled in the license number index file after the content of the license number "C34567". Here, the record number following the content of the license plate number in the license plate number index file indicates that the content of the field of the passing data record corresponding to the record number includes the license plate number.
The above is an example of partial fields in the vehicle-passing data record, and how to store one vehicle-passing data record in the relevant files (i.e., the field file, the data file, and the index file) in the database is specifically described. When the content of the fields in the vehicle data record needs to be queried, the query is performed according to the method of the present invention as shown in the following embodiment.
Referring to fig. 1, fig. 1 is a flowchart of a method for querying a checkpoint passing data record according to an embodiment of the present invention, including the following steps:
s101, receiving a query request, wherein the query request at least comprises a field to be queried;
the query request includes at least one field to be queried, and it is understood that the query request may include one field to be queried, or the query request may include two fields to be queried, or the query request may include three fields to be queried, or the query request may include more fields to be queried. Here, the field to be queried may be one or more fields among a license plate number, a vehicle color, a passing time, a bayonet name, a vehicle type, and a passing picture.
S102, acquiring an index file corresponding to the field to be queried, querying a record number corresponding to the content of the field to be queried in the index file, and acquiring all record numbers to be queried;
specifically, each field to be queried corresponds to an index file, that is, a license plate number corresponds to a license plate number index file, and a vehicle color corresponds to a vehicle color index file. And inquiring the record number corresponding to the content of the field to be inquired in the corresponding index file according to the field name of the field to be inquired. For example, when a user queries a license plate number, the license plate number is input into a database query system, and a record number corresponding to the content of the license plate number is queried in a license plate number index file according to the field name (license plate number) of the field to be queried. For example, when the user wants to inquire that the content of the license plate number is "a 12345", the record number "01" and the record number "06" corresponding to the content "a 12345" of the license plate number are obtained in the license plate number index file (table 6).
Preferably, according to the field name of the field to be queried, the record number corresponding to the content of the license plate number is queried in the license plate number index file through a dichotomy.
In a possible implementation manner of the embodiment of the present invention, when the query request includes more than two fields to be queried, querying the record number corresponding to the content of the field to be queried in the index file corresponding to the more than two fields to be queried, and obtaining all the record numbers to be queried includes: after the record numbers corresponding to the contents of the more than two fields to be inquired are inquired in the index file, the intersection of the records corresponding to the inquiry fields is taken; and taking all the record numbers after intersection as all the obtained record numbers to be inquired.
Specifically, when the query request includes two fields of input license plate number and bayonet name, record numbers corresponding to the contents of the two fields of the license plate number and the bayonet name are queried in a license plate number index file and a bayonet name index file respectively, and then intersection is taken from the record numbers to obtain record numbers of all vehicle passing data records including the two fields. For example, when the query request includes two fields of a license plate number and a bayonet name, the contents of the two fields of the license plate number and the bayonet name are "C34567" and "Z bayonet", respectively, in the license plate index file and the bayonet index file, the record numbers "03", "08", "11" and the record numbers "03", "06", "11" corresponding to the content "C34567" of the license plate number and the content "Z bayonet" of the bayonet name are queried, the record numbers "03", "08", "11" and the record numbers "03", "06", "11" are intersected to obtain the record numbers "03" and "11" after the intersection is taken, wherein the contents of the fields in the passing data record corresponding to the record numbers "03" and "11" include the license plate number "C34567" and the "Z bayonet".
S103, sequentially calculating the position of each record number in the data file in all the record numbers to be inquired according to a preset offset; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
here, taking table 5 as an example, assuming that the sum of the storage length occupied by the record number of each vehicle passing data record and the content number of each field is 232bit, the preset offset is 232bit, and the storage length occupied by the data file header is 32 bit. After all record numbers to be inquired are obtained in the index file, the position of each record number in the data file in all the record numbers to be inquired is calculated in sequence according to a preset offset. Here, assuming that the obtained record numbers to be queried are "04" and "08", the position of the record number "04" in the data file: 32+232 × (4-1) ═ 728 bits, where 4 represents record number "04"; record number "08" location in data file: 1656 bits, where 8 represents record number "08", 32+232 × (8-1) ═ 1656 bits. At the 728bit and 1656bit positions in the data file, the content numbers and field names of the fields corresponding to the record numbers "04" and "08" are searched according to the corresponding relationship between the stored record numbers "04" and "08" and the content numbers and field names of the fields.
S104, acquiring a field file corresponding to the field name according to the field name, and inquiring the content corresponding to the content number of the field from the field file according to the content number of the field;
in a possible implementation manner of the embodiment of the present invention, obtaining a field file corresponding to a field name according to the field name includes: if the field corresponding to the field name is the first type field, acquiring a field file corresponding to the field name in the memory; and if the field corresponding to the field name is the second type field, acquiring the field file corresponding to the field name in the disk.
Specifically, the obtained field name is associated with the field file corresponding to the field name. For example, a field name of vehicle color is associated to a vehicle color field file, and a field name of license plate number is associated to a license plate number field file. Specifically, the field name of the first type field is associated with the field file corresponding to the field name of the first type field in the memory, and the field name of the second type field is associated with the field file corresponding to the field name of the second type field in the disk.
In a possible implementation manner of the embodiment of the present invention, querying, from the field file, a content corresponding to the content number of the field according to the content number of the field includes: if the field file is in the memory, comparing the content number of the field with the number in the field file to obtain the content corresponding to the content number of the field; and if the field file is in the disk, calculating the offset of the content number of the field in the field file, and obtaining the content corresponding to the content number of the field.
It should be noted that, when the content corresponding to the content number of the first-type field is searched in the field file in the memory, the content number of the field is compared with the number corresponding to the content of the field in the corresponding field file to obtain the content corresponding to the content number. When the content of the second type field is inquired in the field file in the disk, the offset of the number in the corresponding field file is calculated according to the obtained content number of the second type field, and the content corresponding to the content number of the second type field is obtained in the corresponding field file according to the offset. For example, as shown in table 5, obtaining the content number of each field corresponding to the record number "11" in the data file includes: the content number "11" of the passing time, the content number "12" of the gate name, the content number "23" of the license plate number, the content number "01" of the vehicle color, the content number "09" of the vehicle type, and the content number "11" of the vehicle picture url. Comparing the content number '12' of the bayonet name with the number '12' in the bayonet name field file to obtain the content 'M bayonet' of the bayonet name corresponding to the number '12' in the bayonet name field file, wherein the 'M bayonet' is the content of the bayonet name recorded by the passing data corresponding to the recorded number '11'; and when the field file corresponding to the license plate number is in the disk, calculating the offset of the content number of the license plate number in the field file of the license plate number. For example, the offset of the content of the license plate number in the license plate number field file is 64 × (23-1) ═ 1408bit, and the content "a 45678" of the corresponding license plate number of the content number "23" of the license plate number in the license plate number field file in the disk is obtained according to the offset.
And S105, outputting the field to be queried and a target field corresponding to the field to be queried, wherein the target field comprises a field file name where the content number of the field is located and content corresponding to the content number of the field.
Here, the target field refers to a field in the passing vehicle data record that is specified to be queried when the field to be queried is input. For example, the query request includes a license plate number and a bayonet name, and the target field includes: vehicle color, vehicle type, time of passing, and field or fields in the picture url of passing. The target field is the field that the user indicates in the query request to display in the results of the query.
Therefore, according to the characteristic that the field repeatability of the card port vehicle-passing data record is high, the method for inquiring the card port vehicle-passing data record reads the content of the field with high repeatability in the memory when the card port vehicle-passing data record is inquired, and the card port vehicle-passing data record is quickly inquired. By applying the embodiment of the invention, the storage space of the vehicle-passing data record of the memory card port can be reduced, meanwhile, the hardware cost is reduced, and the speed of inquiring the vehicle-passing data record of the memory card port is improved.
Referring to fig. 2, fig. 2 is a schematic structural diagram of an inquiry apparatus for a checkpoint passing data record according to an embodiment of the present invention, including:
a receiving unit 210, configured to receive an inquiry request, where the inquiry request includes at least one field to be inquired;
an index file querying unit 220, configured to obtain an index file corresponding to the field to be queried, query the record number corresponding to the content of the field to be queried in the index file, and obtain all record numbers to be queried;
a query data file unit 230, configured to sequentially calculate, according to a preset offset, a position of each record number in the data file, in all the record numbers to be queried; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
a field file querying unit 240, configured to obtain a field file corresponding to the field name according to the field name, and query, according to the content number of the field, a content corresponding to the content number of the field from the field file;
an output unit 250, configured to output the field to be queried and a target field corresponding to the field to be queried, where the target field includes a field file name where a content number of the field is located and content corresponding to the content number of the field.
In a possible implementation manner of the embodiment of the present invention, the apparatus further includes:
the first query index file unit is used for querying record numbers corresponding to the contents of the more than two fields to be queried in the index file and then taking an intersection of records corresponding to the query fields;
and the intersection taking unit is used for taking all the record numbers after intersection taking as all the obtained record numbers to be inquired.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a query field file unit of a query device for a vehicle passing data record at a checkpoint, provided by an embodiment of the present invention, specifically including:
a first field file query subunit 310, configured to, if a field corresponding to the field name is a first type field, obtain, in a memory, a field file corresponding to the field name;
a second field file query subunit 320, configured to, if the field corresponding to the field name is a second type field, obtain, in the disk, the field file corresponding to the field name.
A third query field file subunit 330, configured to, if the field file is in the memory, compare the content number of the field with the number in the field file, and obtain content corresponding to the content number of the field;
a fourth query field file subunit 340, configured to, if the field file is in the disk, calculate an offset of the content number of the field in the field file, and obtain content corresponding to the content number of the field.
Therefore, according to the characteristic that the field repeatability of the card port vehicle-passing data record is high, the inquiry device for the card port vehicle-passing data record reads the content of the field with high repeatability in the memory when inquiring the card port vehicle-passing data record, and the card port vehicle-passing data record is quickly inquired. By applying the embodiment of the invention, the storage space of the vehicle-passing data record of the memory card port can be reduced, meanwhile, the hardware cost is reduced, and the speed of inquiring the vehicle-passing data record of the memory card port is improved.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (9)

1. The method for inquiring the data record of the bayonet vehicle passing is characterized in that the storage mode of the data of the bayonet vehicle passing is as follows: storing all vehicle passing data records in a certain time period in a directory; each vehicle passing data record is stored in the form of a plurality of fields; when a vehicle passing data record is obtained, numbering the vehicle passing data record to obtain a record number corresponding to the vehicle passing data record; storing the content of each field in the vehicle passing data record and the number corresponding to the vehicle passing data record into a field file; writing the serial number of the content of each field in the vehicle passing data record in the field file corresponding to the vehicle passing data record into a data file; respectively storing the content of each field in the vehicle passing data record into an index file corresponding to each field;
the query method of the bayonet vehicle-passing data record comprises the following steps:
receiving a query request, wherein the query request at least comprises a field to be queried;
acquiring an index file corresponding to the field to be queried, querying a record number corresponding to the content of the field to be queried in the index file, and acquiring all record numbers to be queried;
sequentially calculating the position of each record number in the record numbers to be inquired in the data file according to a preset offset; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
acquiring a field file corresponding to the field name according to the field name, and inquiring the content corresponding to the content number of the field from the field file according to the content number of the field;
and outputting the field to be queried and a target field corresponding to the field to be queried, wherein the target field comprises a field file name of the field with the content number of the field and the content corresponding to the content number of the field.
2. The method according to claim 1, wherein when the query request includes more than two fields to be queried, the record number corresponding to the content of the field to be queried is queried in the index file corresponding to the more than two fields to be queried, and the step of obtaining all record numbers to be queried includes:
after the record numbers corresponding to the contents of the more than two fields to be inquired are inquired in the index file, the intersection of the records corresponding to the inquiry fields is taken;
and taking all the record numbers after intersection as all the obtained record numbers to be inquired.
3. The method of claim 1, wherein obtaining the field file corresponding to the field name according to the field name comprises:
if the field corresponding to the field name is the first type field, acquiring a field file corresponding to the field name in the memory;
and if the field corresponding to the field name is the second type field, acquiring the field file corresponding to the field name in the disk.
4. The method according to claim 1, wherein the querying the content corresponding to the content number of the field from the field file according to the content number of the field comprises:
if the field file is in the memory, comparing the content number of the field with the number in the field file to obtain the content corresponding to the content number of the field;
and if the field file is in the disk, calculating the offset of the content number of the field in the field file, and obtaining the content corresponding to the content number of the field.
5. The method of claim 1, wherein the target fields are all fields recorded in one passing vehicle data record or fields displayed in the query result indicated in the query request.
6. The utility model provides an inquiry unit of bayonet crossing car data record which characterized in that, bayonet crossing car data's memory mode is: storing all vehicle passing data records in a certain time period in a directory; each vehicle passing data record is stored in the form of a plurality of fields; when a vehicle passing data record is obtained, numbering the vehicle passing data record to obtain a record number corresponding to the vehicle passing data record; storing the content of each field in the vehicle passing data record and the number corresponding to the vehicle passing data record into a field file; writing the serial number of the content of each field in the vehicle passing data record in the field file corresponding to the vehicle passing data record into a data file; respectively storing the content of each field in the vehicle passing data record into an index file corresponding to each field;
the inquiry unit of bayonet vehicle-passing data record includes:
the device comprises a receiving unit, a query unit and a query unit, wherein the receiving unit is used for receiving a query request which at least comprises a field to be queried;
the index file inquiring unit is used for acquiring an index file corresponding to the field to be inquired, inquiring the record number corresponding to the content of the field to be inquired in the index file and acquiring all the record numbers to be inquired;
the query data file unit is used for sequentially calculating the position of each record number in the data file in all the record numbers to be queried according to a preset offset; at the position, searching the content number and the field name of the field corresponding to the record number according to the corresponding relation among the record number, the content number of the field and the field name stored in the data file;
a field file inquiry unit, configured to obtain a field file corresponding to the field name according to the field name, and inquire, from the field file, a content corresponding to the content number of the field according to the content number of the field;
and the output unit is used for outputting the field to be queried and a target field corresponding to the field to be queried, wherein the target field comprises a field file name where the content number of the field is located and content corresponding to the content number of the field.
7. The apparatus of claim 6, wherein the query request comprises more than two fields to be queried, and wherein the apparatus further comprises:
the first query index file unit is used for querying record numbers corresponding to the contents of the more than two fields to be queried in the index file and then taking an intersection of records corresponding to the query fields;
and the intersection taking unit is used for taking all the record numbers after intersection taking as all the obtained record numbers to be inquired.
8. The apparatus of claim 6, wherein the query field file unit comprises:
a first query field file subunit, configured to, if a field corresponding to the field name is a first type field, obtain, in the memory, a field file corresponding to the field name;
and the second field file query subunit is used for acquiring the field file corresponding to the field name in the disk if the field corresponding to the field name is the second type field.
9. The apparatus of claim 6, wherein the query field file unit further comprises:
a third field file query subunit, configured to, if the field file is in the memory, compare the content number of the field with the number in the field file, and obtain content corresponding to the content number of the field;
and the fourth field file inquiring subunit is used for calculating the offset of the content number of the field in the field file if the field file is in the disk, and acquiring the content corresponding to the content 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 CN107861956A (en) 2018-03-30
CN107861956B true 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)

Families Citing this family (1)

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

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8271462B2 (en) * 2010-12-10 2012-09-18 Inventec Corporation Method for creating a index of the data blocks

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN107861956A (en) 2018-03-30

Similar Documents

Publication Publication Date Title
CN102799634B (en) Data storage method and device
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
US9870382B2 (en) Data encoding and corresponding data structure
CN108228817A (en) Data processing method, device and system
CN107992492B (en) Data block storage method, data block reading method, data block storage device, data block reading device and block chain
JP2019527898A (en) Systems, methods, and data structures for fast search or filtering of large datasets
CN110109910A (en) Data processing method and system, electronic equipment and computer readable storage medium
WO2018097846A1 (en) Edge store designs for graph databases
CN105373541A (en) Processing method and system for data operation request of database
CN113177090A (en) Data processing method and device
CN111258819A (en) Data acquisition method, device and system for MySQL database backup file
CN101963993B (en) Method for fast searching database sheet table record
CN100357952C (en) Binary data access method
CN107861956B (en) Method and device for inquiring data record of bayonet passing vehicle
US20070282804A1 (en) Apparatus and method for extracting database information from a report
CN106909623B (en) A kind of data set and date storage method for supporting efficient mass data to analyze and retrieve
WO2023197865A1 (en) Information storage method and apparatus
CN110019192B (en) Database retrieval method and device
CN116186116A (en) Asset problem analysis method based on equal protection assessment
JP2001216307A (en) Relational database management system and storage medium stored with same
CN110008243A (en) A kind of tables of data processing method and processing device
US20230377692A1 (en) Methods and systems for storing genomic data in a file structure comprising an information metadata structure
CN115344603A (en) Freight rate data storage method and device, electronic equipment and computer storage medium
CN115114297A (en) Data lightweight storage and search method and device, electronic equipment and storage medium
CN110399396A (en) Efficient data processing

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