| 1 | use superrust-analyzer cargo sqlx-mysql 0.8.3 connection/::MySqlStreamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#; |
| 2 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::connectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/::streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/::Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#; |
| 3 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::describerust-analyzer cargo sqlx-core 0.8.3 describe/::Describerust-analyzer cargo sqlx-core 0.8.3 describe/Describe#; |
| 4 | 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#; |
| 5 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::executorrust-analyzer cargo sqlx-core 0.8.3 executor/::{Executerust-analyzer cargo sqlx-core 0.8.3 executor/Execute#, Executorrust-analyzer cargo sqlx-core 0.8.3 executor/Executor#}; |
| 6 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::extrust-analyzer cargo sqlx-core 0.8.3 ext/::ustrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/::UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#; |
| 7 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::iorust-analyzer cargo sqlx-mysql 0.8.3 io/::MySqlBufExtrust-analyzer cargo sqlx-mysql 0.8.3 io/buf/MySqlBufExt#; |
| 8 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::loggerrust-analyzer cargo sqlx-core 0.8.3 logger/::QueryLoggerrust-analyzer cargo sqlx-core 0.8.3 logger/QueryLogger#; |
| 9 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::responserust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/::Statusrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/Status#; |
| 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/::{ |
| 11 | BinaryRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/row/BinaryRow#, Executerust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute# as StatementExecuterust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#, Preparerust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare/Prepare#, PrepareOkrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#, StmtCloserust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#, |
| 12 | }; |
| 13 | 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/::{ColumnDefinitionrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnDefinition#, ColumnFlagsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnFlags#, Queryrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/query/Query#, TextRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow#}; |
| 14 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::statementrust-analyzer cargo sqlx-mysql 0.8.3 statement/::{MySqlStatementrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatement#, MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#}; |
| 15 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::HashMaprust-analyzer cargo hashbrown 0.15.5 map/HashMap#; |
| 16 | use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::{ |
| 17 | MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#, MySqlArgumentsrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#, MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#, MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#, MySqlQueryResultrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#, MySqlRowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#, MySqlTypeInforust-analyzer cargo sqlx-mysql 0.8.3 type_info/MySqlTypeInfo#, |
| 18 | MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#, |
| 19 | }; |
| 20 | use eitherrust-analyzer cargo either 1.18.0 crate/::Eitherrust-analyzer cargo either 1.18.0 Either#; |
| 21 | 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#; |
| 22 | use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::streamrust-analyzer cargo futures-core 0.3.34 stream/::BoxStreamrust-analyzer cargo futures-core 0.3.34 stream/BoxStream#; |
| 23 | use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream#; |
| 24 | use futures_utilrust-analyzer cargo futures-util 0.3.34 crate/::{pin_mutrust-analyzer cargo futures-util 0.3.34 macros/pin_mut!, TryStreamExtrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#}; |
| 25 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#, syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#}; |
| 26 | |
| 27 | impl MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection# { |
| 28 | async fn prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]prepare_statement().<'c>( |
| 29 | &mut self, |
| 30 | sql: &str, |
| 31 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(u32, MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 32 | // https://dev.mysql.com/doc/internals/en/com-stmt-prepare.html |
| 33 | // https://dev.mysql.com/doc/internals/en/com-stmt-prepare-response.html#packet-COM_STMT_PREPARE_OK |
| 34 | |
| 35 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 36 | .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 37 | .send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(Preparerust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare/Prepare# { queryrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare/Prepare#query.: sql }) |
| 38 | .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().; |
| 39 | |
| 40 | let ok: PrepareOkrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk# = self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..recvrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv().().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().; |
| 41 | |
| 42 | // the parameter definitions are very unreliable so we skip over them |
| 43 | // as we have little use |
| 44 | |
| 45 | if ok.paramsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#params. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 { |
| 46 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#ok.paramsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#params. { |
| 47 | let _def: ColumnDefinitionrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnDefinition# = self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..recvrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv().().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().; |
| 48 | } |
| 49 | |
| 50 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..maybe_recv_eofrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]maybe_recv_eof().().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().; |
| 51 | } |
| 52 | |
| 53 | // the column definitions are berefit the type information from the |
| 54 | // to-be-bound parameters; we will receive the output column definitions |
| 55 | // once more on execute so we wait for that |
| 56 | |
| 57 | let mut columns = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 58 | |
| 59 | let column_names = if ok.columnsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#columns. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u16][`PartialOrd<Self>`]gt().0 { |
| 60 | recv_result_metadatarust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_result_metadata().(&mut self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream., ok.columnsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#columns. as usize, &mut columns).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(). |
| 61 | } else { |
| 62 | Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default#::defaultrust-analyzer cargo hashbrown 0.15.5 map/impl#[`HashMap<K, V, S, A>`][Default]default().() |
| 63 | }; |
| 64 | |
| 65 | let id = ok.statement_idrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#statement_id.; |
| 66 | let metadata = MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata# { |
| 67 | parametersrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#parameters.: ok.paramsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/prepare_ok/PrepareOk#params. as usize, |
| 68 | columnsrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#columns.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(columns), |
| 69 | column_namesrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#column_names.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(column_names), |
| 70 | }; |
| 71 | |
| 72 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((id, metadata)) |
| 73 | } |
| 74 | |
| 75 | async fn get_or_prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]get_or_prepare_statement().<'c>( |
| 76 | &mut self, |
| 77 | sql: &str, |
| 78 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(u32, MySqlStatementMetadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 79 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(statement) = 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..get_mutrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]get_mut().(sql) { |
| 80 | // <MySqlStatementMetadata> is internally reference-counted |
| 81 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().statement).clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()); |
| 82 | } |
| 83 | |
| 84 | let (id, metadata) = self.prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]prepare_statement().(sql).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().; |
| 85 | |
| 86 | // in case of the cache being full, close the least recently used statement |
| 87 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((id, _)) = self |
| 88 | .innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 89 | .cache_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#cache_statement. |
| 90 | .insertrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]insert().(sql, (id, metadata.clonerust-analyzer cargo sqlx-mysql 0.8.3 statement/impl#[MySqlStatementMetadata][Clone]clone().())) |
| 91 | { |
| 92 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 93 | .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 94 | .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# { statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#statement.: id }) |
| 95 | .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().; |
| 96 | } |
| 97 | |
| 98 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((id, metadata)) |
| 99 | } |
| 100 | |
| 101 | #[allow(clippy::needless_lifetimes)] |
| 102 | pub(craterust-analyzer cargo sqlx-mysql 0.8.3 crate/) async fn runrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]run().<'e, 'c: 'e, 'q: 'e>( |
| 103 | &'c mut self, |
| 104 | sql: &'q str, |
| 105 | arguments: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MySqlArgumentsrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#>, |
| 106 | persistent: bool, |
| 107 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<impl Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream#<Itemrust-analyzer cargo futures-core 0.3.34 stream/Stream#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Eitherrust-analyzer cargo either 1.18.0 Either#<MySqlQueryResultrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#, MySqlRowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> + 'e, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> |
| 108 | { |
| 109 | let mut logger = QueryLoggerrust-analyzer cargo sqlx-core 0.8.3 logger/QueryLogger#::newrust-analyzer cargo sqlx-core 0.8.3 logger/impl#[`QueryLogger<'q>`]new().(sql, self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..log_settingsrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#log_settings..clonerust-analyzer cargo sqlx-core 0.8.3 connection/impl#[LogSettings][Clone]clone().()); |
| 110 | |
| 111 | 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().; |
| 112 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..push_backrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]push_back().(Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#::Resultrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#Result#); |
| 113 | |
| 114 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(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().(try_streamrust-analyzer cargo sqlx-core 0.8.3 ext/async_stream/try_stream!! { |
| 115 | // make a slot for the shared column data |
| 116 | // as long as a reference to a row is not held past one iteration, this enables us |
| 117 | // to re-use this memory freely between result sets |
| 118 | let mut columns = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().()); |
| 119 | |
| 120 | let (mut column_names, format, mut needs_metadata) = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(arguments) = arguments { |
| 121 | if persistent && 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..is_enabledrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]is_enabled().() { |
| 122 | let (id, metadata) = self |
| 123 | .get_or_prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]get_or_prepare_statement().(sql) |
| 124 | .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().; |
| 125 | |
| 126 | // https://dev.mysql.com/doc/internals/en/com-stmt-execute.html |
| 127 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 128 | .send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(StatementExecuterust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute# { |
| 129 | statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#statement.: id, |
| 130 | argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments.: &arguments, |
| 131 | }) |
| 132 | .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().; |
| 133 | |
| 134 | (metadata.column_namesrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#column_names., MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#::Binaryrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#Binary#, false) |
| 135 | } else { |
| 136 | let (id, metadata) = self |
| 137 | .prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]prepare_statement().(sql) |
| 138 | .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().; |
| 139 | |
| 140 | // https://dev.mysql.com/doc/internals/en/com-stmt-execute.html |
| 141 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 142 | .send_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]send_packet().(StatementExecuterust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute# { |
| 143 | statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#statement.: id, |
| 144 | argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments.: &arguments, |
| 145 | }) |
| 146 | .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().; |
| 147 | |
| 148 | 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().(StmtCloserust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose# { statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#statement.: id }).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().; |
| 149 | |
| 150 | (metadata.column_namesrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#column_names., MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#::Binaryrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#Binary#, false) |
| 151 | } |
| 152 | } else { |
| 153 | // https://dev.mysql.com/doc/internals/en/com-query.html |
| 154 | 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().(Queryrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/query/Query#(sql)).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().; |
| 155 | |
| 156 | (Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`][Default]default().(), MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#::Textrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#Text#, true) |
| 157 | }; |
| 158 | |
| 159 | loop { |
| 160 | // query response is a meta-packet which may be one of: |
| 161 | // Ok, Err, ResultSet, or (unhandled) LocalInfileRequest |
| 162 | let mut packet = self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..recv_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv_packet().().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().; |
| 163 | |
| 164 | if packet[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == 0x00 || packet[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == 0xff { |
| 165 | // first packet in a query response is OK or ERR |
| 166 | // this indicates either a successful query with no rows at all or a failed query |
| 167 | let ok = packet.okrust-analyzer cargo sqlx-mysql 0.8.3 protocol/packet/impl#[`Packet<Bytes>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 168 | |
| 169 | let rows_affected = ok.affected_rowsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/ok/OkPacket#affected_rows.; |
| 170 | logger.increase_rows_affectedrust-analyzer cargo sqlx-core 0.8.3 logger/impl#[`QueryLogger<'q>`]increase_rows_affected().(rows_affected); |
| 171 | let done = MySqlQueryResultrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult# { |
| 172 | rows_affectedrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#rows_affected., |
| 173 | last_insert_idrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#last_insert_id.: ok.last_insert_idrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/ok/OkPacket#last_insert_id., |
| 174 | }; |
| 175 | |
| 176 | r#yieldrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/`r#yield`!!(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(done)); |
| 177 | |
| 178 | if ok.statusrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/ok/OkPacket#status..containsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/impl#[Status]contains().(Statusrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/Status#::SERVER_MORE_RESULTS_EXISTSrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/impl#[Status]SERVER_MORE_RESULTS_EXISTS.) { |
| 179 | // more result sets exist, continue to the next one |
| 180 | continue; |
| 181 | } |
| 182 | |
| 183 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 184 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 185 | } |
| 186 | |
| 187 | // otherwise, this first packet is the start of the result-set metadata, |
| 188 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..front_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() = Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#::Rowrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#Row#; |
| 189 | |
| 190 | let num_columns = packet.get_uint_lenencrust-analyzer cargo sqlx-mysql 0.8.3 io/buf/impl#[Bytes][MySqlBufExt]get_uint_lenenc().(); // column count |
| 191 | let num_columns = usize::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[usize][`TryFrom<u64>`]try_from().(num_columns) |
| 192 | .map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!("column count overflows usize: {num_columns}"))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 193 | |
| 194 | if needs_metadata { |
| 195 | column_names = Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(recv_result_metadatarust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_result_metadata().(&mut self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream., num_columns, Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::make_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`]make_mut().(&mut columns)).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().); |
| 196 | } else { |
| 197 | // next time we hit here, it'll be a new result set and we'll need the |
| 198 | // full metadata |
| 199 | needs_metadata = true; |
| 200 | |
| 201 | recv_result_columnsrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_result_columns().(&mut self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream., num_columns, Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::make_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`]make_mut().(&mut columns)).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().; |
| 202 | } |
| 203 | |
| 204 | // finally, there will be none or many result-rows |
| 205 | loop { |
| 206 | let packet = self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..recv_packetrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv_packet().().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().; |
| 207 | |
| 208 | if packet[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == 0xfe && packet.lenrust-analyzer cargo bytes 1.12.1 bytes/impl#[Bytes]len().() <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). 9 { |
| 209 | let eof = packet.eofrust-analyzer cargo sqlx-mysql 0.8.3 protocol/packet/impl#[`Packet<Bytes>`]eof().(self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..capabilitiesrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#capabilities.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 210 | |
| 211 | r#yieldrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/`r#yield`!!(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(MySqlQueryResultrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult# { |
| 212 | rows_affectedrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#rows_affected.: 0, |
| 213 | last_insert_idrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#last_insert_id.: 0, |
| 214 | })); |
| 215 | |
| 216 | if eof.statusrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/eof/EofPacket#status..containsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/impl#[Status]contains().(Statusrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/Status#::SERVER_MORE_RESULTS_EXISTSrust-analyzer cargo sqlx-mysql 0.8.3 protocol/response/status/impl#[Status]SERVER_MORE_RESULTS_EXISTS.) { |
| 217 | // more result sets exist, continue to the next one |
| 218 | *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..front_mutrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]front_mut().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() = Waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#::Resultrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/Waiting#Result#; |
| 219 | break; |
| 220 | } |
| 221 | |
| 222 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner..streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream..waitingrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#waiting..pop_frontrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc collections/vec_deque/impl#[`VecDeque<T, A>`]pop_front().(); |
| 223 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()); |
| 224 | } |
| 225 | |
| 226 | let row = match format { |
| 227 | MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#::Binaryrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#Binary# => packet.decode_withrust-analyzer cargo sqlx-mysql 0.8.3 protocol/packet/impl#[`Packet<Bytes>`]decode_with().::<BinaryRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/row/BinaryRow#, _>(&columns)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..0rust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/row/BinaryRow#0., |
| 228 | MySqlValueFormatrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#::Textrust-analyzer cargo sqlx-mysql 0.8.3 value/MySqlValueFormat#Text# => packet.decode_withrust-analyzer cargo sqlx-mysql 0.8.3 protocol/packet/impl#[`Packet<Bytes>`]decode_with().::<TextRowrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow#, _>(&columns)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()..0rust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/row/TextRow#0., |
| 229 | }; |
| 230 | |
| 231 | let v = Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(MySqlRowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow# { |
| 232 | rowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#row., |
| 233 | formatrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#format., |
| 234 | columnsrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#columns.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&columns), |
| 235 | column_namesrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#column_names.: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(&column_names), |
| 236 | }); |
| 237 | |
| 238 | logger.increment_rows_returnedrust-analyzer cargo sqlx-core 0.8.3 logger/impl#[`QueryLogger<'q>`]increment_rows_returned().(); |
| 239 | |
| 240 | r#yieldrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/`r#yield`!!(v); |
| 241 | } |
| 242 | } |
| 243 | })) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | impl<'c> Executorrust-analyzer cargo sqlx-core 0.8.3 executor/Executor#<'c> for &'c mut MySqlConnectionrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection# { |
| 248 | type Databaserust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]Database# = MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#; |
| 249 | |
| 250 | fn fetch_manyrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]fetch_many().<'e, 'q, E>( |
| 251 | self, |
| 252 | mut query: E, |
| 253 | ) -> BoxStreamrust-analyzer cargo futures-core 0.3.34 stream/BoxStream#<'e, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Eitherrust-analyzer cargo either 1.18.0 Either#<MySqlQueryResultrust-analyzer cargo sqlx-mysql 0.8.3 query_result/MySqlQueryResult#, MySqlRowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 254 | where |
| 255 | 'c: 'e, |
| 256 | E: Executerust-analyzer cargo sqlx-core 0.8.3 executor/Execute#<'q, Selfrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]::Databaserust-analyzer cargo sqlx-core 0.8.3 executor/Executor#Database#>, |
| 257 | 'q: 'e, |
| 258 | E: 'q, |
| 259 | { |
| 260 | let sql = query.sqlrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#sql().(); |
| 261 | let arguments = query.take_argumentsrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#take_arguments().().map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::Encoderust-analyzer cargo sqlx-core 0.8.3 error/Error#Encode#); |
| 262 | let persistent = query.persistentrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#persistent().(); |
| 263 | |
| 264 | 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().(try_streamrust-analyzer cargo sqlx-core 0.8.3 ext/async_stream/try_stream!! { |
| 265 | let arguments = arguments?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 266 | let s = self.runrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]run().(sql, arguments, persistent).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().; |
| 267 | pin_mutrust-analyzer cargo futures-util 0.3.34 macros/pin_mut!!(s); |
| 268 | |
| 269 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) = s.try_nextrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#try_next().().rust-analyzer cargo futures-util 0.3.34 stream/try_stream/try_next/impl#[`TryNext<'_, St>`][Future]poll().awaitrust-analyzer cargo futures-util 0.3.34 stream/try_stream/try_next/impl#[`TryNext<'_, St>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 270 | r#yieldrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/`r#yield`!!(v); |
| 271 | } |
| 272 | |
| 273 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 274 | }) |
| 275 | } |
| 276 | |
| 277 | fn fetch_optionalrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]fetch_optional().<'e, 'q, E>(self, query: E) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'e, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<MySqlRowrust-analyzer cargo sqlx-mysql 0.8.3 row/MySqlRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 278 | where |
| 279 | 'c: 'e, |
| 280 | E: Executerust-analyzer cargo sqlx-core 0.8.3 executor/Execute#<'q, Selfrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]::Databaserust-analyzer cargo sqlx-core 0.8.3 executor/Executor#Database#>, |
| 281 | 'q: 'e, |
| 282 | E: 'q, |
| 283 | { |
| 284 | let mut s = self.fetch_manyrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]fetch_many().(query); |
| 285 | |
| 286 | 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 { |
| 287 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(v) = s.try_nextrust-analyzer cargo futures-util 0.3.34 stream/try_stream/TryStreamExt#try_next().().rust-analyzer cargo futures-util 0.3.34 stream/try_stream/try_next/impl#[`TryNext<'_, St>`][Future]poll().awaitrust-analyzer cargo futures-util 0.3.34 stream/try_stream/try_next/impl#[`TryNext<'_, St>`][Future]poll().?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). { |
| 288 | if let Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(r) = v { |
| 289 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r)); |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) |
| 294 | }) |
| 295 | } |
| 296 | |
| 297 | fn prepare_withrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]prepare_with().<'e, 'q: 'e>( |
| 298 | self, |
| 299 | sql: &'q str, |
| 300 | _parameters: &'e [MySqlTypeInforust-analyzer cargo sqlx-mysql 0.8.3 type_info/MySqlTypeInfo#], |
| 301 | ) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'e, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MySqlStatementrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatement#<'q>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 302 | where |
| 303 | 'c: 'e, |
| 304 | { |
| 305 | 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 { |
| 306 | 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().; |
| 307 | |
| 308 | let metadata = if 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..is_enabledrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]is_enabled().() { |
| 309 | self.get_or_prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]get_or_prepare_statement().(sql).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()..1 |
| 310 | } else { |
| 311 | let (id, metadata) = self.prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]prepare_statement().(sql).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().; |
| 312 | |
| 313 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 314 | .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 315 | .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# { statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#statement.: id }) |
| 316 | .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().; |
| 317 | |
| 318 | metadata |
| 319 | }; |
| 320 | |
| 321 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MySqlStatementrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatement# { |
| 322 | sqlrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatement#sql.: Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#::Borrowedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Borrowed#(sql), |
| 323 | // metadata has internal Arcs for expensive data structures |
| 324 | metadatarust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatement#metadata.: metadata.clonerust-analyzer cargo sqlx-mysql 0.8.3 statement/impl#[MySqlStatementMetadata][Clone]clone().(), |
| 325 | }) |
| 326 | }) |
| 327 | } |
| 328 | |
| 329 | #[doc(hidden)] |
| 330 | fn describerust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[`&'c mut MySqlConnection`][`Executor<'c>`]describe().<'e, 'q: 'e>(self, sql: &'q str) -> BoxFuturerust-analyzer cargo futures-core 0.3.34 future/BoxFuture#<'e, Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Describerust-analyzer cargo sqlx-core 0.8.3 describe/Describe#<MySqlrust-analyzer cargo sqlx-mysql 0.8.3 database/MySql#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 331 | where |
| 332 | 'c: 'e, |
| 333 | { |
| 334 | 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 { |
| 335 | 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().; |
| 336 | |
| 337 | let (id, metadata) = self.prepare_statementrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/impl#[MySqlConnection]prepare_statement().(sql).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().; |
| 338 | |
| 339 | self.innerrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnection#inner. |
| 340 | .streamrust-analyzer cargo sqlx-mysql 0.8.3 connection/MySqlConnectionInner#stream. |
| 341 | .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# { statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/stmt_close/StmtClose#statement.: id }) |
| 342 | .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().; |
| 343 | |
| 344 | let columns = (*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Deref]deref().metadata.columnsrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#columns.).clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(); |
| 345 | |
| 346 | let nullable = columns |
| 347 | .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() |
| 348 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|col| { |
| 349 | col.flagsrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#flags. |
| 350 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|flags| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().flags.containsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnFlags]contains().(ColumnFlagsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnFlags#::NOT_NULLrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnFlags]NOT_NULL.)) |
| 351 | }) |
| 352 | .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 353 | |
| 354 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Describerust-analyzer cargo sqlx-core 0.8.3 describe/Describe# { |
| 355 | parametersrust-analyzer cargo sqlx-core 0.8.3 describe/Describe#parameters.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(metadata.parametersrust-analyzer cargo sqlx-mysql 0.8.3 statement/MySqlStatementMetadata#parameters.)), |
| 356 | columnsrust-analyzer cargo sqlx-core 0.8.3 describe/Describe#columns., |
| 357 | nullablerust-analyzer cargo sqlx-core 0.8.3 describe/Describe#nullable., |
| 358 | }) |
| 359 | }) |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | async fn recv_result_columnsrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_result_columns().( |
| 364 | stream: &mut MySqlStreamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#, |
| 365 | num_columns: usize, |
| 366 | columns: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#>, |
| 367 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 368 | columns.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().(); |
| 369 | columns.reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(num_columns); |
| 370 | |
| 371 | for ordinal in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_columns { |
| 372 | columns.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(recv_next_result_columnrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_next_result_column().(&stream.recvrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv().().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()., ordinal)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().); |
| 373 | } |
| 374 | |
| 375 | if num_columns rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 376 | stream.maybe_recv_eofrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]maybe_recv_eof().().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().; |
| 377 | } |
| 378 | |
| 379 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 380 | } |
| 381 | |
| 382 | fn recv_next_result_columnrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_next_result_column().(def: &ColumnDefinitionrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnDefinition#, ordinal: usize) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 383 | // if the alias is empty, use the alias |
| 384 | // only then use the name |
| 385 | let name = match (def.namerust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnDefinition]name().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., def.aliasrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnDefinition]alias().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) { |
| 386 | (_, alias) if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().alias.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() => UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#::newrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/impl#[UStr]new().(alias), |
| 387 | (name, _) => UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#::newrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/impl#[UStr]new().(name), |
| 388 | }; |
| 389 | |
| 390 | let type_info = MySqlTypeInforust-analyzer cargo sqlx-mysql 0.8.3 type_info/MySqlTypeInfo#::from_columnrust-analyzer cargo sqlx-mysql 0.8.3 type_info/impl#[MySqlTypeInfo]from_column().(def); |
| 391 | |
| 392 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn# { |
| 393 | namerust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#name., |
| 394 | type_inforust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#type_info., |
| 395 | ordinalrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#ordinal., |
| 396 | flagsrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#flags.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(def.flagsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnDefinition#flags.), |
| 397 | }) |
| 398 | } |
| 399 | |
| 400 | async fn recv_result_metadatarust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_result_metadata().( |
| 401 | stream: &mut MySqlStreamrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/MySqlStream#, |
| 402 | num_columns: usize, |
| 403 | columns: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<MySqlColumnrust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#>, |
| 404 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<HashMaprust-analyzer cargo hashbrown 0.15.5 map/HashMap#<UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#, usize>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 405 | // the result-set metadata is primarily a listing of each output |
| 406 | // column in the result-set |
| 407 | |
| 408 | let mut column_names = HashMaprust-analyzer cargo hashbrown 0.15.5 map/HashMap#::with_capacityrust-analyzer cargo hashbrown 0.15.5 map/impl#[`HashMap<K, V>`]with_capacity().(num_columns); |
| 409 | |
| 410 | columns.clearrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]clear().(); |
| 411 | columns.reserverust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]reserve().(num_columns); |
| 412 | |
| 413 | for ordinal in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#num_columns { |
| 414 | let def: ColumnDefinitionrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnDefinition# = stream.recvrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]recv().().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().; |
| 415 | |
| 416 | let column = recv_next_result_columnrust-analyzer cargo sqlx-mysql 0.8.3 connection/executor/recv_next_result_column().(&def, ordinal)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 417 | |
| 418 | column_names.insertrust-analyzer cargo hashbrown 0.15.5 map/impl#[`HashMap<K, V, S, A>`]insert().(column.namerust-analyzer cargo sqlx-mysql 0.8.3 column/MySqlColumn#name..clonerust-analyzer cargo sqlx-core 0.8.3 ext/ustr/impl#[UStr][Clone]clone().(), ordinal); |
| 419 | columns.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(column); |
| 420 | } |
| 421 | |
| 422 | stream.maybe_recv_eofrust-analyzer cargo sqlx-mysql 0.8.3 connection/stream/impl#[`MySqlStream<S>`]maybe_recv_eof().().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().; |
| 423 | |
| 424 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(column_names) |
| 425 | } |