Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mysql client library implemented in rust.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

blackbeam/rust-mysql-simple

Repository files navigation

Gitter

Crates.ioBuild Status

mysql

This crate offers:

  • MySql database driver in pure rust;
  • connection pool.

Features:

  • macOS, Windows and Linux support;
  • TLS support vianative-tls orrustls (see theSSL Support section);
  • MySql text protocol support, i.e. support of simple text queries and text result sets;
  • MySql binary protocol support, i.e. support of prepared statements and binary result sets;
  • support of multi-result sets;
  • support of named parameters for prepared statements (see theNamed Parameters section);
  • per-connection cache of prepared statements (see theStatement Cache section);
  • buffer pool (see theBuffer Pool section);
  • support of MySql packets larger than 2^24;
  • support of Unix sockets and Windows named pipes;
  • support of custom LOCAL INFILE handlers;
  • support of MySql protocol compression;
  • support of auth plugins:
    • mysql_native_password - for MySql prior to v8;
    • caching_sha2_password - for MySql v8 and higher;
    • mysql_clear_password - opt-in (see [Opts::get_enable_cleartext_plugin].

Installation

Put the desired version of the crate into thedependencies section of yourCargo.toml:

[dependencies]mysql ="*"

Example

use mysql::*;use mysql::prelude::*;#[derive(Debug,PartialEq,Eq)]structPayment{customer_id:i32,amount:i32,account_name:Option<String>,}fnmain() -> std::result::Result<(),Box<dyn std::error::Error>>{let url ="mysql://root:password@localhost:3307/db_name";    #Opts::try_from(url)?;    #let url =get_opts();let pool =Pool::new(url)?;letmut conn = pool.get_conn()?;// Let's create a table for payments.    conn.query_drop(r"CREATE TEMPORARY TABLE payment (            customer_id int not null,            amount int not null,            account_name text        )")?;let payments =vec![Payment{ customer_id:1, amount:2, account_name:None},Payment{ customer_id:3, amount:4, account_name:Some("foo".into())},Payment{ customer_id:5, amount:6, account_name:None},Payment{ customer_id:7, amount:8, account_name:None},Payment{ customer_id:9, amount:10, account_name:Some("bar".into())},];// Now let's insert payments to the database    conn.exec_batch(r"INSERT INTO payment (customer_id, amount, account_name)          VALUES (:customer_id, :amount, :account_name)",        payments.iter().map(|p|params!{"customer_id" => p.customer_id,"amount" => p.amount,"account_name" =>&p.account_name,}))?;// Let's select payments from database. Type inference should do the trick here.let selected_payments = conn.query_map("SELECT customer_id, amount, account_name from payment",            |(customer_id, amount, account_name)|{Payment{ customer_id, amount, account_name}},)?;// Let's make sure, that `payments` equals to `selected_payments`.// Mysql gives no guaranties on order of returned rows// without `ORDER BY`, so assume we are lucky.assert_eq!(payments, selected_payments);println!("Yay!");Ok(())}

Crate Features

  • feature sets:

    • default – includesbuffer-poolflate2/zlib andderive
    • default-rust - same asdefault but withflate2/rust_backend instead offlate2/zlib
    • minimal - includesflate2/zlib only
    • minimal-rust - includesflate2/rust_backend only
  • features:

    • buffer-pool – enables buffer pooling(see theBuffer Pool section)
    • derive – reexports derive macros underprelude(seecorresponding section in themysql_common documentation)
  • TLS/SSL related features:

    • native-tls – specifiesnative-tls as the TLS backend(see theSSL Support section)
    • rustls-tls – specifiesrustls as the TLS backend usingaws-lc-rs crypto provider(see theSSL Support section)
    • rustls-tls-ring – specifiesrustls as the TLS backend usingring crypto provider(see theSSL Support section)
    • rustls - specifiesrustls as the TLS backend without crypto provider(see theSSL Support section)
  • features proxied frommysql_common:

Please note, that you'll need to reenable required features if you are usingdefault-features = false:

[dependencies]# Lets say that we want to use only the `rustls-tls` feature:mysql = {version ="*",default-features =false,features = ["minimal-rust","rustls-tls"] }

API Documentation

Please refer to thecrate docs.

Basic structures

Opts

This structure holds server host name, client username/password and other settings,that controls client behavior.

URL-based connection string

Note, that you can use URL-based connection string as a source of anOpts instance.URL schema must bemysql. Host, port and credentials, as well as query parameters,should be given in accordance with the RFC 3986.

Examples:

let _ =Opts::from_url("mysql://localhost/some_db")?;let _ =Opts::from_url("mysql://[::1]/some_db")?;let _ =Opts::from_url("mysql://user:pass%20word@127.0.0.1:3307/some_db?")?;

Supported URL parameters (for the meaning of each field please refer to the docs onOptsstructure in the create API docs):

  • user: string – MySql client user name
  • password: string – MySql client password;
  • db_name: string – MySql database name;
  • host: Host – MySql server hostname/ip;
  • port: u16 – MySql server port;
  • pool_min: usize – see [PoolConstraints::min];
  • pool_max: usize – see [PoolConstraints::max];
  • prefer_socket: true | false - see [Opts::get_prefer_socket];
  • tcp_keepalive_time_ms: u32 - defines the value (in milliseconds)of thetcp_keepalive_time field in theOpts structure;
  • tcp_keepalive_probe_interval_secs: u32 - defines the valueof thetcp_keepalive_probe_interval_secs field in theOpts structure;
  • tcp_keepalive_probe_count: u32 - defines the valueof thetcp_keepalive_probe_count field in theOpts structure;
  • tcp_connect_timeout_ms: u64 - defines the value (in milliseconds)of thetcp_connect_timeout field in theOpts structure;
  • tcp_user_timeout_ms - defines the value (in milliseconds)of thetcp_user_timeout field in theOpts structure;
  • stmt_cache_size: u32 - defines the value of the same field in theOpts structure;
  • enable_cleartext_plugin – see [Opts::get_enable_cleartext_plugin];
  • secure_auth – see [Opts::get_secure_auth];
  • reset_connection – see [PoolOpts::reset_connection];
  • check_health – see [PoolOpts::check_health];
  • compress - defines the value of the same field in theOpts structure.Supported value are:
    • true - enables compression with the default compression level;
    • fast - enables compression with "fast" compression level;
    • best - enables compression with "best" compression level;
    • 1..9 - enables compression with the given compression level.
  • socket - socket path on UNIX, or pipe name on Windows.

OptsBuilder

It's a convenient builder for theOpts structure. It defines setters for fieldsof theOpts structure.

let opts =OptsBuilder::new().user(Some("foo")).db_name(Some("bar"));let _ =Conn::new(opts)?;

Conn

This structure represents an active MySql connection. It also holds statement cacheand metadata for the last result set.

Conn's destructor will gracefully disconnect it from the server.

Transaction

It's a simple wrapper on top of a routine, that starts withSTART TRANSACTIONand ends withCOMMIT orROLLBACK.

use mysql::*;use mysql::prelude::*;let pool =Pool::new(get_opts())?;letmut conn = pool.get_conn()?;letmut tx = conn.start_transaction(TxOpts::default())?;tx.query_drop("CREATE TEMPORARY TABLE tmp (TEXT a)")?;tx.exec_drop("INSERT INTO tmp (a) VALUES (?)",("foo",))?;let val:Option<String> = tx.query_first("SELECT a from tmp")?;assert_eq!(val.unwrap(),"foo");// Note, that transaction will be rolled back implicitly on Drop, if not committed.tx.rollback();let val:Option<String> = conn.query_first("SELECT a from tmp")?;assert_eq!(val,None);

Pool

It's a reference to a connection pool, that can be cloned and shared between threads.

use mysql::*;use mysql::prelude::*;use std::thread::spawn;let pool =Pool::new(get_opts())?;let handles =(0..4).map(|i|{spawn({let pool = pool.clone();move ||{letmut conn = pool.get_conn()?;            conn.exec_first::<u32,_,_>("SELECT ? * 10",(i,)).map(Option::unwrap)}})});let result:Result<Vec<u32>> = handles.map(|handle| handle.join().unwrap()).collect();assert_eq!(result.unwrap(), vec![0,10,20,30]);

Statement

Statement, actually, is just an identifier coupled with statement metadata, i.e an informationabout its parameters and columns. Internally theStatement structure also holds additionaldata required to support named parameters (see bellow).

use mysql::*;use mysql::prelude::*;let pool =Pool::new(get_opts())?;letmut conn = pool.get_conn()?;let stmt = conn.prep("DO ?")?;// The prepared statement will return no columns.assert!(stmt.columns().is_empty());// The prepared statement have one parameter.let param = stmt.params().get(0).unwrap();assert_eq!(param.schema_str(),"");assert_eq!(param.table_str(),"");assert_eq!(param.name_str(),"?");

Value

This enumeration represents the raw value of a MySql cell. Library offers conversion betweenValue and different rust types viaFromValue trait described below.

FromValue trait

This trait is reexported frommysql_common create. Please refer to itscrate docs for the list of supported conversions.

Trait offers conversion in two flavours:

  • from_value(Value) -> T - convenient, but panicking conversion.

    Note, that for any variant ofValue there exist a type, that fully covers its domain,i.e. for any variant ofValue there existT: FromValue such thatfrom_value will neverpanic. This means, that if your database schema is known, then it's possible to write yourapplication using onlyfrom_value with no fear of runtime panic.

  • from_value_opt(Value) -> Option<T> - non-panicking, but less convenient conversion.

    This function is useful to probe conversion in cases, where source database schemais unknown.

use mysql::*;use mysql::prelude::*;let via_test_protocol:u32 =from_value(Value::Bytes(b"65536".to_vec()));let via_bin_protocol:u32 =from_value(Value::UInt(65536));assert_eq!(via_test_protocol, via_bin_protocol);let unknown_val =// ...// Maybe it is a float?let unknown_val =matchfrom_value_opt::<f64>(unknown_val){Ok(float) =>{println!("A float value: {}", float);returnOk(());}Err(FromValueError(unknown_val)) => unknown_val,};// Or a string?let unknown_val =matchfrom_value_opt::<String>(unknown_val){Ok(string) =>{println!("A string value: {}", string);returnOk(());}Err(FromValueError(unknown_val)) => unknown_val,};// Screw this, I'll simply match on itmatch unknown_val{    val @Value::NULL =>{println!("An empty value: {:?}", from_value::<Option<u8>>(val))},    val @Value::Bytes(..) =>{// It's non-utf8 bytes, since we already tried to convert it to Stringprintln!("Bytes: {:?}", from_value::<Vec<u8>>(val))}    val @Value::Int(..) =>{println!("A signed integer: {}", from_value::<i64>(val))}    val @Value::UInt(..) =>{println!("An unsigned integer: {}", from_value::<u64>(val))}Value::Float(..) =>unreachable!("already tried"),    val @Value::Double(..) =>{println!("A double precision float value: {}", from_value::<f64>(val))}    val @Value::Date(..) =>{use time::PrimitiveDateTime;println!("A date value: {}", from_value::<PrimitiveDateTime>(val))}    val @Value::Time(..) =>{use std::time::Duration;println!("A time value: {:?}", from_value::<Duration>(val))}}

Row

InternallyRow is a vector ofValues, that also allows indexing by a column name/offset,and stores row metadata. Library offers conversion betweenRow and sequences of Rust typesviaFromRow trait described below.

FromRow trait

This trait is reexported frommysql_common create. Please refer to itscrate docs for the list of supported conversions.

This conversion is based on theFromValue and so comes in two similar flavours:

  • from_row(Row) -> T - same asfrom_value, but for rows;
  • from_row_opt(Row) -> Option<T> - same asfrom_value_opt, but for rows.

Queryabletrait offers implicit conversion for rows of a query result,that is based on this trait.

use mysql::*;use mysql::prelude::*;letmut conn =Conn::new(get_opts())?;// Single-column row can be converted to a singular value:let val:Option<String> = conn.query_first("SELECT 'foo'")?;assert_eq!(val.unwrap(),"foo");// Example of a multi-column row conversion to an inferred type:let row = conn.query_first("SELECT 255, 256")?;assert_eq!(row,Some((255u8,256u16)));// The FromRow trait does not support to-tuple conversion for rows with more than 12 columns,// but you can do this by hand using row indexing or `Row::take` method:let row:Row = conn.exec_first("select 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12",())?.unwrap();for iin0..row.len(){assert_eq!(row[i],Value::Int(iasi64));}// Another way to handle wide rows is to use HList (requires `mysql_common/frunk` feature)use frunk::{HList, hlist, hlist_pat};let query ="select 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15";typeRowType =HList!(u8,u16,u32,u8,u8,u8,u8,u8,u8,u8,u8,u8,u8,u8,u8,u8);let first_three_columns = conn.query_map(query, |row:RowType|{// do something with the row (see the `frunk` crate documentation)lethlist_pat![c1, c2, c3, ...] = row;(c1, c2, c3)});assert_eq!(first_three_columns.unwrap(), vec![(0_u8,1_u16,2_u32)]);// Some unknown rowlet row:Row = conn.query_first(// ...    #"SELECT 255, Null",)?.unwrap();for columnin row.columns_ref(){// Cells in a row can be indexed by numeric index or by column namelet column_value =&row[column.name_str().as_ref()];println!("Column {} of type {:?} with value {:?}",        column.name_str(),        column.column_type(),        column_value,);}

Params

Represents parameters of a prepared statement, but this type won't appear directly in your codebecause binary protocol API will ask forT: Into<Params>, whereInto<Params> is implemented:

  • for tuples ofInto<Value> types up to arity 12;

    Note: singular tuple requires extra comma, e.g.("foo",);

  • forIntoIterator<Item: Into<Value>> for cases, when your statement takes morethan 12 parameters;

  • for named parameters representation (the value of theparams! macro, described below).

use mysql::*;use mysql::prelude::*;letmut conn =Conn::new(get_opts())?;// Singular tuple requires extra comma:let row:Option<u8> = conn.exec_first("SELECT ?",(0,))?;assert_eq!(row.unwrap(),0);// More than 12 parameters:let row:Option<u8> = conn.exec_first("SELECT CONVERT(? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ? + ?, UNSIGNED)",(0..16).collect::<Vec<_>>(),)?;assert_eq!(row.unwrap(),120);

Note: Please refer to themysql_common crate docs for the listof types, that implementsInto<Value>.

Serialized,Deserialized

Wrapper structures for cases, when you need to provide a value for a JSON cell,or when you need to parse JSON cell as a struct.

use mysql::*;use mysql::prelude::*;use serde::{Deserialize,Serialize};/// Serializable structure.#[derive(Debug,PartialEq,Serialize,Deserialize)]structExample{foo:u32,}// Value::from for Serialized will emit json string.let value =Value::from(Serialized(Example{foo:42}));assert_eq!(value,Value::Bytes(br#"{"foo":42}"#.to_vec()));// from_value for Deserialized will parse json string.let structure:Deserialized<Example> =from_value(value);assert_eq!(structure,Deserialized(Example{ foo:42}));

[QueryResult]

It's an iterator over rows of a query result with support of multi-result sets. It's intendedfor cases when you need full control during result set iteration. For other casesQueryable provides a set of methods that will immediately consumethe first result set and drop everything else.

This iterator is lazy so it won't read the result from server until you iterate over it.MySql protocol is strictly sequential, soConn will be mutably borrowed until the resultis fully consumed (please also look at [QueryResult::iter] docs).

use mysql::*;use mysql::prelude::*;letmut conn =Conn::new(get_opts())?;// This query will emit two result sets.letmut result = conn.query_iter("SELECT 1, 2; SELECT 3, 3.14;")?;letmut sets =0;whileletSome(result_set) = result.iter(){    sets +=1;println!("Result set columns: {:?}", result_set.columns());println!("Result set meta: {}, {:?}, {} {}",        result_set.affected_rows(),        result_set.last_insert_id(),        result_set.warnings(),        result_set.info_str(),);for rowin result_set{match sets{1 =>{// First result set will contain two numbers.assert_eq!((1_u8,2_u8), from_row(row?));}2 =>{// Second result set will contain a number and a float.assert_eq!((3_u8,3.14), from_row(row?));}            _ =>unreachable!(),}}}assert_eq!(sets,2);

Text protocol

MySql text protocol is implemented in the set ofQueryable::query* methods. It's useful when yourquery doesn't have parameters.

Note: All values of a text protocol result set will be encoded as strings by the server,sofrom_value conversion may lead to additional parsing costs.

Examples:

let pool =Pool::new(get_opts())?;let val = pool.get_conn()?.query_first("SELECT POW(2, 16)")?;// Text protocol returns bytes even though the result of POW// is actually a floating point number.assert_eq!(val,Some(Value::Bytes("65536".as_bytes().to_vec())));

TheTextQuery trait.

TheTextQuery trait covers the set ofQueryable::query* methods from the perspectiveof a query, i.e.TextQuery is something, that can be performed if suitable connectionis given. Suitable connections are:

  • &Pool
  • Conn
  • PooledConn
  • &mut Conn
  • &mut PooledConn
  • &mut Transaction

The unique characteristic of this trait, is that you can give away the connectionand thus produceQueryResult that satisfies'static:

use mysql::*;use mysql::prelude::*;fniter(pool:&Pool) ->Result<implIterator<Item=Result<u32>>>{let result ="SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3".run(pool)?;Ok(result.map(|row| row.map(from_row)))}let pool =Pool::new(get_opts())?;let it =iter(&pool)?;assert_eq!(it.collect::<Result<Vec<u32>>>()?, vec![1,2,3]);

Binary protocol and prepared statements.

MySql binary protocol is implemented inprep,close and the set ofexec* methods,defined on theQueryable trait. Prepared statements is the only way topass rust value to the MySql server. MySql uses? symbol as a parameter placeholderand it's only possible to use parameters where a single MySql value is expected.For example:

let pool =Pool::new(get_opts())?;let val = pool.get_conn()?.exec_first("SELECT POW(?, ?)",(2,16))?;assert_eq!(val,Some(Value::Double(65536.0)));

Statements

In MySql each prepared statement belongs to a particular connection and can't be executedon another connection. Trying to do so will lead to an error. The driver won't tie statementto its connection in any way, but one can look on to the connection id, containedin theStatement structure.

let pool =Pool::new(get_opts())?;letmut conn_1 = pool.get_conn()?;letmut conn_2 = pool.get_conn()?;let stmt_1 = conn_1.prep("SELECT ?")?;// stmt_1 is for the conn_1, ..assert!(stmt_1.connection_id() == conn_1.connection_id());assert!(stmt_1.connection_id() != conn_2.connection_id());// .. so stmt_1 will execute only on conn_1assert!(conn_1.exec_drop(&stmt_1,("foo",)).is_ok());assert!(conn_2.exec_drop(&stmt_1,("foo",)).is_err());

Statement cache

Note

Statement cache only works for:

  1. for raw [Conn]
  2. for [PooledConn]:
    • within its lifetime if [PoolOpts::reset_connection] istrue
    • within the lifetime of a wrapped [Conn] if [PoolOpts::reset_connection] isfalse
Description

Conn will manage the cache of prepared statements on the client side, so subsequent callsto prepare with the same statement won't lead to a client-server roundtrip. Cache sizefor each connection is determined by thestmt_cache_size field of theOpts structure.Statements, that are out of this boundary will be closed in LRU order.

Statement cache is completely disabled ifstmt_cache_size is zero.

Caveats:

  • disabled statement cache means, that you have to close statements yourself usingConn::close, or they'll exhaust server limits/resources;

  • you should be aware of themax_prepared_stmt_countoption of the MySql server. If the number of active connections times the valueofstmt_cache_size is greater, than you could receive an error while preparinganother statement.

Named parameters

MySql itself doesn't have named parameters support, so it's implemented on the client side.One should use:name as a placeholder syntax for a named parameter. Named parameters usesthe following naming convention:

  • parameter name must start with either_ ora..z
  • parameter name may continue with_,a..z and0..9

Named parameters may be repeated within the statement, e.gSELECT :foo, :foo will requirea single named parameterfoo that will be repeated on the corresponding positions duringstatement execution.

One should use theparams! macro to build parameters for execution.

Note: Positional and named parameters can't be mixed within the single statement.

Examples:

let pool =Pool::new(get_opts())?;letmut conn = pool.get_conn()?;let stmt = conn.prep("SELECT :foo, :bar, :foo")?;let foo =42;let val_13 = conn.exec_first(&stmt,params!{"foo" =>13,"bar" => foo})?.unwrap();// Short syntax is available when param name is the same as variable name:let val_42 = conn.exec_first(&stmt,params!{ foo,"bar" =>13})?.unwrap();assert_eq!((foo,13, foo), val_42);assert_eq!((13, foo,13), val_13);

Buffer pool

Crate uses the global lock-free buffer pool for the purpose of IO and data serialization/deserialization,that helps to avoid allocations for basic scenarios. You can control its characteristics usingthe following environment variables:

  • RUST_MYSQL_BUFFER_POOL_CAP (defaults to 128) – controls the pool capacity. Dropped buffer willbe immediately deallocated if the pool is full. Set it to0 to disable the pool at runtime.

  • RUST_MYSQL_BUFFER_SIZE_CAP (defaults to 4MiB) – controls the maximum capacity of a bufferstored in the pool. Capacity of a dropped buffer will be shrunk to this value when bufferis returned to the pool.

To completely disable the pool (say you are using jemalloc) please remove thebuffer-pool featurefrom the set of default crate features (see theCrate Features section).

BinQuery andBatchQuery traits.

BinQuery andBatchQuery traits covers the set ofQueryable::exec* methods fromthe perspective of a query, i.e.BinQuery is something, that can be performed if suitableconnection is given (seeTextQuery section for the listof suitable connections).

As with theTextQuery you can give away the connection and acquireQueryResult that satisfies'static.

BinQuery is for prepared statements, and prepared statements requires a set of parameters,soBinQuery is implemented forQueryWithParams structure, that can be acquired, usingWithParams trait.

Example:

use mysql::*;use mysql::prelude::*;let pool =Pool::new(get_opts())?;let result:Option<(u8,u8,u8)> ="SELECT ?, ?, ?".with((1,2,3))// <- WithParams::with will construct an instance of QueryWithParams.first(&pool)?;// <- QueryWithParams is executed on the given poolassert_eq!(result.unwrap(),(1,2,3));

TheBatchQuery trait is a helper for batch statement execution. It's implemented forQueryWithParams where parameters is an iterator over parameters:

use mysql::*;use mysql::prelude::*;let pool =Pool::new(get_opts())?;letmut conn = pool.get_conn()?;"CREATE TEMPORARY TABLE batch (x INT)".run(&mut conn)?;"INSERT INTO batch (x) VALUES (?)".with((0..3).map(|x|(x,)))// <- QueryWithParams constructed with an iterator.batch(&mut conn)?;// <- batch execution is preformed herelet result:Vec<u8> ="SELECT x FROM batch".fetch(conn)?;assert_eq!(result, vec![0,1,2]);

Queryable

TheQueryable trait defines common methods forConn,PooledConn andTransaction.The set of basic methods consts of:

  • query_iter - basic methods to execute text query and getQueryResult;
  • prep - basic method to prepare a statement;
  • exec_iter - basic method to execute statement and getQueryResult;
  • close - basic method to close the statement;

The trait also defines the set of helper methods, that is based on basic methods.These methods will consume only the first result set, other result sets will be dropped:

  • {query|exec} - to collect the result into aVec<T: FromRow>;
  • {query|exec}_first - to get the firstT: FromRow, if any;
  • {query|exec}_map - to map eachT: FromRow to someU;
  • {query|exec}_fold - to fold the set ofT: FromRow to a single value;
  • {query|exec}_drop - to immediately drop the result.

The trait also defines theexec_batch function, which is a helper for batch statementexecution.

SSL Support

SSL support comes in two flavors:

  1. Based on thenative-tls crate – native TLS backend.

    This uses the native OS SSL/TLS provider. Enabled by therustls-tls feature.

  2. Based on therustls – TLS backend written in Rust. You have three options here:

    1. rustls-tls feature enablesrustls backend withaws-lc-rs crypto provider
    2. rustls-tls-ring feature enablesrustls backend withring crypto provider
    3. rustls feature enablesrustls backend without crypto provider — you have toinstall your own provider to avoid "no process-level CryptoProvider available" error(see relevant section of therustls crate docs)

    Please also note a few things aboutrustls:

    • it will fail if you'll try to connect to the server by its IP address, hostname is required;
    • it, most likely, won't work on windows, at least with default server certs, generated by theMySql installer.

Changelog

Availablehere

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionallysubmitted for inclusion in the work by you, as defined in the Apache-2.0license, shall be dual licensed as above, without any additional terms orconditions.

About

Mysql client library implemented in rust.

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp