pub struct ConnectParamsBuilder { /* private fields */ }
Expand description

A builder for ConnectParams.

§Instantiating a ConnectParamsBuilder programmatically

use hdbconnect::ConnectParams;

let connect_params = ConnectParams::builder()
    .hostname("abcd123")
    .port(2222)
    .dbuser("MEIER")
    .password("schlau")
    .build()
    .unwrap();

§Instantiating a ConnectParamsBuilder from a URL

See module url for details about the supported URLs.

use hdbconnect::IntoConnectParamsBuilder;

let conn_params = "hdbsql://abcd123:2222"
    .into_connect_params_builder()
    .unwrap()
    .dbuser("MEIER")
    .password("schlau")
    .build()
    .unwrap();

Implementations§

source§

impl ConnectParamsBuilder

source

pub fn new() -> ConnectParamsBuilder

Creates a new builder.

source

pub fn from(url: &str) -> Result<ConnectParamsBuilder, HdbError>

Creates a new builder based on the given URL.

source

pub fn hostname<H>(&mut self, hostname: H) -> &mut ConnectParamsBuilder
where H: AsRef<str>,

Sets the hostname.

source

pub fn port(&mut self, port: u16) -> &mut ConnectParamsBuilder

Sets the port.

source

pub fn dbuser<D>(&mut self, dbuser: D) -> &mut ConnectParamsBuilder
where D: AsRef<str>,

Sets the database user.

source

pub fn with_dbuser<D>(self, dbuser: D) -> ConnectParamsBuilder
where D: AsRef<str>,

Sets the database user.

source

pub fn password<P>(&mut self, pw: P) -> &mut ConnectParamsBuilder
where P: AsRef<str>,

Sets the password.

source

pub fn with_password<P>(self, pw: P) -> ConnectParamsBuilder
where P: AsRef<str>,

Sets the password.

source

pub fn unset_password(&mut self) -> &mut ConnectParamsBuilder

Unsets the password.

source

pub fn is_tls(&self) -> bool

Whether TLS or a plain TCP connection is to be used.

source

pub fn dbname<D>(&mut self, dbname: D) -> &mut ConnectParamsBuilder
where D: AsRef<str>,

Sets the database name.

This allows specifying host and port of the system DB and getting automatically redirected and connected to the specified tenant database.

source

pub fn network_group<D>( &mut self, network_group: D ) -> &mut ConnectParamsBuilder
where D: AsRef<str>,

Sets the network group.

source

pub fn clientlocale<P>(&mut self, cl: P) -> &mut ConnectParamsBuilder
where P: AsRef<str>,

Sets the client locale.

source

pub fn clientlocale_from_env_lang(&mut self) -> &mut ConnectParamsBuilder

Sets the client locale from the value of the environment variable LANG

source

pub fn always_uncompressed( &mut self, uncompressed: bool ) -> &mut ConnectParamsBuilder

Switch off compression (for debugging purposes?)

By default, compression is supported, like with always_uncompressed(false)

source

pub fn tls_with( &mut self, server_certs: ServerCerts ) -> &mut ConnectParamsBuilder

Makes the driver use TLS for the connection to the database.

Requires that the server’s certificate is provided with one of the enum variants of ServerCerts.

If needed, you can call this function multiple times with different ServerCert variants.

Example:

let mut conn_params = ConnectParams::builder()
   // ...more settings required...
   .tls_with(ServerCerts::Direct(string_with_certificate))
   .build();
source

pub fn tls_without_server_verification(&mut self) -> &mut ConnectParamsBuilder

Makes the driver use TLS for the connection to the database, but hazardously without verifying the server’s certificate. Erases all already configured server certs.

source

pub fn build(&self) -> Result<ConnectParams, HdbError>

Constructs a ConnectParams from the builder.

§Errors

HdbError::Usage if the builder was not yet configured to create a meaningful ConnectParams

source

pub fn to_url(&self) -> Result<String, HdbError>

Returns the url for this connection, without the password.

§Errors

HdbError::Usage if the builder was not yet configured to build a correct url

source

pub fn get_hostname(&self) -> Option<&str>

Returns the configured hostname.

source

pub fn get_dbuser(&self) -> Option<&str>

Returns the configured database user.

source

pub fn get_password(&self) -> Option<&SecUtf8>

Returns the configured password.

source

pub fn get_port(&self) -> Option<u16>

Returns the configured port number.

source

pub fn get_clientlocale(&self) -> Option<&str>

Returns the configured client locale.

source

pub fn get_server_certs(&self) -> Option<&Vec<ServerCerts>>

Returns the configured server certificates.

Trait Implementations§

source§

impl Clone for ConnectParamsBuilder

source§

fn clone(&self) -> ConnectParamsBuilder

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 ConnectParamsBuilder

source§

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

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

impl Default for ConnectParamsBuilder

source§

fn default() -> ConnectParamsBuilder

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

impl<'de> Deserialize<'de> for ConnectParamsBuilder

source§

fn deserialize<D>( deserializer: D ) -> Result<ConnectParamsBuilder, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for ConnectParamsBuilder

source§

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

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

impl IntoConnectParams for &ConnectParamsBuilder

source§

fn into_connect_params(self) -> Result<ConnectParams, HdbError>

Converts the value of self into a ConnectParams. Read more
source§

impl IntoConnectParams for ConnectParamsBuilder

source§

fn into_connect_params(self) -> Result<ConnectParams, HdbError>

Converts the value of self into a ConnectParams. Read more
source§

impl IntoConnectParamsBuilder for ConnectParamsBuilder

source§

fn into_connect_params_builder(self) -> Result<ConnectParamsBuilder, HdbError>

Converts the value of self into a ConnectParamsBuilder. Read more
source§

impl PartialEq for ConnectParamsBuilder

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for ConnectParamsBuilder

source§

fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for ConnectParamsBuilder

source§

impl StructuralPartialEq for ConnectParamsBuilder

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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.
§

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

§

fn vzip(self) -> V

source§

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