Skip to main content

CatalogEntry

Struct CatalogEntry 

Source
pub struct CatalogEntry {
    pub object_type: u16,
    pub object_id: u32,
    pub parent_object_id: u32,
    pub table_page: u32,
    pub object_name: String,
}
Expand description

One entry from the ESE catalog.

Fields§

§object_type: u16

Object type: 1 = table, 2 = column, etc.

§object_id: u32

Object ID.

§parent_object_id: u32

Parent object ID.

§table_page: u32

Root page number for this table’s B-tree.

§object_name: String

Object name (table name, column name, etc.).

Implementations§

Source§

impl CatalogEntry

Source

pub const MIN_SIZE: usize = 16

Minimum record size.

Source

pub fn from_bytes(data: &[u8]) -> Result<Self, EseError>

Parse one catalog record from a byte slice.

§Errors

Returns EseError::Corrupt if the slice is too short or the name bytes are not valid UTF-8.

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize this entry to bytes (for building test fixtures).

Source

pub fn scan_catalog_page_data(data_area: &[u8]) -> Vec<Self>

Scan the raw data area of an ESE catalog leaf page for all TABLE entries.

Unlike [parse_real_catalog_record], which scans a single tag’s bytes and returns the first match, this function scans the entire page data area (from the end of the 40-byte header to the start of the tag array) and returns every distinct entry found.

Real ESE catalog leaf pages use a cumulative key-prefix-compression format where the first logical records can reside in the page data area before the offset of the first tag. Scanning individual tags therefore misses those early records. This function avoids that problem by scanning the full data span directly.

Entries are deduplicated by object_name — if the same name appears more than once (because the cumulative format causes successive tags to re-include earlier data), only the first occurrence is kept.

Source

pub fn parse_real_catalog_record(data: &[u8]) -> Option<Self>

Try to parse a real ESE catalog TABLE entry from a leaf-page tag byte slice.

Real ESE MSysObjects records use a tagged-column encoding where the Name column (column 128) is preceded by a two-byte marker [0xFF, 0x00] followed by a two-byte LE length and the ASCII name bytes. The pgnoFDP (root B-tree page of the table) lives 16 bytes before the 0xFF marker, and the object ID lives 20 bytes before it — both as u32 LE.

pgnoFDP is stored as an ESE 0-based data-page number; this function adds 1 to convert it to the physical page number expected by [EseDatabase::read_page].

Returns None if the slice contains no recognisable TABLE entry.

Trait Implementations§

Source§

impl Clone for CatalogEntry

Source§

fn clone(&self) -> CatalogEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CatalogEntry

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.