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
impl ConnectionConfiguration
sourcepub const DEFAULT_FETCH_SIZE: u32 = 10_000u32
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()
.
sourcepub const DEFAULT_LOB_READ_LENGTH: u32 = 203_776u32
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()
.
sourcepub const DEFAULT_LOB_WRITE_LENGTH: u32 = 203_776u32
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()
.
sourcepub const MIN_BUFFER_SIZE: usize = 10_240usize
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.
sourcepub const DEFAULT_MAX_BUFFER_SIZE: usize = 204_800usize
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()
.
sourcepub const DEFAULT_MIN_COMPRESSION_SIZE: usize = 5_120usize
pub const DEFAULT_MIN_COMPRESSION_SIZE: usize = 5_120usize
Default value for the threshold size above which requests will be compressed.
sourcepub const DEFAULT_READ_TIMEOUT: Option<Duration> = None
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.
sourcepub fn is_auto_commit(&self) -> bool
pub fn is_auto_commit(&self) -> bool
Returns whether the connection uses auto-commit.
sourcepub fn set_auto_commit(&mut self, ac: bool)
pub fn set_auto_commit(&mut self, ac: bool)
Defines whether the connection should use auto-commit.
sourcepub fn with_auto_commit(self, ac: bool) -> ConnectionConfiguration
pub fn with_auto_commit(self, ac: bool) -> ConnectionConfiguration
Builder-method for defining whether the connection should use auto-commit.
sourcepub fn cursor_holdability(&self) -> CursorHoldability
pub fn cursor_holdability(&self) -> CursorHoldability
Returns the configured cursor holdability.
sourcepub fn set_cursor_holdability(&mut self, holdability: CursorHoldability)
pub fn set_cursor_holdability(&mut self, holdability: CursorHoldability)
Sets the cursor holdability.
sourcepub fn with_cursor_holdability(
self,
holdability: CursorHoldability,
) -> ConnectionConfiguration
pub fn with_cursor_holdability( self, holdability: CursorHoldability, ) -> ConnectionConfiguration
Builder method for setting the cursor holdability.
sourcepub fn fetch_size(&self) -> u32
pub fn fetch_size(&self) -> u32
Returns the connection’s fetch size.
sourcepub fn set_fetch_size(&mut self, fetch_size: u32)
pub fn set_fetch_size(&mut self, fetch_size: u32)
Sets the connection’s fetch size.
sourcepub fn with_fetch_size(self, fetch_size: u32) -> ConnectionConfiguration
pub fn with_fetch_size(self, fetch_size: u32) -> ConnectionConfiguration
Builder-method for setting the connection’s fetch size.
sourcepub fn lob_read_length(&self) -> u32
pub fn lob_read_length(&self) -> u32
Returns the connection’s lob read length.
sourcepub fn set_lob_read_length(&mut self, lob_read_length: u32)
pub fn set_lob_read_length(&mut self, lob_read_length: u32)
Sets the connection’s lob read length.
sourcepub fn with_lob_read_length(
self,
lob_read_length: u32,
) -> ConnectionConfiguration
pub fn with_lob_read_length( self, lob_read_length: u32, ) -> ConnectionConfiguration
Builder-method for setting the connection’s lob read length.
sourcepub fn lob_write_length(&self) -> u32
pub fn lob_write_length(&self) -> u32
Returns the connection’s lob write length.
sourcepub fn set_lob_write_length(&mut self, lob_write_length: u32)
pub fn set_lob_write_length(&mut self, lob_write_length: u32)
Sets the connection’s lob write length.
sourcepub fn with_lob_write_length(
self,
lob_write_length: u32,
) -> ConnectionConfiguration
pub fn with_lob_write_length( self, lob_write_length: u32, ) -> ConnectionConfiguration
Builder-method for setting the connection’s lob write length.
sourcepub fn max_buffer_size(&self) -> usize
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
.
sourcepub fn set_max_buffer_size(&mut self, max_buffer_size: usize)
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
.
sourcepub fn with_max_buffer_size(
self,
max_buffer_size: usize,
) -> ConnectionConfiguration
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
.
sourcepub fn min_compression_size(&self) -> usize
pub fn min_compression_size(&self) -> usize
Returns the connection’s min compression size.
sourcepub fn set_min_compression_size(&mut self, min_compression_size: usize)
pub fn set_min_compression_size(&mut self, min_compression_size: usize)
Sets the connection’s min compression size.
sourcepub fn with_min_compression_size(
self,
min_compression_size: usize,
) -> ConnectionConfiguration
pub fn with_min_compression_size( self, min_compression_size: usize, ) -> ConnectionConfiguration
Builder-method for setting the connection’s min compression size.
sourcepub fn read_timeout(&self) -> Option<Duration>
pub fn read_timeout(&self) -> Option<Duration>
Returns the connection’s read timeout.
sourcepub fn set_read_timeout(&mut self, read_timeout: Option<Duration>)
pub fn set_read_timeout(&mut self, read_timeout: Option<Duration>)
Sets the connection’s read timeout.
sourcepub fn with_read_timeout(
self,
read_timeout: Option<Duration>,
) -> ConnectionConfiguration
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
impl Clone for ConnectionConfiguration
source§fn clone(&self) -> ConnectionConfiguration
fn clone(&self) -> ConnectionConfiguration
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ConnectionConfiguration
impl Debug for ConnectionConfiguration
source§impl Default for ConnectionConfiguration
impl Default for ConnectionConfiguration
source§fn default() -> ConnectionConfiguration
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.