pub struct Opts { /* private fields */ }Expand description
Mysql connection options.
Build one with OptsBuilder.
Implementations§
source§impl Opts
impl Opts
pub fn from_url(url: &str) -> Result<Opts, UrlError>
sourcepub fn get_ip_or_hostname(&self) -> Option<&str>
pub fn get_ip_or_hostname(&self) -> Option<&str>
Address of mysql server (defaults to 127.0.0.1). Hostnames should also work.
sourcepub fn get_tcp_port(&self) -> u16
pub fn get_tcp_port(&self) -> u16
TCP port of mysql server (defaults to 3306).
sourcepub fn get_socket(&self) -> Option<&str>
pub fn get_socket(&self) -> Option<&str>
Socket path on unix or pipe name on windows (defaults to None).
sourcepub fn get_db_name(&self) -> Option<&str>
pub fn get_db_name(&self) -> Option<&str>
Database name (defaults to None).
sourcepub fn get_read_timeout(&self) -> Option<&Duration>
pub fn get_read_timeout(&self) -> Option<&Duration>
The timeout for each attempt to write to the server.
sourcepub fn get_write_timeout(&self) -> Option<&Duration>
pub fn get_write_timeout(&self) -> Option<&Duration>
The timeout for each attempt to write to the server.
sourcepub fn get_prefer_socket(&self) -> bool
pub fn get_prefer_socket(&self) -> bool
Prefer socket connection (defaults to true).
Will reconnect via socket (or named pipe on windows) after TCP connection
to 127.0.0.1 if true.
Will fall back to TCP on error. Use socket option to enforce socket connection.
sourcepub fn get_verify_peer(&self) -> bool
pub fn get_verify_peer(&self) -> bool
Only available if ssl feature enabled.
Perform or not ssl peer verification (defaults to false).
Only make sense if ssl_opts is not None.
sourcepub fn get_ssl_opts(&self) -> &Option<()>
pub fn get_ssl_opts(&self) -> &Option<()>
sourcepub fn get_tcp_nodelay(&self) -> bool
pub fn get_tcp_nodelay(&self) -> bool
Whether TCP_NODELAY will be set for mysql connection.
sourcepub fn get_tcp_keepalive_time_ms(&self) -> Option<u32>
pub fn get_tcp_keepalive_time_ms(&self) -> Option<u32>
TCP keep alive time for mysql connection.
sourcepub fn get_local_infile_handler(&self) -> Option<&LocalInfileHandler>
pub fn get_local_infile_handler(&self) -> Option<&LocalInfileHandler>
Callback to handle requests for local files.
sourcepub fn get_tcp_connect_timeout(&self) -> Option<Duration>
pub fn get_tcp_connect_timeout(&self) -> Option<Duration>
Tcp connect timeout (defaults to None).
sourcepub fn bind_address(&self) -> Option<&SocketAddr>
pub fn bind_address(&self) -> Option<&SocketAddr>
Bind address for a client (defaults to None).
Use carefully. Will probably make pool unusable because of address already in use errors.
sourcepub fn get_stmt_cache_size(&self) -> usize
pub fn get_stmt_cache_size(&self) -> usize
Number of prepared statements cached on the client side (per connection). Defaults to 10.
sourcepub fn get_compress(&self) -> bool
pub fn get_compress(&self) -> bool
If true, then client will ask for compression if server supports it (defaults to false).
sourcepub fn get_additional_capabilities(&self) -> CapabilityFlags
pub fn get_additional_capabilities(&self) -> CapabilityFlags
Additional client capabilities to set (defaults to empty).
This value will be OR’ed with other client capabilities during connection initialisation.
Note
It is a good way to set something like CLIENT_FOUND_ROWS but you should note that it
won’t let you to interfere with capabilities managed by other options (like
CLIENT_SSL or CLIENT_COMPRESS). Also note that some capabilities are reserved,
pointless or may broke the connection, so this option should be used with caution.