Skip to main content

ViewEntry

Struct ViewEntry 

Source
pub struct ViewEntry {
    pub name: String,
    pub sql: String,
    pub statement: String,
    pub aliases: Vec<String>,
    pub columns: Vec<Field>,
}
Expand description

One view’s line in the catalog directory.

A view has no pages, so unlike a table it is entirely here and there is no second level under it. What it is made of is text: the body the binder binds again at every reference, and the whole statement written back out, which is what duckdb_views() reports and nothing else reads.

The columns are a cache and they are written down anyway, which is worth saying out loud because a cache in a file looks like a mistake. It is what the pin does. Create a view on a file, open the file again in another process, and duckdb_views() answers column_count and is_bound true without anything having bound the body, so the list survived the write. Not writing it would answer null and false there, and the only way back would be to bind every view at open, which is the thing the cache exists to avoid.

Fields§

§name: String

The view’s own name, without the schema, the way a table entry holds its name.

§sql: String

The query the view stands for, as the text that was written.

§statement: String

The whole CREATE VIEW written back out.

§aliases: Vec<String>

The column names the statement gave, which rename a prefix of what the body produces.

§columns: Vec<Field>

The columns the last bind of the body produced.

Trait Implementations§

Source§

impl Clone for ViewEntry

Source§

fn clone(&self) -> Self

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 ViewEntry

Source§

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

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

impl Eq for ViewEntry

Source§

impl PartialEq for ViewEntry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ViewEntry

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.