pub struct Table<'a> { /* private fields */ }Expand description
Instance of a ESE database table in a currently open crate::EseDb.
Implementations§
Source§impl Table<'_>
impl Table<'_>
Sourcepub fn name(&self) -> Result<String>
pub fn name(&self) -> Result<String>
Gets the name of the table.
Examples found in repository?
examples/overview.rs (line 13)
3fn main() {
4 let filename = std::env::args()
5 .nth(1)
6 .expect("specify path to .esedb file");
7 let db = EseDb::open(&filename).unwrap();
8 println!("Database Overview ({}):", filename);
9 for table in db.iter_tables().unwrap() {
10 let table = table.unwrap();
11 println!(
12 " {} [{:?}]",
13 table.name().unwrap(),
14 table
15 .iter_columns()
16 .unwrap()
17 .map(|c| c.unwrap().name().unwrap())
18 .collect::<Vec<String>>()
19 .join(", "),
20 );
21 for record in table.iter_records().unwrap() {
22 let record = record.unwrap();
23 for i in 0..record.count_values().unwrap() {
24 println!(
25 " ├ T={:?} L={}, M={} V={:?}",
26 table.column(i).unwrap().variant().unwrap(),
27 record.is_long(i).unwrap(),
28 record.is_multi(i).unwrap(),
29 record.value(i).unwrap(),
30 );
31 }
32 }
33 }
34}Sourcepub fn count_columns(&self) -> Result<i32>
pub fn count_columns(&self) -> Result<i32>
Total number of columns in table.
Sourcepub fn count_records(&self) -> Result<i32>
pub fn count_records(&self) -> Result<i32>
Total number of records (rows) in table.
Sourcepub fn column(&self, entry: i32) -> Result<Column<'_>>
pub fn column(&self, entry: i32) -> Result<Column<'_>>
Load a specific column by entry number.
Returned Column is bound to the lifetime of the database table.
Examples found in repository?
examples/overview.rs (line 26)
3fn main() {
4 let filename = std::env::args()
5 .nth(1)
6 .expect("specify path to .esedb file");
7 let db = EseDb::open(&filename).unwrap();
8 println!("Database Overview ({}):", filename);
9 for table in db.iter_tables().unwrap() {
10 let table = table.unwrap();
11 println!(
12 " {} [{:?}]",
13 table.name().unwrap(),
14 table
15 .iter_columns()
16 .unwrap()
17 .map(|c| c.unwrap().name().unwrap())
18 .collect::<Vec<String>>()
19 .join(", "),
20 );
21 for record in table.iter_records().unwrap() {
22 let record = record.unwrap();
23 for i in 0..record.count_values().unwrap() {
24 println!(
25 " ├ T={:?} L={}, M={} V={:?}",
26 table.column(i).unwrap().variant().unwrap(),
27 record.is_long(i).unwrap(),
28 record.is_multi(i).unwrap(),
29 record.value(i).unwrap(),
30 );
31 }
32 }
33 }
34}Sourcepub fn record(&self, entry: i32) -> Result<Record<'_>>
pub fn record(&self, entry: i32) -> Result<Record<'_>>
Load a specific record (row) by entry number.
Returned Record is bound to the lifetime of the database table.
Sourcepub fn iter_columns(&self) -> Result<impl Iterator<Item = Result<Column<'_>>>>
pub fn iter_columns(&self) -> Result<impl Iterator<Item = Result<Column<'_>>>>
Create an iterator over all the columns in the table.
The [IterEntries] iterator and the returned Columns
are bound to the lifetime of the database table.
for column in table.iter_columns()? {
println!("{}", column?.name()?);
}Examples found in repository?
examples/overview.rs (line 15)
3fn main() {
4 let filename = std::env::args()
5 .nth(1)
6 .expect("specify path to .esedb file");
7 let db = EseDb::open(&filename).unwrap();
8 println!("Database Overview ({}):", filename);
9 for table in db.iter_tables().unwrap() {
10 let table = table.unwrap();
11 println!(
12 " {} [{:?}]",
13 table.name().unwrap(),
14 table
15 .iter_columns()
16 .unwrap()
17 .map(|c| c.unwrap().name().unwrap())
18 .collect::<Vec<String>>()
19 .join(", "),
20 );
21 for record in table.iter_records().unwrap() {
22 let record = record.unwrap();
23 for i in 0..record.count_values().unwrap() {
24 println!(
25 " ├ T={:?} L={}, M={} V={:?}",
26 table.column(i).unwrap().variant().unwrap(),
27 record.is_long(i).unwrap(),
28 record.is_multi(i).unwrap(),
29 record.value(i).unwrap(),
30 );
31 }
32 }
33 }
34}Sourcepub fn iter_records(&self) -> Result<impl Iterator<Item = Result<Record<'_>>>>
pub fn iter_records(&self) -> Result<impl Iterator<Item = Result<Record<'_>>>>
Create an iterator over all the records (rows) in the table.
The [IterEntries] iterator and the returned Records
are bound to the lifetime of the database table.
for record in table.iter_records()? {
let record = record?;
for value in record.iter_values()? {
println!("{:?}", value?);
}
}Examples found in repository?
examples/fh-catalog-strings.rs (line 10)
3fn main() {
4 let filename = std::env::args()
5 .nth(1)
6 .unwrap_or("Catalog1.edb".to_string());
7 let db = EseDb::open(filename).unwrap();
8 println!("Db load finished!");
9 let string = db.table_by_name("string").unwrap();
10 for rec in string.iter_records().unwrap() {
11 let rec = rec.unwrap();
12 let vals = rec
13 .iter_values()
14 .unwrap()
15 .map(|v| v.unwrap_or_default().to_string())
16 .collect::<Vec<_>>();
17 println!("{}", vals.join("\t"));
18 }
19}More examples
examples/overview.rs (line 21)
3fn main() {
4 let filename = std::env::args()
5 .nth(1)
6 .expect("specify path to .esedb file");
7 let db = EseDb::open(&filename).unwrap();
8 println!("Database Overview ({}):", filename);
9 for table in db.iter_tables().unwrap() {
10 let table = table.unwrap();
11 println!(
12 " {} [{:?}]",
13 table.name().unwrap(),
14 table
15 .iter_columns()
16 .unwrap()
17 .map(|c| c.unwrap().name().unwrap())
18 .collect::<Vec<String>>()
19 .join(", "),
20 );
21 for record in table.iter_records().unwrap() {
22 let record = record.unwrap();
23 for i in 0..record.count_values().unwrap() {
24 println!(
25 " ├ T={:?} L={}, M={} V={:?}",
26 table.column(i).unwrap().variant().unwrap(),
27 record.is_long(i).unwrap(),
28 record.is_multi(i).unwrap(),
29 record.value(i).unwrap(),
30 );
31 }
32 }
33 }
34}Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Table<'a>
impl<'a> RefUnwindSafe for Table<'a>
impl<'a> !Send for Table<'a>
impl<'a> !Sync for Table<'a>
impl<'a> Unpin for Table<'a>
impl<'a> UnwindSafe for Table<'a>
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