| 1 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::{selfrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#}; |
| 2 | |
| 3 | use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::futurerust-analyzer cargo futures-core 0.3.34 future/::BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#; |
| 4 | use futures_utilrust-analyzer cargo futures-util 0.3.34 crate/::FutureExtrust-analyzer cargo futures-util 0.3.34 future/future/FutureExt#; |
| 5 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::connectionrust-analyzer cargo sqlx-core 0.8.3 connection/::*; |
| 6 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) use streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/::{MySqlStreamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#, Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#}; |
| 7 | |
| 8 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::commonrust-analyzer cargo sqlx-core 0.8.3 common/::StatementCacherust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/StatementCache#; |
| 9 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::errorrust-analyzer cargo sqlx-mysql 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 10 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/::StmtCloserust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#; |
| 11 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::textrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/::{Pingrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/ping/Ping#, Quitrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/quit/Quit#}; |
| 12 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::statementrust-analyzer cargo sqlx-mysql 0.8.3 statement/::MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#; |
| 13 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::transactionrust-analyzer cargo sqlx-mysql 0.8.3 transaction/::Transactionrust-analyzer cargo sqlx-core 0.8.3 transaction/Transaction#; |
| 14 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::{MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#, MySqlConnectOptionsrust-analyzer cargo sqlx-mysql 0.8.3 options/MySqlConnectOptions#}; |
| 15 | |
| 16 | mod authrust-analyzer cargo sqlx-mysql 0.8.3 connection/auth/; |
| 17 | mod establishrust-analyzer cargo sqlx-mysql 0.8.3 connection/establish/; |
| 18 | mod executorrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/; |
| 19 | mod streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/; |
| 20 | mod tlsrust-analyzer cargo sqlx-mysql 0.8.3 connection/tls/; |
| 21 | |
| 22 | const MAX_PACKET_SIZErust-analyzer cargo sqlx-mysql 0.8.3 connection/MAX_PACKET_SIZE.: u32 = 1024; |
| 23 | |
| 24 | /// A connection to a MySQL database. |
| 25 | pub struct MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection# { |
| 26 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner.: Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<MySqlConnectionInnerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#>, |
| 27 | } |
| 28 | |
| 29 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) struct MySqlConnectionInnerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner# { |
| 30 | // underlying TCP stream, |
| 31 | // wrapped in a potentially TLS stream, |
| 32 | // wrapped in a buffered stream |
| 33 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream.: MySqlStreamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#, |
| 34 | |
| 35 | // transaction status |
| 36 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) transaction_depthrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#transaction_depth.: usize, |
| 37 | |
| 38 | // cache by query string to the statement id and metadata |
| 39 | cache_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#cache_statement.: StatementCacherust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/StatementCache#<(u32, MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#)>, |
| 40 | |
| 41 | log_settingsrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#log_settings.: LogSettingsrust-analyzer cargo sqlx-core 0.8.3 connection/LogSettings#, |
| 42 | } |
| 43 | |
| 44 | impl Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection# { |
| 45 | fn fmtrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Debug]fmt().(&self, f: &mut Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 46 | f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().("MySqlConnection").finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().() |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | impl Connectionrust-analyzer cargo sqlx-core 0.8.3 connection/Connection# for MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection# { |
| 51 | type Databaserust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]Database# = MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#; |
| 52 | |
| 53 | type Optionsrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]Options# = MySqlConnectOptionsrust-analyzer cargo sqlx-mysql 0.8.3 options/MySqlConnectOptions#; |
| 54 | |
| 55 | fn closerust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]close().(mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'static, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 56 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 57 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(Quitrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/quit/Quit#).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 58 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..shutdownrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]shutdown().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 59 | |
| 60 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 61 | }) |
| 62 | } |
| 63 | |
| 64 | fn close_hardrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]close_hard().(mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'static, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 65 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 66 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..shutdownrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]shutdown().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 67 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 68 | }) |
| 69 | } |
| 70 | |
| 71 | fn pingrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]ping().(&mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 72 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 73 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..wait_until_readyrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]wait_until_ready().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 74 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(Pingrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/ping/Ping#).rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 75 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..recv_okrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv_ok().().rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 76 | |
| 77 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | #[doc(hidden)] |
| 82 | fn flushrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]flush().(&mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 83 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..wait_until_readyrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]wait_until_ready().().boxedrust-analyzer cargo futures-util 0.3.34 future/future/FutureExt#boxed().() |
| 84 | } |
| 85 | |
| 86 | fn cached_statements_sizerust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]cached_statements_size().(&self) -> usize { |
| 87 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..cache_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#cache_statement..lenrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]len().() |
| 88 | } |
| 89 | |
| 90 | fn clear_cached_statementsrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]clear_cached_statements().(&mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> { |
| 91 | Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::pinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]pin().(async move { |
| 92 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((statement_id, _)) = self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..cache_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#cache_statement..remove_lrurust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]remove_lru().() { |
| 93 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 94 | .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 95 | .send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(StmtCloserust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose# { |
| 96 | statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#statement.: statement_id, |
| 97 | }) |
| 98 | .rust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().awaitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core future/future/Future#poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 99 | } |
| 100 | |
| 101 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 102 | }) |
| 103 | } |
| 104 | |
| 105 | #[doc(hidden)] |
| 106 | fn should_flushrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]should_flush().(&self) -> bool { |
| 107 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..write_bufferrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]write_buffer().().is_emptyrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[WriteBuffer]is_empty().() |
| 108 | } |
| 109 | |
| 110 | fn beginrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]begin().(&mut self) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'_, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Transactionrust-analyzer cargo sqlx-core 0.8.3 transaction/Transaction#<'_, Selfrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]::Databaserust-analyzer cargo sqlx-core 0.8.3 connection/Connection#Database#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 111 | where |
| 112 | Selfrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 113 | { |
| 114 | Transactionrust-analyzer cargo sqlx-core 0.8.3 transaction/Transaction#::beginrust-analyzer cargo sqlx-core 0.8.3 transaction/impl#[`Transaction<'c, DB>`]begin().(self) |
| 115 | } |
| 116 | |
| 117 | fn shrink_buffersrust-analyzer cargo sqlx-mysql 0.8.3 connection/impl#[MySqlConnection][Connection]shrink_buffers().(&mut self) { |
| 118 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..shrink_buffersrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]shrink_buffers().(); |
| 119 | } |
| 120 | } |