Struct hdbconnect::ConnectionConfiguration

source ·
pub struct ConnectionConfiguration { /* private fields */ }
Expand description

A collection of settings that influence the runtime behavior of a connection.

To create a connection with non-default settings, use Connection::with_configuration.

§Example

let config = ConnectionConfiguration::default()
    .with_lob_read_length(1_000_000)
    .with_max_buffer_size(1_000_000);
let connection = Connection::with_configuration(db_url, &config).unwrap();

Implementations§

source§

impl ConnectionConfiguration

source

pub const DEFAULT_FETCH_SIZE: u32 = 10_000u32

Default value for the number of resultset lines that are fetched with a single FETCH roundtrip.

The value can be changed at runtime with Connection::set_fetch_size().

source

pub const DEFAULT_LOB_READ_LENGTH: u32 = 203_776u32

Default value for the number of bytes (for BLOBS and CLOBS) or 1-2-3-byte sequences (for NCLOBS) that are fetched in a single LOB READ roundtrip.

The value can be changed at runtime with Connection::set_lob_read_length().

source

pub const DEFAULT_LOB_WRITE_LENGTH: u32 = 203_776u32

Default value for the number of bytes that are written in a single LOB WRITE roundtrip.

The value can be changed at runtime with Connection::set_lob_write_length().

source

pub const MIN_BUFFER_SIZE: usize = 10_240usize

Minimal buffer size.

Each connection maintains its own re-use buffer into which each outgoing request and each incoming reply is serialized.

The buffer is automatically increased when necessary to cope with large requests or replies. The default minimum buffer size is chosen to be sufficient for many usecases, to avoid buffer increases.

source

pub const DEFAULT_MAX_BUFFER_SIZE: usize = 204_800usize

Default value for the maximum buffer size.

A large request or response will enforce a corresponding enlargement of the connection’s buffer. Oversized buffers are not kept for the whole lifetime of the connection, but shrinked after use to the configured maximum buffer size.

The value can be changed at runtime with Connection::set_max_buffer_size().

source

pub const DEFAULT_MIN_COMPRESSION_SIZE: usize = 5_120usize

Default value for the threshold size above which requests will be compressed.

source

pub const DEFAULT_READ_TIMEOUT: Option<Duration> = None

By default, no read timeout is applied.

A read timeout can be used to ensure that the client does not wait indefinitely on a response from HANA.

Note that if the read timeout kicks in, the physical connection to HANA will be dropped and a new connection will be needed to continue working.

source

pub fn is_auto_commit(&self) -> bool

Returns whether the connection uses auto-commit.

source

pub fn set_auto_commit(&mut self, ac: bool)

Defines whether the connection should use auto-commit.

source

pub fn with_auto_commit(self, ac: bool) -> ConnectionConfiguration

Builder-method for defining whether the connection should use auto-commit.

source

pub fn cursor_holdability(&self) -> CursorHoldability

Returns the configured cursor holdability.

source

pub fn set_cursor_holdability(&mut self, holdability: CursorHoldability)

Sets the cursor holdability.

source

pub fn with_cursor_holdability( self, holdability: CursorHoldability, ) -> ConnectionConfiguration

Builder method for setting the cursor holdability.

source

pub fn fetch_size(&self) -> u32

Returns the connection’s fetch size.

source

pub fn set_fetch_size(&mut self, fetch_size: u32)

Sets the connection’s fetch size.

source

pub fn with_fetch_size(self, fetch_size: u32) -> ConnectionConfiguration

Builder-method for setting the connection’s fetch size.

source

pub fn lob_read_length(&self) -> u32

Returns the connection’s lob read length.

source

pub fn set_lob_read_length(&mut self, lob_read_length: u32)

Sets the connection’s lob read length.

source

pub fn with_lob_read_length( self, lob_read_length: u32, ) -> ConnectionConfiguration

Builder-method for setting the connection’s lob read length.

source

pub fn lob_write_length(&self) -> u32

Returns the connection’s lob write length.

source

pub fn set_lob_write_length(&mut self, lob_write_length: u32)

Sets the connection’s lob write length.

source

pub fn with_lob_write_length( self, lob_write_length: u32, ) -> ConnectionConfiguration

Builder-method for setting the connection’s lob write length.

source

pub fn max_buffer_size(&self) -> usize

Returns the connection’s max buffer size.

See also [ConnectionConfiguration::DEFAULT_MIN_BUFFER_SIZE] and ConnectionConfiguration::DEFAULT_MAX_BUFFER_SIZE.

source

pub fn set_max_buffer_size(&mut self, max_buffer_size: usize)

Sets the connection’s max buffer size.

See also [ConnectionConfiguration::DEFAULT_MIN_BUFFER_SIZE] and ConnectionConfiguration::DEFAULT_MAX_BUFFER_SIZE.

source

pub fn with_max_buffer_size( self, max_buffer_size: usize, ) -> ConnectionConfiguration

Builder-method for setting the connection’s max buffer size.

See also [ConnectionConfiguration::DEFAULT_MIN_BUFFER_SIZE] and ConnectionConfiguration::DEFAULT_MAX_BUFFER_SIZE.

source

pub fn min_compression_size(&self) -> usize

Returns the connection’s min compression size.

See ConnectionConfiguration::DEFAULT_MIN_COMPRESSION_SIZE.

source

pub fn set_min_compression_size(&mut self, min_compression_size: usize)

Sets the connection’s min compression size.

See ConnectionConfiguration::DEFAULT_MIN_COMPRESSION_SIZE.

source

pub fn with_min_compression_size( self, min_compression_size: usize, ) -> ConnectionConfiguration

Builder-method for setting the connection’s min compression size.

See ConnectionConfiguration::DEFAULT_MIN_COMPRESSION_SIZE.

source

pub fn read_timeout(&self) -> Option<Duration>

Returns the connection’s read timeout.

source

pub fn set_read_timeout(&mut self, read_timeout: Option<Duration>)

Sets the connection’s read timeout.

See ConnectionConfiguration::DEFAULT_READ_TIMEOUT.

source

pub fn with_read_timeout( self, read_timeout: Option<Duration>, ) -> ConnectionConfiguration

Builder-method for setting the connection’s read timeout.

Trait Implementations§

source§

impl Clone for ConnectionConfiguration

source§

fn clone(&self) -> ConnectionConfiguration

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for ConnectionConfiguration

source§

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

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

impl Default for ConnectionConfiguration

source§

fn default() -> ConnectionConfiguration

Auto-commit is on, HOLD_CURSORS_OVER_COMMIT is on, HOLD_CURSORS_OVER_ROLLBACK is off, the other config parameters have the default value defined by the respective constant.

source§

impl<'de> Deserialize<'de> for ConnectionConfiguration

source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<ConnectionConfiguration, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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> 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> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T