Skip to main content

Session

Struct Session 

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

The settings a session has, by name.

Every setting the engine has, not only the ones somebody changed. A reader of this is answering “what is it now”, so a name that is missing means the engine does not have that setting rather than that it is at its default.

Implementations§

Source§

impl Session

Source

pub fn new() -> Self

A session that knows nothing, which is what a caller with no database behind it has.

Source

pub fn set(&mut self, name: &str, value: impl Into<String>)

Records what one setting is now.

Source

pub fn set_time_zone(&mut self, name: &str)

Sets the time zone after it has been validated by the setting layer.

Source

pub fn time_zone(&self) -> &str

The canonical IANA name of the session time zone.

Source

pub fn session_time_zone(&self) -> SessionTimeZone

The parsed zone used by prepared expressions.

Source

pub fn set_default_descending(&mut self, descending: bool)

Sets the direction used by an order item that names none.

Source

pub fn set_default_null_order(&mut self, order: DefaultNullOrder)

Sets how an order item with no null placement is resolved.

Source

pub fn set_integer_division(&mut self, enabled: bool)

Sets whether / is bound as the integer division operator.

Source

pub fn set_ieee_floating_point_ops(&mut self, enabled: bool)

Sets whether floating division and remainder use IEEE answers for zero divisors.

Source

pub fn set_identifier_case(&mut self, case: IdentifierCase)

Sets how unquoted identifiers are folded while a statement is parsed.

Source

pub fn set_null_on_division_by_zero(&mut self, enabled: bool)

Sets whether division errors caused by a zero divisor become nulls.

Source

pub fn set_order_by_non_integer_literal(&mut self, enabled: bool)

Sets whether a constant non-integer expression is accepted as a sort key.

Source

pub fn set_disable_timestamptz_casts(&mut self, enabled: bool)

Sets whether casts from local timestamps to zoned timestamps are refused.

Source

pub fn set_errors_as_json(&mut self, enabled: bool)

Sets whether errors are returned as structured JSON.

Source

pub fn set_regex_match_full(&mut self, enabled: bool)

Sets whether regex match operators require the entire string to match.

Source

pub fn set_scalar_subquery_error_on_multiple_rows(&mut self, enabled: bool)

Sets whether scalar queries may choose one row from several.

Source

pub fn set_show_behavior(&mut self, behavior: ShowBehavior)

Sets how SHOW name resolves its name.

Source

pub fn set_warnings_as_errors(&mut self, enabled: bool)

Sets whether warnings are promoted to errors.

Source

pub fn semantics(&self) -> Semantics

The meaning-changing choices the binder resolves into the plan.

Source

pub fn set_rules(&mut self, rules: Rules)

Records which optimization rules the session has turned off.

Source

pub fn rules(&self) -> Rules

Which optimization rules may fire for this statement.

Read by whatever is about to apply one, which is why it rides on the session rather than being reached for through the database: the rank that sets it and the ranks that obey it cannot see each other.

Source

pub fn knows_time_zone(name: &str) -> bool

Whether the bundled time-zone database knows this name.

Source

pub fn offset_seconds_at(&self, micros: i64) -> i32

The UTC offset in seconds at an instant expressed as Unix microseconds.

Source

pub fn local_micros(&self, micros: i64) -> i64

A UTC instant shifted to the wall clock of this session.

Source

pub fn get(&self, name: &str) -> Option<&str>

What that setting is now, and None for a name this session has no answer for.

Source

pub fn iter(&self) -> impl Iterator<Item = (&str, &str)>

Every setting and its value, in name order.

Source

pub fn is_empty(&self) -> bool

Whether nothing has been recorded.

Trait Implementations§

Source§

impl Clone for Session

Source§

fn clone(&self) -> Session

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 Session

Source§

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

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

impl Default for Session

Source§

fn default() -> Self

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

impl Eq for Session

Source§

impl PartialEq for Session

Source§

fn eq(&self, other: &Session) -> 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 Session

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.