| 1 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::describerust-analyzer cargo sqlx-core 0.8.3 describe/::Describerust-analyzer cargo sqlx-core 0.8.3 describe/Describe#; |
| 2 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::errorrust-analyzer cargo sqlx-postgres 0.8.3 error/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#; |
| 3 | use craterust-analyzer cargo sqlx-postgres 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#}; |
| 4 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::iorust-analyzer cargo sqlx-postgres 0.8.3 io/::{PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#, StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#}; |
| 5 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::loggerrust-analyzer cargo sqlx-core 0.8.3 logger/::QueryLoggerrust-analyzer cargo sqlx-core 0.8.3 logger/QueryLogger#; |
| 6 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::{ |
| 7 | selfrust-analyzer cargo sqlx-postgres 0.8.3 message/, BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#, Bindrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#, Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#, CommandCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/command_complete/CommandComplete#, DataRowrust-analyzer cargo sqlx-postgres 0.8.3 message/data_row/DataRow#, ParameterDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/parameter_description/ParameterDescription#, Parserust-analyzer cargo sqlx-postgres 0.8.3 message/parse/Parse#, |
| 8 | ParseCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/parse_complete/ParseComplete#, Queryrust-analyzer cargo sqlx-postgres 0.8.3 message/query/Query#, RowDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/row_description/RowDescription#, |
| 9 | }; |
| 10 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::statementrust-analyzer cargo sqlx-postgres 0.8.3 statement/::PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#; |
| 11 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::{ |
| 12 | statementrust-analyzer cargo sqlx-postgres 0.8.3 statement/::PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#, PgArgumentsrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#, PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#, PgQueryResultrust-analyzer cargo sqlx-postgres 0.8.3 query_result/PgQueryResult#, PgRowrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#, PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#, |
| 13 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#, |
| 14 | }; |
| 15 | 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#; |
| 16 | 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#; |
| 17 | use futures_corerust-analyzer cargo futures-core 0.3.34 crate/::Streamrust-analyzer cargo futures-core 0.3.34 stream/Stream#; |
| 18 | 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#}; |
| 19 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::argumentsrust-analyzer cargo sqlx-core 0.8.3 arguments/::Argumentsrust-analyzer cargo sqlx-core 0.8.3 arguments/Arguments#; |
| 20 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::Eitherrust-analyzer cargo either 1.18.0 Either#; |
| 21 | 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#}; |
| 22 | |
| 23 | async fn preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/prepare().( |
| 24 | conn: &mut PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#, |
| 25 | sql: &str, |
| 26 | parameters: &[PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#], |
| 27 | metadata: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>>, |
| 28 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#, Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 29 | let id = conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..next_statement_idrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#next_statement_id.; |
| 30 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..next_statement_idrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#next_statement_id. = id.nextrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[StatementId]next().(); |
| 31 | |
| 32 | // build a list of type OIDs to send to the database in the PARSE command |
| 33 | // we have not yet started the query sequence, so we are *safe* to cleanly make |
| 34 | // additional queries here to get any missing OIDs |
| 35 | |
| 36 | let mut param_types = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::with_capacityrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]with_capacity().(parameters.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().()); |
| 37 | |
| 38 | for ty in parameters { |
| 39 | param_types.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(conn.resolve_type_idrust-analyzer cargo sqlx-postgres 0.8.3 connection/describe/impl#[PgConnection]resolve_type_id().(&ty.0rust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#0.).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().); |
| 40 | } |
| 41 | |
| 42 | // flush and wait until we are re-ready |
| 43 | conn.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 44 | |
| 45 | // next we send the PARSE command to the server |
| 46 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(Parserust-analyzer cargo sqlx-postgres 0.8.3 message/parse/Parse# { |
| 47 | param_typesrust-analyzer cargo sqlx-postgres 0.8.3 message/parse/Parse#param_types.: ¶m_types, |
| 48 | queryrust-analyzer cargo sqlx-postgres 0.8.3 message/parse/Parse#query.: sql, |
| 49 | statementrust-analyzer cargo sqlx-postgres 0.8.3 message/parse/Parse#statement.: id, |
| 50 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 51 | |
| 52 | if metadata.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 53 | // get the statement columns and parameters |
| 54 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner. |
| 55 | .streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream. |
| 56 | .write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::Describerust-analyzer cargo sqlx-postgres 0.8.3 message/describe/Describe#::Statementrust-analyzer cargo sqlx-postgres 0.8.3 message/describe/Describe#Statement#(id))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 57 | } |
| 58 | |
| 59 | // we ask for the server to immediately send us the result of the PARSE command |
| 60 | conn.write_syncrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]write_sync().(); |
| 61 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..flushrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]flush().().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().; |
| 62 | |
| 63 | // indicates that the SQL query string is now successfully parsed and has semantic validity |
| 64 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..recv_expectrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]recv_expect().::<ParseCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/parse_complete/ParseComplete#>().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().; |
| 65 | |
| 66 | let metadata = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(metadata) = metadata { |
| 67 | // each SYNC produces one READY FOR QUERY |
| 68 | conn.recv_ready_for_queryrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]recv_ready_for_query().().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().; |
| 69 | |
| 70 | // we already have metadata |
| 71 | metadata |
| 72 | } else { |
| 73 | let parameters = recv_desc_paramsrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/recv_desc_params().(conn).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 | |
| 75 | let rows = recv_desc_rowsrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/recv_desc_rows().(conn).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 | // each SYNC produces one READY FOR QUERY |
| 78 | conn.recv_ready_for_queryrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]recv_ready_for_query().().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().; |
| 79 | |
| 80 | let parameters = conn.handle_parameter_descriptionrust-analyzer cargo sqlx-postgres 0.8.3 connection/describe/impl#[PgConnection]handle_parameter_description().(parameters).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().; |
| 81 | |
| 82 | let (columns, column_names) = conn.handle_row_descriptionrust-analyzer cargo sqlx-postgres 0.8.3 connection/describe/impl#[PgConnection]handle_row_description().(rows, true).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().; |
| 83 | |
| 84 | // ensure that if we did fetch custom data, we wait until we are fully ready before |
| 85 | // continuing |
| 86 | conn.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 87 | |
| 88 | 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().(PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata# { |
| 89 | parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#parameters., |
| 90 | columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#columns., |
| 91 | column_namesrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#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), |
| 92 | }) |
| 93 | }; |
| 94 | |
| 95 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((id, metadata)) |
| 96 | } |
| 97 | |
| 98 | async fn recv_desc_paramsrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/recv_desc_params().(conn: &mut PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ParameterDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/parameter_description/ParameterDescription#, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 99 | conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..recv_expectrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]recv_expect().().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(). |
| 100 | } |
| 101 | |
| 102 | async fn recv_desc_rowsrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/recv_desc_rows().(conn: &mut PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#) -> 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#<RowDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/row_description/RowDescription#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 103 | let rows: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<RowDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/row_description/RowDescription#> = match conn.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..recvrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]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(). { |
| 104 | // describes the rows that will be returned when the statement is eventually executed |
| 105 | message if message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::RowDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#RowDescription# => { |
| 106 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(message.decoderust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[ReceivedMessage]decode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().) |
| 107 | } |
| 108 | |
| 109 | // no data would be returned if this statement was executed |
| 110 | message if message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::NoDatarust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#NoData# => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 111 | |
| 112 | message => { |
| 113 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!( |
| 114 | "expecting RowDescription or NoData but received {:?}", |
| 115 | message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. |
| 116 | )); |
| 117 | } |
| 118 | }; |
| 119 | |
| 120 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(rows) |
| 121 | } |
| 122 | |
| 123 | impl PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection# { |
| 124 | // wait for CloseComplete to indicate a statement was closed |
| 125 | pub(superrust-analyzer cargo sqlx-postgres 0.8.3 connection/) async fn wait_for_close_completerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]wait_for_close_complete().(&mut self, mut count: usize) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 126 | // we need to wait for the [CloseComplete] to be returned from the server |
| 127 | while count 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 { |
| 128 | match self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..recvrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]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(). { |
| 129 | message if message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::PortalSuspendedrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#PortalSuspended# => { |
| 130 | // there was an open portal |
| 131 | // this can happen if the last time a statement was used it was not fully executed |
| 132 | } |
| 133 | |
| 134 | message if message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().==rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq(). rust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[BackendMessageFormat][`PartialEq<Self>`]eq().BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CloseCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CloseComplete# => { |
| 135 | // successfully closed the statement (and freed up the server resources) |
| 136 | count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().-=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`SubAssign<Self>`]sub_assign().1; |
| 137 | } |
| 138 | |
| 139 | message => { |
| 140 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!( |
| 141 | "expecting PortalSuspended or CloseComplete but received {:?}", |
| 142 | message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. |
| 143 | )); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 149 | } |
| 150 | |
| 151 | #[inline(always)] |
| 152 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) fn write_syncrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]write_sync().(&mut self) { |
| 153 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner. |
| 154 | .streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream. |
| 155 | .write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::Syncrust-analyzer cargo sqlx-postgres 0.8.3 message/sync/Sync#) |
| 156 | .expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]expect().("BUG: Sync should not be too big for protocol"); |
| 157 | |
| 158 | // all SYNC messages will return a ReadyForQuery |
| 159 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..pending_ready_for_query_countrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#pending_ready_for_query_count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 160 | } |
| 161 | |
| 162 | async fn get_or_preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]get_or_prepare().<'a>( |
| 163 | &mut self, |
| 164 | sql: &str, |
| 165 | parameters: &[PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#], |
| 166 | // should we store the result of this prepare to the cache |
| 167 | store_to_cache: bool, |
| 168 | // optional metadata that was provided by the user, this means they are reusing |
| 169 | // a statement object |
| 170 | metadata: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>>, |
| 171 | ) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(StatementIdrust-analyzer cargo sqlx-postgres 0.8.3 io/StatementId#, Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>), Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 172 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(statement) = self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..cache_statementrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#cache_statement..get_mutrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]get_mut().(sql) { |
| 173 | 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().()); |
| 174 | } |
| 175 | |
| 176 | let statement = preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/prepare().(self, sql, parameters, metadata).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().; |
| 177 | |
| 178 | if store_to_cache && self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..cache_statementrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#cache_statement..is_enabledrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]is_enabled().() { |
| 179 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((id, _)) = self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..cache_statementrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#cache_statement..insertrust-analyzer cargo sqlx-core 0.8.3 common/statement_cache/impl#[`StatementCache<T>`]insert().(sql, statement.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#clone().()) { |
| 180 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Statementrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Statement#(id))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 181 | self.write_syncrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]write_sync().(); |
| 182 | |
| 183 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..flushrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]flush().().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().; |
| 184 | |
| 185 | self.wait_for_close_completerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]wait_for_close_complete().(1).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().; |
| 186 | self.recv_ready_for_queryrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]recv_ready_for_query().().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().; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(statement) |
| 191 | } |
| 192 | |
| 193 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) async fn runrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]run().<'e, 'c: 'e, 'q: 'e>( |
| 194 | &'c mut self, |
| 195 | query: &'q str, |
| 196 | arguments: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PgArgumentsrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#>, |
| 197 | limit: u8, |
| 198 | persistent: bool, |
| 199 | metadata_opt: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>>, |
| 200 | ) -> 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#<PgQueryResultrust-analyzer cargo sqlx-postgres 0.8.3 query_result/PgQueryResult#, PgRowrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> + 'e, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 201 | 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().(query, self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..log_settingsrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#log_settings..clonerust-analyzer cargo sqlx-core 0.8.3 connection/impl#[LogSettings][Clone]clone().()); |
| 202 | |
| 203 | // before we continue, wait until we are "ready" to accept more queries |
| 204 | self.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 205 | |
| 206 | let mut metadata: Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#>; |
| 207 | |
| 208 | let format = if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut arguments) = arguments { |
| 209 | // Check this before we write anything to the stream. |
| 210 | // |
| 211 | // Note: Postgres actually interprets this value as unsigned, |
| 212 | // making the max number of parameters 65535, not 32767 |
| 213 | // https://github.com/launchbadge/sqlx/issues/3464 |
| 214 | // https://www.postgresql.org/docs/current/limits.html |
| 215 | let num_params = u16::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/ptr_try_from_impls/impl#[u16][`TryFrom<usize>`]try_from().(arguments.lenrust-analyzer cargo sqlx-postgres 0.8.3 arguments/impl#[PgArguments][`Arguments<'q>`]len().()).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| { |
| 216 | err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!( |
| 217 | "PgConnection::run(): too many arguments for query: {}", |
| 218 | arguments.lenrust-analyzer cargo sqlx-postgres 0.8.3 arguments/impl#[PgArguments][`Arguments<'q>`]len().() |
| 219 | ) |
| 220 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 221 | |
| 222 | // prepare the statement if this our first time executing it |
| 223 | // always return the statement ID here |
| 224 | let (statement, metadata_) = self |
| 225 | .get_or_preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]get_or_prepare().(query, &arguments.typesrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#types., persistent, metadata_opt) |
| 226 | .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().; |
| 227 | |
| 228 | metadata = metadata_; |
| 229 | |
| 230 | // patch holes created during encoding |
| 231 | arguments.apply_patchesrust-analyzer cargo sqlx-postgres 0.8.3 arguments/impl#[PgArguments]apply_patches().(self, &metadata.parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#parameters.).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().; |
| 232 | |
| 233 | // consume messages till `ReadyForQuery` before bind and execute |
| 234 | self.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 235 | |
| 236 | // bind to attach the arguments to the statement and create a portal |
| 237 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(Bindrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind# { |
| 238 | portalrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#portal.: PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#::UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]UNNAMED., |
| 239 | statementrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#statement., |
| 240 | formatsrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#formats.: &[PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Binaryrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Binary#], |
| 241 | num_paramsrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#num_params., |
| 242 | paramsrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#params.: &arguments.bufferrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#buffer., |
| 243 | result_formatsrust-analyzer cargo sqlx-postgres 0.8.3 message/bind/Bind#result_formats.: &[PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Binaryrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Binary#], |
| 244 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 245 | |
| 246 | // executes the portal up to the passed limit |
| 247 | // the protocol-level limit acts nearly identically to the `LIMIT` in SQL |
| 248 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(messagerust-analyzer cargo sqlx-postgres 0.8.3 message/::Executerust-analyzer cargo sqlx-postgres 0.8.3 message/execute/Execute# { |
| 249 | portalrust-analyzer cargo sqlx-postgres 0.8.3 message/execute/Execute#portal.: PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#::UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]UNNAMED., |
| 250 | limitrust-analyzer cargo sqlx-postgres 0.8.3 message/execute/Execute#limit.: limit.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), |
| 251 | })?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 252 | // From https://www.postgresql.org/docs/current/protocol-flow.html: |
| 253 | // |
| 254 | // "An unnamed portal is destroyed at the end of the transaction, or as |
| 255 | // soon as the next Bind statement specifying the unnamed portal as |
| 256 | // destination is issued. (Note that a simple Query message also |
| 257 | // destroys the unnamed portal." |
| 258 | |
| 259 | // we ask the database server to close the unnamed portal and free the associated resources |
| 260 | // earlier - after the execution of the current query. |
| 261 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner. |
| 262 | .streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream. |
| 263 | .write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(Closerust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#::Portalrust-analyzer cargo sqlx-postgres 0.8.3 message/close/Close#Portal#(PortalIdrust-analyzer cargo sqlx-postgres 0.8.3 io/PortalId#::UNNAMEDrust-analyzer cargo sqlx-postgres 0.8.3 io/impl#[PortalId]UNNAMED.))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 264 | |
| 265 | // finally, [Sync] asks postgres to process the messages that we sent and respond with |
| 266 | // a [ReadyForQuery] message when it's completely done. Theoretically, we could send |
| 267 | // dozens of queries before a [Sync] and postgres can handle that. Execution on the server |
| 268 | // is still serial but it would reduce round-trips. Some kind of builder pattern that is |
| 269 | // termed batching might suit this. |
| 270 | self.write_syncrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]write_sync().(); |
| 271 | |
| 272 | // prepared statements are binary |
| 273 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Binaryrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Binary# |
| 274 | } else { |
| 275 | // Query will trigger a ReadyForQuery |
| 276 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..write_msgrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]write_msg().(Queryrust-analyzer cargo sqlx-postgres 0.8.3 message/query/Query#(query))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 277 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..pending_ready_for_query_countrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#pending_ready_for_query_count. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 278 | |
| 279 | // metadata starts out as "nothing" |
| 280 | metadata = 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().(PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#::defaultrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[PgStatementMetadata][Default]default().()); |
| 281 | |
| 282 | // and unprepared statements are text |
| 283 | PgValueFormatrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#::Textrust-analyzer cargo sqlx-postgres 0.8.3 value/PgValueFormat#Text# |
| 284 | }; |
| 285 | |
| 286 | self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..flushrust-analyzer cargo sqlx-core 0.8.3 net/socket/buffered/impl#[`BufferedSocket<S>`]flush().().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().; |
| 287 | |
| 288 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(try_streamrust-analyzer cargo sqlx-core 0.8.3 ext/async_stream/try_stream!! { |
| 289 | loop { |
| 290 | let message = self.innerrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection#inner..streamrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnectionInner#stream..recvrust-analyzer cargo sqlx-postgres 0.8.3 connection/stream/impl#[PgStream]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().; |
| 291 | |
| 292 | match message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. { |
| 293 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::BindCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#BindComplete# |
| 294 | | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::ParseCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#ParseComplete# |
| 295 | | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::ParameterDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#ParameterDescription# |
| 296 | | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::NoDatarust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#NoData# |
| 297 | // unnamed portal has been closed |
| 298 | | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CloseCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CloseComplete# |
| 299 | => { |
| 300 | // harmless messages to ignore |
| 301 | } |
| 302 | |
| 303 | // "Execute phase is always terminated by the appearance of |
| 304 | // exactly one of these messages: CommandComplete, |
| 305 | // EmptyQueryResponse (if the portal was created from an |
| 306 | // empty query string), ErrorResponse, or PortalSuspended" |
| 307 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::CommandCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#CommandComplete# => { |
| 308 | // a SQL command completed normally |
| 309 | let cc: CommandCompleterust-analyzer cargo sqlx-postgres 0.8.3 message/command_complete/CommandComplete# = message.decoderust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[ReceivedMessage]decode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 310 | |
| 311 | let rows_affected = cc.rows_affectedrust-analyzer cargo sqlx-postgres 0.8.3 message/command_complete/impl#[CommandComplete]rows_affected().(); |
| 312 | logger.increase_rows_affectedrust-analyzer cargo sqlx-core 0.8.3 logger/impl#[`QueryLogger<'q>`]increase_rows_affected().(rows_affected); |
| 313 | r#yieldrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/`r#yield`!!(Eitherrust-analyzer cargo either 1.18.0 Either#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(PgQueryResultrust-analyzer cargo sqlx-postgres 0.8.3 query_result/PgQueryResult# { |
| 314 | rows_affectedrust-analyzer cargo sqlx-postgres 0.8.3 query_result/PgQueryResult#rows_affected., |
| 315 | })); |
| 316 | } |
| 317 | |
| 318 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::EmptyQueryResponserust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#EmptyQueryResponse# => { |
| 319 | // empty query string passed to an unprepared execute |
| 320 | } |
| 321 | |
| 322 | // Message::ErrorResponse is handled in self.stream.recv() |
| 323 | |
| 324 | // incomplete query execution has finished |
| 325 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::PortalSuspendedrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#PortalSuspended# => {} |
| 326 | |
| 327 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::RowDescriptionrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#RowDescription# => { |
| 328 | // indicates that a *new* set of rows are about to be returned |
| 329 | let (columns, column_names) = self |
| 330 | .handle_row_descriptionrust-analyzer cargo sqlx-postgres 0.8.3 connection/describe/impl#[PgConnection]handle_row_description().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(message.decoderust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[ReceivedMessage]decode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().), false) |
| 331 | .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().; |
| 332 | |
| 333 | metadata = 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().(PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata# { |
| 334 | column_namesrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#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), |
| 335 | columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#columns., |
| 336 | parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#parameters.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`][Default]default().(), |
| 337 | }); |
| 338 | } |
| 339 | |
| 340 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::DataRowrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#DataRow# => { |
| 341 | logger.increment_rows_returnedrust-analyzer cargo sqlx-core 0.8.3 logger/impl#[`QueryLogger<'q>`]increment_rows_returned().(); |
| 342 | |
| 343 | // one of the set of rows returned by a SELECT, FETCH, etc query |
| 344 | let data: DataRowrust-analyzer cargo sqlx-postgres 0.8.3 message/data_row/DataRow# = message.decoderust-analyzer cargo sqlx-postgres 0.8.3 message/impl#[ReceivedMessage]decode().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 345 | let row = PgRowrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow# { |
| 346 | datarust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#data., |
| 347 | formatrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#format., |
| 348 | metadatarust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#metadata.: 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().(&metadata), |
| 349 | }; |
| 350 | |
| 351 | r#yieldrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/`r#yield`!!(Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(row)); |
| 352 | } |
| 353 | |
| 354 | BackendMessageFormatrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#::ReadyForQueryrust-analyzer cargo sqlx-postgres 0.8.3 message/BackendMessageFormat#ReadyForQuery# => { |
| 355 | // processing of the query string is complete |
| 356 | self.handle_ready_for_queryrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]handle_ready_for_query().(message)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 357 | break; |
| 358 | } |
| 359 | |
| 360 | _ => { |
| 361 | return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err_protocolrust-analyzer cargo sqlx-core 0.8.3 error/err_protocol!!( |
| 362 | "execute: unexpected message: {:?}", |
| 363 | message.formatrust-analyzer cargo sqlx-postgres 0.8.3 message/ReceivedMessage#format. |
| 364 | )); |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 370 | }) |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | impl<'c> Executorrust-analyzer cargo sqlx-core 0.8.3 executor/Executor#<'c> for &'c mut PgConnectionrust-analyzer cargo sqlx-postgres 0.8.3 connection/PgConnection# { |
| 375 | type Databaserust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]Database# = Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#; |
| 376 | |
| 377 | fn fetch_manyrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]fetch_many().<'e, 'q, E>( |
| 378 | self, |
| 379 | mut query: E, |
| 380 | ) -> 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#<PgQueryResultrust-analyzer cargo sqlx-postgres 0.8.3 query_result/PgQueryResult#, PgRowrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 381 | where |
| 382 | 'c: 'e, |
| 383 | E: Executerust-analyzer cargo sqlx-core 0.8.3 executor/Execute#<'q, Selfrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]::Databaserust-analyzer cargo sqlx-core 0.8.3 executor/Executor#Database#>, |
| 384 | 'q: 'e, |
| 385 | E: 'q, |
| 386 | { |
| 387 | let sql = query.sqlrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#sql().(); |
| 388 | // False positive: https://github.com/rust-lang/rust-clippy/issues/12560 |
| 389 | #[allow(clippy::map_clone)] |
| 390 | let metadata = query.statementrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#statement().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| 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().(&s.metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata.)); |
| 391 | 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#); |
| 392 | let persistent = query.persistentrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#persistent().(); |
| 393 | |
| 394 | 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!! { |
| 395 | let arguments = arguments?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 396 | let s = self.runrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]run().(sql, arguments, 0, persistent, metadata).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().; |
| 397 | pin_mutrust-analyzer cargo futures-util 0.3.34 macros/pin_mut!!(s); |
| 398 | |
| 399 | 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(). { |
| 400 | r#yieldrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/`r#yield`!!(v); |
| 401 | } |
| 402 | |
| 403 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 404 | }) |
| 405 | } |
| 406 | |
| 407 | fn fetch_optionalrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]fetch_optional().<'e, 'q, E>(self, mut 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#<PgRowrust-analyzer cargo sqlx-postgres 0.8.3 row/PgRow#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 408 | where |
| 409 | 'c: 'e, |
| 410 | E: Executerust-analyzer cargo sqlx-core 0.8.3 executor/Execute#<'q, Selfrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]::Databaserust-analyzer cargo sqlx-core 0.8.3 executor/Executor#Database#>, |
| 411 | 'q: 'e, |
| 412 | E: 'q, |
| 413 | { |
| 414 | let sql = query.sqlrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#sql().(); |
| 415 | // False positive: https://github.com/rust-lang/rust-clippy/issues/12560 |
| 416 | #[allow(clippy::map_clone)] |
| 417 | let metadata = query.statementrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#statement().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|s| 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().(&s.metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata.)); |
| 418 | 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#); |
| 419 | let persistent = query.persistentrust-analyzer cargo sqlx-core 0.8.3 executor/Execute#persistent().(); |
| 420 | |
| 421 | 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 { |
| 422 | let arguments = arguments?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 423 | let s = self.runrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]run().(sql, arguments, 1, persistent, metadata).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().; |
| 424 | pin_mutrust-analyzer cargo futures-util 0.3.34 macros/pin_mut!!(s); |
| 425 | |
| 426 | // With deferred constraints we need to check all responses as we |
| 427 | // could get a OK response (with uncommitted data), only to get an |
| 428 | // error response after (when the deferred constraint is actually |
| 429 | // checked). |
| 430 | let mut ret = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 431 | while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(result) = 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(). { |
| 432 | match result { |
| 433 | Eitherrust-analyzer cargo either 1.18.0 Either#::Rightrust-analyzer cargo either 1.18.0 Either#Right#(r) if ret.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() => ret = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(r), |
| 434 | _ => {} |
| 435 | } |
| 436 | } |
| 437 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ret) |
| 438 | }) |
| 439 | } |
| 440 | |
| 441 | fn prepare_withrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]prepare_with().<'e, 'q: 'e>( |
| 442 | self, |
| 443 | sql: &'q str, |
| 444 | parameters: &'e [PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#], |
| 445 | ) -> 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#<PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'q>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 446 | where |
| 447 | 'c: 'e, |
| 448 | { |
| 449 | 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 { |
| 450 | self.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 451 | |
| 452 | let (_, metadata) = self.get_or_preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]get_or_prepare().(sql, parameters, true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).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().; |
| 453 | |
| 454 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement# { |
| 455 | sqlrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#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), |
| 456 | metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata., |
| 457 | }) |
| 458 | }) |
| 459 | } |
| 460 | |
| 461 | fn describerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]describe().<'e, 'q: 'e>( |
| 462 | self, |
| 463 | sql: &'q str, |
| 464 | ) -> 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#<Selfrust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[`&'c mut PgConnection`][`Executor<'c>`]::Databaserust-analyzer cargo sqlx-core 0.8.3 executor/Executor#Database#>, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#>> |
| 465 | where |
| 466 | 'c: 'e, |
| 467 | { |
| 468 | 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 { |
| 469 | self.wait_until_readyrust-analyzer cargo sqlx-postgres 0.8.3 connection/impl#[PgConnection]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().; |
| 470 | |
| 471 | let (stmt_id, metadata) = self.get_or_preparerust-analyzer cargo sqlx-postgres 0.8.3 connection/executor/impl#[PgConnection]get_or_prepare().(sql, &[], true, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#).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().; |
| 472 | |
| 473 | let nullable = self.get_nullable_for_columnsrust-analyzer cargo sqlx-postgres 0.8.3 connection/describe/impl#[PgConnection]get_nullable_for_columns().(stmt_id, &metadata).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().; |
| 474 | |
| 475 | 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# { |
| 476 | columnsrust-analyzer cargo sqlx-core 0.8.3 describe/Describe#columns.: metadata.columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#columns..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().(), |
| 477 | nullablerust-analyzer cargo sqlx-core 0.8.3 describe/Describe#nullable., |
| 478 | 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#::Leftrust-analyzer cargo either 1.18.0 Either#Left#(metadata.parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#parameters..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().())), |
| 479 | }) |
| 480 | }) |
| 481 | } |
| 482 | } |