1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/*! @page packing Packing and Unpacking Data
WiredTiger's data packing uses format strings similar to those specified in the
Python struct module:
http://docs.python.org/library/struct
The first character of the format string can be used to indicate the byte
order, size and alignment of the packed data, according to the following
table:
<table>
@hrow{Character, Byte order, Size, Alignment}
@row{<tt>.</tt>, big-endian, packed, none}
@row{<tt>></tt>, big-endian, standard, none}
@row{<tt><</tt>, little-endian, standard, none}
@row{<tt>\@</tt>, native, native, native}
</table>
If the first character is not one of these, '.' (big-endian, packed) is
assumed: it naturally sorts in lexicographic order, and the packed format
uses variable-sized encoding of values to reduce the data size.
@notyet{little-endian format}
Only the default big-endian, packed format is currently supported.
The remaining characters in the format string specify the type of each field
to be packed into or unpacked from a byte array. See @ref schema_column_types
for the list of supported types.
@todo Describe the variable-length integer packing in sufficient detail that it can be re-implemented in other programming languages or in network clients.
@section config_examples Code samples
The code below is taken from the complete example program @ex_ref{ex_pack.c}. It demonstrates how to pack three integer values into a buffer and then unpack them again.
@snippet ex_pack.c packing
*/
|