Struct sqlite_rs::header::SqliteHeader
source · pub struct SqliteHeader { /* private fields */ }
Expand description
Database File Format
Offset | Size | Description |
---|---|---|
0 | 16 | The header string: “SQLite format 3\000” |
16 | 2 | The database page size in bytes. Must be a power of two between 512 and 32768 inclusive, or the bytes 1 representing a page size of 65536. |
18 | 1 | File format write version. 1 for legacy; 2 for WAL. |
19 | 1 | File format read version. 1 for legacy; 2 for WAL. |
20 | 1 | Bytes of unused “reserved” space at the end of each page. Usually 0. |
21 | 1 | Maximum embedded payload fraction. Must be 64. |
22 | 1 | Minimum embedded payload fraction. Must be 32. |
23 | 1 | Leaf payload fraction. Must be 32. |
24 | 4 | File change counter. |
28 | 4 | Size of the database file in pages. The “in-header database size”. |
32 | 4 | Page number of the first freelist trunk page. |
36 | 4 | Total number of freelist pages. |
40 | 4 | The schema cookie. |
44 | 4 | The schema format number. Supported schema formats are 1, 2, 3, and 4. |
48 | 4 | Default page cache size. |
52 | 4 | The page number of the largest root b-tree page when in auto-vacuum or incremental-vacuum modes, or zero otherwise. |
56 | 4 | The database text encoding. A bytes of 1 means UTF-8. A bytes of 2 means UTF-16le. A bytes of 3 means UTF-16be. |
60 | 4 | The “user version” as read and set by the user_version pragma. |
64 | 4 | True (non-zero) for incremental-vacuum mode. False (zero) otherwise. |
68 | 4 | The “Application ID” set by PRAGMA application_id. |
72 | 20 | Reserved for expansion. Must be zero. |
92 | 4 | The version-valid-for number. |
96 | 4 | SQLITE_VERSION_NUMBER |
Implementations§
source§impl SqliteHeader
impl SqliteHeader
pub const LENGTH_BYTES: usize = 100usize
pub fn magic_header_string(&self) -> &MagicHeaderString
sourcepub fn page_size(&self) -> &PageSize
pub fn page_size(&self) -> &PageSize
Examples found in repository?
examples/sqlite_info.rs (line 48)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn file_format_version_numbers(&self) -> &FileFormatVersionNumbers
pub fn file_format_version_numbers(&self) -> &FileFormatVersionNumbers
Examples found in repository?
examples/sqlite_info.rs (line 55)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn reserved_bytes_per_page(&self) -> &ReservedBytesPerPage
pub fn reserved_bytes_per_page(&self) -> &ReservedBytesPerPage
Examples found in repository?
examples/sqlite_info.rs (line 68)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
pub fn payload_fractions(&self) -> &PayloadFractions
sourcepub fn file_change_counter(&self) -> &FileChangeCounter
pub fn file_change_counter(&self) -> &FileChangeCounter
Examples found in repository?
examples/sqlite_info.rs (line 74)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn db_filesize_in_pages(&self) -> &DatabaseFileSizeInPages
pub fn db_filesize_in_pages(&self) -> &DatabaseFileSizeInPages
Examples found in repository?
examples/sqlite_info.rs (line 81)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn freelist_pages(&self) -> &FreeListPages
pub fn freelist_pages(&self) -> &FreeListPages
Examples found in repository?
examples/sqlite_info.rs (line 88)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
Examples found in repository?
examples/sqlite_info.rs (line 95)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn schema_format(&self) -> &SchemaFormat
pub fn schema_format(&self) -> &SchemaFormat
Examples found in repository?
examples/sqlite_info.rs (line 102)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn suggested_cache_size(&self) -> &SuggestedCacheSize
pub fn suggested_cache_size(&self) -> &SuggestedCacheSize
Examples found in repository?
examples/sqlite_info.rs (line 109)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn incremental_vacuum_settings(&self) -> &IncrementalVacuumSettings
pub fn incremental_vacuum_settings(&self) -> &IncrementalVacuumSettings
Examples found in repository?
examples/sqlite_info.rs (line 117)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn database_text_encoding(&self) -> &DatabaseTextEncoding
pub fn database_text_encoding(&self) -> &DatabaseTextEncoding
Examples found in repository?
examples/sqlite_info.rs (line 136)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn user_version(&self) -> &UserVersion
pub fn user_version(&self) -> &UserVersion
Examples found in repository?
examples/sqlite_info.rs (line 143)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
sourcepub fn application_id(&self) -> &ApplicationId
pub fn application_id(&self) -> &ApplicationId
Examples found in repository?
examples/sqlite_info.rs (line 150)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
pub fn reserved_for_expansion(&self) -> &ReservedForExpansion
pub fn version_valid_for(&self) -> &VersionValidFor
sourcepub fn write_library_version(&self) -> &WriteLibraryVersion
pub fn write_library_version(&self) -> &WriteLibraryVersion
Examples found in repository?
examples/sqlite_info.rs (line 157)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
fn print_sqlite_info(sqlite_header: &SqliteHeader) -> AppResult<()> {
const LABEL_WIDTH: usize = 21;
let mut output = "".to_owned();
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page size:",
value = **sqlite_header.page_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "write format:",
value =
u8::from(sqlite_header.file_format_version_numbers().write_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "read format:",
value =
u8::from(sqlite_header.file_format_version_numbers().read_version())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "reserved bytes:",
value = **sqlite_header.reserved_bytes_per_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "file change counter:",
value = **sqlite_header.file_change_counter()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "database page count:",
value = **sqlite_header.db_filesize_in_pages()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "freelist page count:",
value = **sqlite_header.freelist_pages().total()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema cookie:",
value = **sqlite_header.schema_cookie()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "schema format:",
value = u32::from(sqlite_header.schema_format())
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "default cache size:",
value = **sqlite_header.suggested_cache_size()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "autovacuum top root:",
value = **sqlite_header
.incremental_vacuum_settings()
.largest_root_btree_page()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "incremental vacuum:",
value = u32::from(
sqlite_header
.incremental_vacuum_settings()
.incremental_vacuum_mode()
)
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "text encoding:",
value = sqlite_header.database_text_encoding()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "user version:",
value = **sqlite_header.user_version()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "application id:",
value = **sqlite_header.application_id()
));
output.push_str(&format!(
"{label: <w$}{value}\n",
w = LABEL_WIDTH,
label = "software version:",
value = **sqlite_header.write_library_version()
));
println!("{output}");
Ok(())
}
Trait Implementations§
source§impl Debug for SqliteHeader
impl Debug for SqliteHeader
Auto Trait Implementations§
impl RefUnwindSafe for SqliteHeader
impl Send for SqliteHeader
impl Sync for SqliteHeader
impl Unpin for SqliteHeader
impl UnwindSafe for SqliteHeader
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more