Struct SqliteHeader

Source
pub struct SqliteHeader { /* private fields */ }
Expand description

§Database File Format

OffsetSizeDescription
016The header string: “Sqlite format 3\000”
162The 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.
181File format write version. 1 for legacy; 2 for WAL.
191File format read version. 1 for legacy; 2 for WAL.
201Bytes of unused “reserved” space at the end of each page. Usually 0.
211Maximum embedded payload fraction. Must be 64.
221Minimum embedded payload fraction. Must be 32.
231Leaf payload fraction. Must be 32.
244File change counter.
284Size of the database file in pages. The “in-header database size”.
324Page number of the first freelist trunk page.
364Total number of freelist pages.
404The schema cookie.
444The schema format number. Supported schema formats are 1, 2, 3, and 4.
484Default page cache size.
524The page number of the largest root b-tree page when in auto-vacuum or incremental-vacuum modes, or zero otherwise.
564The database text encoding. A bytes of 1 means UTF-8. A bytes of 2 means UTF-16le. A bytes of 3 means UTF-16be.
604The “user version” as read and set by the user_version pragma.
644True (non-zero) for incremental-vacuum mode. False (zero) otherwise.
684The “Application ID” set by PRAGMA application_id.
7220Reserved for expansion. Must be zero.
924The version-valid-for number.
964SQLITE_VERSION_NUMBER

Implementations§

Source§

impl SqliteHeader

Source

pub const LENGTH_BYTES: usize = 100usize

Source

pub fn magic_header_string(&self) -> &MagicHeaderString

Source

pub fn page_size(&self) -> &PageSize

Examples found in repository?
examples/sqlite_info.rs (line 48)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn file_format_version_numbers(&self) -> &FileFormatVersionNumbers

Examples found in repository?
examples/sqlite_info.rs (line 55)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn reserved_bytes_per_page(&self) -> &ReservedBytesPerPage

Examples found in repository?
examples/sqlite_info.rs (line 68)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn payload_fractions(&self) -> &PayloadFractions

Source

pub fn file_change_counter(&self) -> &FileChangeCounter

Examples found in repository?
examples/sqlite_info.rs (line 74)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn db_filesize_in_pages(&self) -> &DatabaseFileSizeInPages

Examples found in repository?
examples/sqlite_info.rs (line 81)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn freelist_pages(&self) -> &FreeListPages

Examples found in repository?
examples/sqlite_info.rs (line 88)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Examples found in repository?
examples/sqlite_info.rs (line 95)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn schema_format(&self) -> &SchemaFormat

Examples found in repository?
examples/sqlite_info.rs (line 102)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn suggested_cache_size(&self) -> &SuggestedCacheSize

Examples found in repository?
examples/sqlite_info.rs (line 109)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn incremental_vacuum_settings(&self) -> &IncrementalVacuumSettings

Examples found in repository?
examples/sqlite_info.rs (line 117)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn database_text_encoding(&self) -> &DatabaseTextEncoding

Examples found in repository?
examples/sqlite_info.rs (line 136)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn user_version(&self) -> &UserVersion

Examples found in repository?
examples/sqlite_info.rs (line 143)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn application_id(&self) -> &ApplicationId

Examples found in repository?
examples/sqlite_info.rs (line 150)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }
Source

pub fn reserved_for_expansion(&self) -> &ReservedForExpansion

Source

pub fn version_valid_for(&self) -> &VersionValidFor

Source

pub fn write_library_version(&self) -> &WriteLibraryVersion

Examples found in repository?
examples/sqlite_info.rs (line 157)
36  fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37    const LABEL_WIDTH: usize = 21;
38
39    // TODO:
40    let sqlite_header = conn.runtime().header();
41
42    let mut output = "".to_owned();
43
44    output.push_str(&format!(
45      "{label: <w$}{value}\n",
46      w = LABEL_WIDTH,
47      label = "database page size:",
48      value = u32::from(sqlite_header.page_size())
49    ));
50    output.push_str(&format!(
51      "{label: <w$}{value}\n",
52      w = LABEL_WIDTH,
53      label = "write format:",
54      value =
55        u8::from(sqlite_header.file_format_version_numbers().write_version())
56    ));
57    output.push_str(&format!(
58      "{label: <w$}{value}\n",
59      w = LABEL_WIDTH,
60      label = "read format:",
61      value =
62        u8::from(sqlite_header.file_format_version_numbers().read_version())
63    ));
64    output.push_str(&format!(
65      "{label: <w$}{value}\n",
66      w = LABEL_WIDTH,
67      label = "reserved bytes:",
68      value = **sqlite_header.reserved_bytes_per_page()
69    ));
70    output.push_str(&format!(
71      "{label: <w$}{value}\n",
72      w = LABEL_WIDTH,
73      label = "file change counter:",
74      value = **sqlite_header.file_change_counter()
75    ));
76
77    output.push_str(&format!(
78      "{label: <w$}{value}\n",
79      w = LABEL_WIDTH,
80      label = "database page count:",
81      value = **sqlite_header.db_filesize_in_pages()
82    ));
83
84    output.push_str(&format!(
85      "{label: <w$}{value}\n",
86      w = LABEL_WIDTH,
87      label = "freelist page count:",
88      value = **sqlite_header.freelist_pages().total()
89    ));
90
91    output.push_str(&format!(
92      "{label: <w$}{value}\n",
93      w = LABEL_WIDTH,
94      label = "schema cookie:",
95      value = **sqlite_header.schema_cookie()
96    ));
97
98    output.push_str(&format!(
99      "{label: <w$}{value}\n",
100      w = LABEL_WIDTH,
101      label = "schema format:",
102      value = u32::from(sqlite_header.schema_format())
103    ));
104
105    output.push_str(&format!(
106      "{label: <w$}{value}\n",
107      w = LABEL_WIDTH,
108      label = "default cache size:",
109      value = **sqlite_header.suggested_cache_size()
110    ));
111
112    output.push_str(&format!(
113      "{label: <w$}{value}\n",
114      w = LABEL_WIDTH,
115      label = "autovacuum top root:",
116      value = **sqlite_header
117        .incremental_vacuum_settings()
118        .largest_root_btree_page()
119    ));
120
121    output.push_str(&format!(
122      "{label: <w$}{value}\n",
123      w = LABEL_WIDTH,
124      label = "incremental vacuum:",
125      value = u32::from(
126        sqlite_header
127          .incremental_vacuum_settings()
128          .incremental_vacuum_mode()
129      )
130    ));
131
132    output.push_str(&format!(
133      "{label: <w$}{value}\n",
134      w = LABEL_WIDTH,
135      label = "text encoding:",
136      value = sqlite_header.database_text_encoding()
137    ));
138
139    output.push_str(&format!(
140      "{label: <w$}{value}\n",
141      w = LABEL_WIDTH,
142      label = "user version:",
143      value = **sqlite_header.user_version()
144    ));
145
146    output.push_str(&format!(
147      "{label: <w$}{value}\n",
148      w = LABEL_WIDTH,
149      label = "application id:",
150      value = **sqlite_header.application_id()
151    ));
152
153    output.push_str(&format!(
154      "{label: <w$}{value}\n",
155      w = LABEL_WIDTH,
156      label = "software version:",
157      value = **sqlite_header.write_library_version()
158    ));
159
160    println!("{output}");
161    Ok(())
162  }

Trait Implementations§

Source§

impl Debug for SqliteHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SqliteHeader

Source§

fn default() -> SqliteHeader

Returns the “default value” for a type. Read more
Source§

impl Name for SqliteHeader

Source§

const NAME: &'static str = "SqliteHeader"

Source§

impl TryFrom<&[u8]> for SqliteHeader

Source§

type Error = SqliteError

The type returned in the event of a conversion error.
Source§

fn try_from(bytes: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.