CN105824829A - Compression method, uncompressing method and apparatus for order history - Google Patents

Compression method, uncompressing method and apparatus for order history Download PDF

Info

Publication number
CN105824829A
CN105824829A CN201510004883.8A CN201510004883A CN105824829A CN 105824829 A CN105824829 A CN 105824829A CN 201510004883 A CN201510004883 A CN 201510004883A CN 105824829 A CN105824829 A CN 105824829A
Authority
CN
China
Prior art keywords
chapters
sections
order record
sequence number
offset
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
CN201510004883.8A
Other languages
Chinese (zh)
Other versions
CN105824829B (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.)
China Mobile Group Zhejiang Co Ltd
Original Assignee
China Mobile Group Zhejiang 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 China Mobile Group Zhejiang Co Ltd filed Critical China Mobile Group Zhejiang Co Ltd
Priority to CN201510004883.8A priority Critical patent/CN105824829B/en
Publication of CN105824829A publication Critical patent/CN105824829A/en
Application granted granted Critical
Publication of CN105824829B publication Critical patent/CN105824829B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a compression method, uncompressing method and apparatus for an order history. The compression method comprises steps of acquiring a chapter serial number of a to-be-compressed order history, looking for a position of an order state corresponding to the chapter serial number in an order history list based on a chapter bitmap addressing algorithm, and using a bitmap compression algorithm to modify the order state corresponding to the chapter serial number to an ordered state. By the use of the compression method for the order history, compression time delay can be shortened.

Description

A kind of compression method for order record, decompression method and device
Technical field
The present invention relates to data service technical field, particularly relate to a kind of compression method for order record, decompression method and device.
Background technology
Mobile phone is read as a kind of new reading method, has started to progressively replace books and the newspapers and periodicals etc. of papery, has more and more entered into the studying and living of people.But, along with being continuously increased of customer volume and e-book quantity, the order record of user, with geometric growth, causes reading platform data base the bottleneck in memory space and performance occur the most at last.
Existing compress technique is that tables of data is compressed by the table compression function carried by relational data library software (such as Oracle and Sqlserver), and table contraction principle is that the data value repeated in tables of data by deletion saves space.Further, when compression, use the shorter symbol of length to replace each value in row, owing to symbol takes up room less than actual value, thus reach space-saving effect.This compress mode is generally used for depositing OLAP (On-LineAnalyticalProcessing on-line analytical processing) data base of mass data, is used for saving memory space, promotes data backup and resume speed.
But, existing compress technique has a disadvantage in that when key assignments renewal is inserted, updates and indexed to data, will first decompress and update again, cause operating time delay high, be not suitable for user and require OLTP (On-LineTransactionProcessing online transaction processing system) data base of Millisecond response speed;Data after compression are not supported the tables of data after compression is carried out high concurrent reading and concurrent writing.
Summary of the invention
It is an object of the invention to provide a kind of compression method for order record, decompression method and device, by the read-write to order record table, complete the decompression to order record and compression, shorten the time delay of squeeze operation, to adapt to the OLTP database of Millisecond response speed.
In order to reach the purpose of the present invention, the present invention provides a kind of compression method for order record, including: obtain the chapters and sections sequence number in order record to be compressed;Based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table;Use bits compression algorithm, revise subscription status corresponding to described chapters and sections sequence number for order.
Being previously described for the compression method of order record, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table and include:
Obtain chapters and sections bitmap field length a in described order record table;
Utilize formula 1, calculate bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Utilize formula 2, calculate subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Being previously described for the compression method of order record, each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
It is previously described for the compression method of order record, described bits compression algorithm is a kind of inclusive-OR operation, described use bits compression algorithm, revising subscription status corresponding to described chapters and sections sequence number is to have ordered to include: use " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
The present invention also provides for a kind of compressor for order record, including the first acquisition module, addressed module and compression module;Described first acquisition module, for obtaining the chapters and sections sequence number in order record to be compressed;Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;Described compression module, is used for using bits compression algorithm, revises subscription status corresponding to described chapters and sections sequence number for order.
Being previously described for the compressor of order record, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described addressed module includes the second acquisition module, the first computing module and the second computing module;
Described second acquisition module, for obtaining chapters and sections bitmap field length a in described order record table;
Described first computing module, is used for utilizing formula 1, calculates bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Described second computing module, is used for utilizing formula 2, calculates subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Being previously described for the compressor of order record, each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
It is previously described for the compressor of order record, described bits compression algorithm is a kind of inclusive-OR operation, described compression module is used for using " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
The present invention provides again a kind of decompression method for order record, including: receive the chapters and sections sequence number in order record to be authenticated;Based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table;Judge whether subscription status corresponding to described chapters and sections sequence number is to order.
Being previously described for the decompression method of order record, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table and include:
Obtain chapters and sections bitmap field length a in described order record table;
Utilize formula 1, calculate bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Utilize formula 2, calculate subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Being previously described for the decompression method of order record, each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
It is previously described for the decompression method of order record, described judge whether subscription status corresponding to described chapters and sections sequence number is to have ordered to include: judge whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then represent that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
The present invention provides again a kind of decompressing device for order record, it is characterised in that include the first receiver module, addressed module and decompression module;Described first receiver module, for receiving the chapters and sections sequence number in order record to be authenticated;Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;Whether described decompression module, be to order for judging subscription status corresponding to described chapters and sections sequence number.
Being previously described for the decompressing device of order record, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described addressed module includes the second acquisition module, the first computing module and the second computing module;
Described second acquisition module, for obtaining chapters and sections bitmap field length a in described order record table;
Described first computing module, is used for utilizing formula 1, calculates bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Described second computing module, is used for utilizing formula 2, calculates subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Being previously described for the decompressing device of order record, each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
It is previously described for the decompressing device of order record, described decompression module is for judging whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then it represents that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
By above-mentioned technical scheme, having the technical effect that of the embodiment of the present invention
1, the compression method for order record of the specific embodiment of the invention, it is to utilize the chapters and sections sequence number in order record to be compressed, based on chapters and sections bitmap addressing algorithm and bits compression algorithm, by in described order record write order record table to be compressed, reach to compress the purpose of order record, change existing compress mode, shorten squeeze operation time delay, it is possible to adapt to the OLTP database of Millisecond response speed.
2 and, the tables of data compression algorithm that the compression method of the present invention and data base carry is compatible, in OLTP system, can be continuing with data base's existing tables of data compression function, thus realize preferably compression effectiveness on the basis of the compression of the present invention.
3, the decompression method for order record of the specific embodiment of the invention, chapters and sections sequence number in order record to be authenticated is linked together with order record table, whether it is to order by judging subscription status corresponding to described chapters and sections sequence number in order record table, reaches authentication and the purpose decompressed.
Accompanying drawing explanation
Fig. 1: for the block diagram of the compression method for order record of the embodiment of the present invention.
Fig. 2: for addressing and the flow chart of compression of one embodiment of the invention.
Fig. 3: for the block diagram of the compressor for order record of the embodiment of the present invention.
Fig. 4: for the block diagram of the decompression method for order record of the embodiment of the present invention.
Fig. 5: for decompression and the flow chart of authentication of another embodiment of the present invention.
Fig. 6: for the block diagram of the decompressing device for order record of the embodiment of the present invention.
Detailed description of the invention
For making the purpose of the embodiment of the present invention, technical scheme and advantage clearer, below in conjunction with accompanying drawing, specific embodiment is described in detail.
Deposit in scheme in current order record, chapters and sections of the every ordering book of user, just insert the data comprising the information such as cell-phone number, books sequence number and chapters and sections sequence number, in order to subsequent authentication uses in user's order record table.Again because user often reads paying chapters and sections and will generate one and added the order of the chapters and sections in every books and be fixing by the order record of chapters and sections, this just use chapters and sections bitmap field for the present invention represent that the chapters and sections sequence number in order record provides the foundation.
The compression method for order record of the specific embodiment of the invention, it is exactly to utilize the chapters and sections sequence number in order record to be compressed, based on chapters and sections bitmap addressing algorithm and bits compression algorithm, by in described order record write order record table to be compressed, reach to compress the purpose of order record, change existing compress mode, shorten squeeze operation time delay, it is possible to adapt to the OLTP database of Millisecond response speed.Further, the tables of data compression algorithm that the compression method of the present invention and data base carry is compatible, in OLTP system, can be continuing with data base's existing tables of data compression function, thus realize preferably compression effectiveness on the basis of the compression of the present invention.
Refering to shown in Fig. 1, the embodiment of the present invention provides a kind of compression method for order record, including:
Step S101: obtain the chapters and sections sequence number in order record to be compressed;
Step S102: based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Step S103: use bits compression algorithm, revise subscription status corresponding to described chapters and sections sequence number for order.
The compression method for order record of the specific embodiment of the present invention, it is that the chapters and sections sequence number in order record to be compressed is linked together with order record table, by changing described order record table, reach to be compressed into described order record to be compressed the purpose of described order record table, to reduce the consumption of whole memory space.
Concrete, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections sequence number is through bits of offset and chapters and sections bitmap field shows.
Wherein, described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters, and each binary-coded character is expressed as the Boolean that chapters and sections are ordered, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.It is to say, if the length of chapters and sections bitmap field is a, it just can represent 4a chapters and sections subscription status.Such as, described chapters and sections bitmap field is A1, and the binary-coded character of its correspondence is exactly 10100001, represent the 1st, 3, chapters and sections corresponding to 8 positions ordered, and the 2nd, chapters and sections corresponding to 4-7 position are not subscribed to.
In user's order record, described chapters and sections sequence number is, have may already more than the chapters and sections number that chapters and sections bitmap field length can represent, in order to ensure that described chapters and sections sequence number can be expressed, in described order record table, introduces bits of offset.When described bits of offset is-1, represent by this order;And when described bits of offset is 0 to 99 (or non-1), represent that pressing chapter orders.
Concrete, described based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table and include:
Obtain chapters and sections bitmap field length a in described order record table;
Utilize formula 1, calculate bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Utilize formula 2, calculate subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
When searching out subscription status corresponding to described chapters and sections sequence number in order record table behind the position at place, it is possible to the subscription status corresponding by changing described chapters and sections sequence number, described order record is compressed into order record table.
In a particular embodiment of the present invention, described bits compression algorithm is a kind of inclusive-OR operation, described use bits compression algorithm, and revising subscription status corresponding to described chapters and sections sequence number is to have ordered to include:
Use " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, the binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
A specific embodiment is set forth below, addressing and the compression process of the present invention is described, refering to shown in Fig. 2.
In this specific embodiment, chapters and sections sequence number num in order record to be compressed is 152, chapters and sections bitmap field length a of corresponding order record table is 8, so, bits of offset b is obtained equal to 12 according to formula one, obtain side-play amount offset equal to 8 according to formula two simultaneously, so, it is 12 and side-play amount is the place of 8 that subscription status corresponding to described chapters and sections sequence number 152 is at the bits of offset of described order record table, see Fig. 2, chapters and sections bitmap field herein is 0CF, and corresponding string of binary characters is 000011001111;Subsequently, utilize bits compression algorithm, string of binary characters 000000010000 and described string of binary characters 000011001111 is used to make inclusive-OR operation, described string of binary characters 000011001111 is revised as string of binary characters 000011011111, and the most corresponding chapters and sections bitmap field is revised as 0DF;This completes and described order record to be compressed is compressed into order record table.
Owing to the bits compression algorithm in the embodiment of the present invention is a kind of inclusive-OR operation, repetitive operation does not interferes with the correctness of data, it is to avoid producing and repeat record, relative to existing compress technique, fault-tolerance is strong.
Refering to shown in Fig. 3, the embodiment of the present invention also provides for a kind of compressor for order record, corresponding with the compression method for order record of Fig. 1, including the first acquisition module, addressed module and compression module;
Described first acquisition module, for obtaining the chapters and sections sequence number in order record to be compressed;
Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Described compression module, is used for using bits compression algorithm, revises subscription status corresponding to described chapters and sections sequence number for order.
Wherein, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections sequence number is through bits of offset and chapters and sections bitmap field shows.
Described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters, and each binary-coded character is expressed as the Boolean that chapters and sections are ordered, and " 1 " represents that chapters and sections have been ordered, and " 0 " represents that chapters and sections are not subscribed to.It is to say, if the length of chapters and sections bitmap field is a, it just can represent 4a chapters and sections subscription status.Described bits of offset is to ensure that described chapters and sections sequence number can be expressed and introduce.
Concrete, described addressed module includes the second acquisition module, the first computing module and the second computing module;
Described second acquisition module, for obtaining chapters and sections bitmap field length a in described order record table;
Described first computing module, is used for utilizing formula 1, calculates bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Described second computing module, is used for utilizing formula 2, calculates subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
In a particular embodiment of the present invention, described bits compression algorithm is a kind of inclusive-OR operation, described compression module is used for using " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
Refering to shown in Fig. 4, the embodiment of the present invention also provides for a kind of decompression method for order record, for order record is authenticated, including:
Step 401: receive the chapters and sections sequence number in order record to be authenticated;
Step 402: based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Step 403: judge whether subscription status corresponding to described chapters and sections sequence number is to order.
The decompression method for order record of the specific embodiment of the invention, chapters and sections sequence number in order record to be authenticated is linked together with order record table, whether it is to order by judging subscription status corresponding to described chapters and sections sequence number in order record table, reaches the purpose of authentication.
Concrete, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections sequence number is through bits of offset and chapters and sections bitmap field shows.
Wherein, described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters, and each binary-coded character is expressed as the Boolean that chapters and sections are ordered, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.It is to say, if the length of chapters and sections bitmap field is a, it just can represent 4a chapters and sections subscription status.
The decompression method for order record of the specific embodiment of the invention, the chapters and sections bitmap addressing algorithm used, identical with the above-mentioned chapters and sections bitmap addressing algorithm used for the compression method of order record, all it is intended to search out subscription status corresponding to chapters and sections sequence number position at place in order record table, does not repeats them here.
When described in searching out wait subscription status corresponding to the chapters and sections sequence number in the order record authenticated in order record table behind the position at place it is necessary to judge whether subscription status corresponding to described chapters and sections sequence number is to order.
Concrete, described judge whether subscription status corresponding to described chapters and sections sequence number is to have ordered to include:
Judge whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then it represents that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
It is to say, when the binary-coded character at the described side-play amount of described bits of offset is " 1 ", authentication is passed through, otherwise, authentication is not passed through.
A specific embodiment is set forth below, decompression and the authentication process of the present invention is described, refering to shown in Fig. 5.
In this specific embodiment, chapters and sections sequence number num in order record to be authenticated is 7 and 151, and chapters and sections bitmap field length a of corresponding order record table is 8;When num is 7, its subscription status location is that bits of offset is 0 and side-play amount is 7, and corresponding chapters and sections bitmap field is FF0, and corresponding string of binary characters is 111111110000, because the 7th position is " 1 ", therefore authentication is passed through, and chapters and sections are ordered;When num is 151, its subscription status location is that bits of offset is 12 and side-play amount is 7, and corresponding chapters and sections bitmap field is 0DF, and corresponding string of binary characters is 000011011111, because the 7th position is " 0 ", therefore authentication is not passed through, and chapters and sections are not subscribed to;This completes and decompress and the process of authentication.
Refering to shown in Fig. 6, the embodiment of the present invention also provides for a kind of decompressing device for order record, corresponding with the decompression method for order record of Fig. 4, including the first receiver module, addressed module and decompression module;
Described first receiver module, for receiving the chapters and sections sequence number in order record to be authenticated;
Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Whether described decompression module, be to order for judging subscription status corresponding to described chapters and sections sequence number.
Concrete, the decompressing device for order record of the specific embodiment of the invention, chapters and sections sequence number in order record to be authenticated is linked together with order record table, whether it is to order by judging subscription status corresponding to described chapters and sections sequence number in order record table, reaches the purpose of authentication.
Described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections sequence number is through bits of offset and chapters and sections bitmap field shows.Wherein, described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters, and each binary-coded character is expressed as the Boolean that chapters and sections are ordered, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.It is to say, if the length of chapters and sections bitmap field is a, it just can represent 4a chapters and sections subscription status.
The decompressing device for order record of the specific embodiment of the invention, its addressed module is identical with the above-mentioned addressed module for the compressor of order record, all it is intended to search out subscription status corresponding to chapters and sections sequence number position at place in order record table, does not repeats them here.
Described in searching out when described addressed module wait subscription status corresponding to the chapters and sections sequence number in the order record authenticated in order record table behind the position at place, described decompression module will judge whether subscription status corresponding to described chapters and sections sequence number is to order.
Concrete, described decompression module is for judging whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then it represents that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
The above is only the preferred embodiment of the present invention; it should be pointed out that, for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be regarded as protection scope of the present invention.

Claims (16)

1. the compression method for order record, it is characterised in that including:
Obtain the chapters and sections sequence number in order record to be compressed;
Based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Use bits compression algorithm, revise subscription status corresponding to described chapters and sections sequence number for order.
Compression method for order record the most according to claim 1, it is characterized in that, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table and include:
Obtain chapters and sections bitmap field length a in described order record table;
Utilize formula 1, calculate bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Utilize formula 2, calculate subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Compression method for order record the most according to claim 2, it is characterised in that each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
Compression method for order record the most according to claim 3, it is characterised in that described bits compression algorithm is a kind of inclusive-OR operation, described use bits compression algorithm, revising subscription status corresponding to described chapters and sections sequence number is to have ordered to include:
Use " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, the binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
5. the compressor for order record, it is characterised in that include the first acquisition module, addressed module and compression module;
Described first acquisition module, for obtaining the chapters and sections sequence number in order record to be compressed;
Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Described compression module, is used for using bits compression algorithm, revises subscription status corresponding to described chapters and sections sequence number for order.
Compressor for order record the most according to claim 5, it is characterized in that, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described addressed module includes the second acquisition module, the first computing module and the second computing module;
Described second acquisition module, for obtaining chapters and sections bitmap field length a in described order record table;
Described first computing module, is used for utilizing formula 1, calculates bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Described second computing module, is used for utilizing formula 2, calculates subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
Compressor for order record the most according to claim 6, it is characterised in that each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
Compressor for order record the most according to claim 7, it is characterized in that, described bits compression algorithm is a kind of inclusive-OR operation, described compression module is used for using " 1 " to make inclusive-OR operation with the binary-coded character at the described side-play amount of described bits of offset, binary-coded character at the described side-play amount of described bits of offset is rewritten as " 1 ", revises subscription status corresponding to described chapters and sections sequence number for order.
9. the decompression method for order record, it is characterised in that including:
Receive the chapters and sections sequence number in order record to be authenticated;
Based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Judge whether subscription status corresponding to described chapters and sections sequence number is to order.
Decompression method for order record the most according to claim 9, it is characterized in that, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described based on chapters and sections bitmap addressing algorithm, find subscription status corresponding to described chapters and sections sequence number position at place in order record table and include:
Obtain chapters and sections bitmap field length a in described order record table;
Utilize formula 1, calculate bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Utilize formula 2, calculate subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
11. decompression methods for order record according to claim 10, it is characterised in that each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
12. decompression methods for order record according to claim 11, it is characterised in that described judge whether subscription status corresponding to described chapters and sections sequence number is to have ordered to include:
Judge whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then it represents that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
13. 1 kinds of decompressing devices for order record, it is characterised in that include the first receiver module, addressed module and decompression module;
Described first receiver module, for receiving the chapters and sections sequence number in order record to be authenticated;
Described addressed module, for based on chapters and sections bitmap addressing algorithm, finds subscription status corresponding to described chapters and sections sequence number position at place in order record table;
Whether described decompression module, be to order for judging subscription status corresponding to described chapters and sections sequence number.
14. decompressing devices for order record according to claim 13, it is characterized in that, described order record table includes bits of offset and chapters and sections bitmap field, and described chapters and sections bitmap field is hexadecimal character string, and each hexadecimal character is expressed as four binary-coded characters;
Described addressed module includes the second acquisition module, the first computing module and the second computing module;
Described second acquisition module, for obtaining chapters and sections bitmap field length a in described order record table;
Described first computing module, is used for utilizing formula 1, calculates bits of offset b that subscription status corresponding to described chapters and sections sequence number is corresponding in order record table:
Formula 1;
Described second computing module, is used for utilizing formula 2, calculates subscription status corresponding to described chapters and sections sequence number side-play amount offset at described bits of offset b:
Offset=num-a × b × 4 formula 2;
Wherein, described chapters and sections serial number num, and the described side-play amount at described bits of offset is exactly subscription status corresponding to described chapters and sections sequence number position at place in order record table.
15. decompressing devices for order record according to claim 14, it is characterised in that each binary-coded character is expressed as the Boolean of order record, and wherein, " 1 " represents that chapters and sections are ordered, and " 0 " represents that chapters and sections are not subscribed to.
16. decompressing devices for order record according to claim 15, it is characterized in that, described decompression module is for judging whether the binary-coded character at the described side-play amount of described bits of offset is " 1 ", if " 1 ", then represent that chapters and sections are ordered, and if " 0 ", then it represents that chapters and sections are not subscribed to.
CN201510004883.8A 2015-01-06 2015-01-06 Compression method, decompression method and device for order record Active CN105824829B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510004883.8A CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510004883.8A CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Publications (2)

Publication Number Publication Date
CN105824829A true CN105824829A (en) 2016-08-03
CN105824829B CN105824829B (en) 2020-05-15

Family

ID=56513650

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510004883.8A Active CN105824829B (en) 2015-01-06 2015-01-06 Compression method, decompression method and device for order record

Country Status (1)

Country Link
CN (1) CN105824829B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861036A (en) * 2021-02-07 2021-05-28 广州华多网络科技有限公司 User favorite access method and device, equipment and medium thereof

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479362A (en) * 2010-11-24 2012-05-30 盛乐信息技术(上海)有限公司 Method for automatically subscribing incomplete e-book by using e-book reader
US8417730B2 (en) * 2008-04-14 2013-04-09 Objectif Lune Inc. Block compression algorithm
CN103078646A (en) * 2012-12-31 2013-05-01 上海宇芯科技有限公司 Dictionary lookup compression and decompression method and device
CN103281156A (en) * 2013-05-02 2013-09-04 华为技术有限公司 Methods and devices for compressing and decompressing data
CN103995887A (en) * 2014-05-30 2014-08-20 上海达梦数据库有限公司 Bitmap index compressing method and bitmap index decompressing method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8417730B2 (en) * 2008-04-14 2013-04-09 Objectif Lune Inc. Block compression algorithm
CN102479362A (en) * 2010-11-24 2012-05-30 盛乐信息技术(上海)有限公司 Method for automatically subscribing incomplete e-book by using e-book reader
CN103078646A (en) * 2012-12-31 2013-05-01 上海宇芯科技有限公司 Dictionary lookup compression and decompression method and device
CN103281156A (en) * 2013-05-02 2013-09-04 华为技术有限公司 Methods and devices for compressing and decompressing data
CN103995887A (en) * 2014-05-30 2014-08-20 上海达梦数据库有限公司 Bitmap index compressing method and bitmap index decompressing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112861036A (en) * 2021-02-07 2021-05-28 广州华多网络科技有限公司 User favorite access method and device, equipment and medium thereof

Also Published As

Publication number Publication date
CN105824829B (en) 2020-05-15

Similar Documents

Publication Publication Date Title
CN112765271B (en) Block chain transaction index storage method and device, computer equipment and medium
CN101739453B (en) Method and device for carrying out condition query on database table
CN106886375A (en) The method and apparatus of data storage
CN103678556A (en) Method for processing column-oriented database and processing equipment
US20100114843A1 (en) Index Compression In Databases
WO2023273235A1 (en) Data comparison method, apparatus and device for file, and storage medium
CN102193917A (en) Method and device for processing and querying data
CN107918621A (en) Daily record data processing method, device and operation system
CN103514295A (en) Method and device for archiving historical data
CN109739828B (en) Data processing method and device and computer readable storage medium
CN101576890A (en) Novel method and system for sorting fragment
CN105809473A (en) Training method, service recommending method for coupling model parameters and associated apparatus
CN103714105A (en) Method and devices for updating a database of a navigation device
CN104657387A (en) Data query method and device
CN105574041A (en) Data reconstruction method and device
US10007692B2 (en) Partition filtering using smart index in memory
CN111931848A (en) Data feature extraction method and device, computer equipment and storage medium
CN101963993B (en) Method for fast searching database sheet table record
CN110647577A (en) Data cube partitioning method and device, computer equipment and storage medium
CN103841168A (en) Data copy updating method and metadata server
CN111858581B (en) Paging query method and device, storage medium and electronic equipment
CN103092955B (en) Checkpointed method, Apparatus and system
CN104915435A (en) Data query method and device
CN105824829A (en) Compression method, uncompressing method and apparatus for order history
CN112416934A (en) hive table incremental data synchronization method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant