pub struct EseDb { /* private fields */ }Expand description
A loaded instance of an ESE database.
Implementations§
Source§impl EseDb
impl EseDb
Sourcepub fn open<P: AsRef<Path>>(filename: P) -> Result<Self>
pub fn open<P: AsRef<Path>>(filename: P) -> Result<Self>
Opens an existing ESE database file.
use libesedb::EseDb;
use std::io;
fn main() -> io::Result<()> {
let db = EseDb::open("Catalog1.edb")?;
// ...
Ok(())
}Examples found in repository?
examples/fh-catalog-strings.rs (line 7)
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 7)
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 as_mut_ptr(&mut self) -> *mut libesedb_table_t
pub fn as_mut_ptr(&mut self) -> *mut libesedb_table_t
Return underlying pointer for use with libesedb-sys.
Sourcepub fn table(&self, entry: i32) -> Result<Table<'_>>
pub fn table(&self, entry: i32) -> Result<Table<'_>>
Load a specific table by entry number.
Returned Table is bound to the lifetime of the database.
Sourcepub fn table_by_name(&self, name: &str) -> Result<Table<'_>>
pub fn table_by_name(&self, name: &str) -> Result<Table<'_>>
Load a specific table by name.
Returned Table is bound to the lifetime of the database.
Examples found in repository?
examples/fh-catalog-strings.rs (line 9)
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}Sourcepub fn count_tables(&self) -> Result<i32>
pub fn count_tables(&self) -> Result<i32>
Total number of tables in ESE database.
Sourcepub fn iter_tables(&self) -> Result<impl Iterator<Item = Result<Table<'_>>>>
pub fn iter_tables(&self) -> Result<impl Iterator<Item = Result<Table<'_>>>>
Create an iterator over all the tables in the database.
The [IterEntries] iterator and the returned Tables
are bound to the lifetime of the database.
for table in db.iter_tables()? {
let table = table?;
println!("{}", table.name()?);
}Examples found in repository?
examples/overview.rs (line 9)
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 Freeze for EseDb
impl RefUnwindSafe for EseDb
impl !Send for EseDb
impl !Sync for EseDb
impl Unpin for EseDb
impl UnwindSafe for EseDb
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