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
impl ConnectParamsBuilder
Sourcepub fn from(url: &str) -> HdbResult<Self>
pub fn from(url: &str) -> HdbResult<Self>
Creates a new builder based on the given URL.
§Errors
HdbError::Usage when parsing or evaluating the url failed.
Sourcepub fn with_hostname<H: AsRef<str>>(self, hostname: H) -> Self
pub fn with_hostname<H: AsRef<str>>(self, hostname: H) -> Self
Sets the hostname.
Sourcepub fn with_dbuser<D: AsRef<str>>(self, dbuser: D) -> Self
pub fn with_dbuser<D: AsRef<str>>(self, dbuser: D) -> Self
Sets the database user.
Sourcepub fn with_password<P: AsRef<str>>(self, pw: P) -> Self
pub fn with_password<P: AsRef<str>>(self, pw: P) -> Self
Sets the password.
Sourcepub fn unset_password(&mut self) -> &mut Self
pub fn unset_password(&mut self) -> &mut Self
Unsets the password.
Sourcepub fn dbname<D: AsRef<str>>(&mut self, dbname: D) -> &mut Self
pub fn dbname<D: AsRef<str>>(&mut self, dbname: D) -> &mut Self
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.
Sourcepub fn with_dbname<D: AsRef<str>>(self, dbname: D) -> Self
pub fn with_dbname<D: AsRef<str>>(self, dbname: D) -> Self
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.
Sourcepub fn network_group<D: AsRef<str>>(&mut self, network_group: D) -> &mut Self
pub fn network_group<D: AsRef<str>>(&mut self, network_group: D) -> &mut Self
Sets the network group.
Sourcepub fn clientlocale<P: AsRef<str>>(&mut self, cl: P) -> &mut Self
pub fn clientlocale<P: AsRef<str>>(&mut self, cl: P) -> &mut Self
Sets the client locale.
Sourcepub fn clientlocale_from_env_lang(&mut self) -> &mut Self
pub fn clientlocale_from_env_lang(&mut self) -> &mut Self
Sets the client locale from the value of the environment variable LANG
Sourcepub fn always_uncompressed(&mut self, uncompressed: bool) -> &mut Self
pub fn always_uncompressed(&mut self, uncompressed: bool) -> &mut Self
Switch off compression (for debugging purposes?)
By default, compression is supported, like with always_uncompressed(false)
Sourcepub fn tls_with(&mut self, server_certs: ServerCerts) -> &mut Self
pub fn tls_with(&mut self, server_certs: ServerCerts) -> &mut Self
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.
Sourcepub fn with_tls_with(self, server_certs: ServerCerts) -> Self
pub fn with_tls_with(self, server_certs: ServerCerts) -> Self
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...
.with_tls_with(ServerCerts::Direct(string_with_certificate))
.build();Sourcepub fn tls_without_server_verification(&mut self) -> &mut Self
pub fn tls_without_server_verification(&mut self) -> &mut Self
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.
Sourcepub fn with_tls_without_server_verification(self, with_tls: bool) -> Self
pub fn with_tls_without_server_verification(self, with_tls: bool) -> Self
Decides whether the driver use TLS for the connection to the database, or not. If yes, it chooses the hazardous option without verifying the server’s certificate. Erases all already configured server certs.
Sourcepub fn build(&self) -> HdbResult<ConnectParams>
pub fn build(&self) -> HdbResult<ConnectParams>
Constructs a ConnectParams from the builder.
§Errors
HdbError::Usage if the builder was not yet configured to
create a meaningful ConnectParams
Sourcepub fn to_url_without_password(&self) -> String
pub fn to_url_without_password(&self) -> String
Returns the url for this connection, without the password.
Sourcepub fn to_url_with_password(&self) -> String
pub fn to_url_with_password(&self) -> String
Returns the url for this connection with the password.
Sourcepub fn get_hostname(&self) -> Option<&str>
pub fn get_hostname(&self) -> Option<&str>
Returns the configured hostname.
Sourcepub fn get_dbuser(&self) -> Option<&str>
pub fn get_dbuser(&self) -> Option<&str>
Returns the configured database user.
Sourcepub fn get_password(&self) -> Option<&SecUtf8>
pub fn get_password(&self) -> Option<&SecUtf8>
Returns the configured password.
Sourcepub fn get_clientlocale(&self) -> Option<&str>
pub fn get_clientlocale(&self) -> Option<&str>
Returns the configured client locale.
Sourcepub fn get_dbname(&self) -> Option<&str>
pub fn get_dbname(&self) -> Option<&str>
Returns the configured database name.
Sourcepub fn get_networkgroup(&self) -> Option<&str>
pub fn get_networkgroup(&self) -> Option<&str>
Returns the configured network group.
Sourcepub fn get_server_certs(&self) -> Option<&Vec<ServerCerts>>
pub fn get_server_certs(&self) -> Option<&Vec<ServerCerts>>
Returns the configured variants for validating the server certificate.
Trait Implementations§
Source§impl Clone for ConnectParamsBuilder
impl Clone for ConnectParamsBuilder
Source§fn clone(&self) -> ConnectParamsBuilder
fn clone(&self) -> ConnectParamsBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more