| 1 | use superrust-analyzer cargo sqlx-postgres 0.8.3 crate/::{PgColumnrust-analyzer cargo sqlx-postgres 0.8.3 column/PgColumn#, PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#}; |
| 2 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::columnrust-analyzer cargo sqlx-postgres 0.8.3 column/::ColumnIndexrust-analyzer cargo sqlx-core 0.8.3 column/ColumnIndex#; |
| 3 | 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#; |
| 4 | use craterust-analyzer cargo sqlx-postgres 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#; |
| 5 | use craterust-analyzer cargo sqlx-postgres 0.8.3 crate/::{PgArgumentsrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#, Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#}; |
| 6 | 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#; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::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#; |
| 8 | |
| 9 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::statementrust-analyzer cargo sqlx-core 0.8.3 statement/::Statementrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#; |
| 10 | use sqlx_corerust-analyzer cargo sqlx-core 0.8.3 crate/::{Eitherrust-analyzer cargo either 1.18.0 Either#, HashMaprust-analyzer cargo hashbrown 0.15.5 map/HashMap#}; |
| 11 | |
| 12 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 13 | pub struct PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'q> { |
| 14 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) 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#<'q, str>, |
| 15 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#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#>, |
| 16 | } |
| 17 | |
| 18 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 19 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) struct PgStatementMetadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata# { |
| 20 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#columns.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<PgColumnrust-analyzer cargo sqlx-postgres 0.8.3 column/PgColumn#>, |
| 21 | // This `Arc` is not redundant; it's used to avoid deep-copying this map for the `Any` backend. |
| 22 | // See `sqlx-postgres/src/any.rs` |
| 23 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) 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#<HashMaprust-analyzer cargo hashbrown 0.15.5 map/HashMap#<UStrrust-analyzer cargo sqlx-core 0.8.3 ext/ustr/UStr#, usize>>, |
| 24 | pub(craterust-analyzer cargo sqlx-postgres 0.8.3 crate/) 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#<PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#>, |
| 25 | } |
| 26 | |
| 27 | impl<'q> Statementrust-analyzer cargo sqlx-core 0.8.3 statement/Statement#<'q> for PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'q> { |
| 28 | type Databaserust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`PgStatement<'q>`][`Statement<'q>`]Database# = Postgresrust-analyzer cargo sqlx-postgres 0.8.3 database/Postgres#; |
| 29 | |
| 30 | fn to_ownedrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`PgStatement<'q>`][`Statement<'q>`]to_owned().(&self) -> PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'static> { |
| 31 | PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#::<'static> { |
| 32 | 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#::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#Owned#(self.sqlrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#sql..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`][Clone]clone().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().()), |
| 33 | metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata.: self.metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata..clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T, A>`][Clone]clone().(), |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | fn sqlrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`PgStatement<'q>`][`Statement<'q>`]sql().(&self) -> &str { |
| 38 | &self.sqlrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#sql. |
| 39 | } |
| 40 | |
| 41 | fn parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`PgStatement<'q>`][`Statement<'q>`]parameters().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Eitherrust-analyzer cargo either 1.18.0 Either#<&[PgTypeInforust-analyzer cargo sqlx-postgres 0.8.3 type_info/PgTypeInfo#], usize>> { |
| 42 | 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#(&self.metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata..parametersrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#parameters.)) |
| 43 | } |
| 44 | |
| 45 | fn columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`PgStatement<'q>`][`Statement<'q>`]columns().(&self) -> &[PgColumnrust-analyzer cargo sqlx-postgres 0.8.3 column/PgColumn#] { |
| 46 | &self.metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata..columnsrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#columns. |
| 47 | } |
| 48 | |
| 49 | impl_statement_queryrust-analyzer cargo sqlx-core 0.8.3 statement/impl_statement_query!!(PgArgumentsrust-analyzer cargo sqlx-postgres 0.8.3 arguments/PgArguments#); |
| 50 | } |
| 51 | |
| 52 | impl ColumnIndexrust-analyzer cargo sqlx-core 0.8.3 column/ColumnIndex#<PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'_>> for &'_ str { |
| 53 | fn indexrust-analyzer cargo sqlx-postgres 0.8.3 statement/impl#[`&str`][`ColumnIndex<PgStatement<'_>>`]index().(&self, statement: &PgStatementrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#<'_>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<usize, Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> { |
| 54 | statement |
| 55 | .metadatarust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatement#metadata. |
| 56 | .column_namesrust-analyzer cargo sqlx-postgres 0.8.3 statement/PgStatementMetadata#column_names. |
| 57 | .getrust-analyzer cargo hashbrown 0.15.5 map/impl#[`HashMap<K, V, S, A>`]get().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self) |
| 58 | .ok_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]ok_or_else().(|| Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#::ColumnNotFoundrust-analyzer cargo sqlx-core 0.8.3 error/Error#ColumnNotFound#((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().self).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 59 | .copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<&T, E>`]copied().() |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // #[cfg(feature = "any")] |
| 64 | // impl<'q> From<PgStatement<'q>> for crate::any::AnyStatement<'q> { |
| 65 | // #[inline] |
| 66 | // fn from(statement: PgStatement<'q>) -> Self { |
| 67 | // crate::any::AnyStatement::<'q> { |
| 68 | // columns: statement |
| 69 | // .metadata |
| 70 | // .columns |
| 71 | // .iter() |
| 72 | // .map(|col| col.clone().into()) |
| 73 | // .collect(), |
| 74 | // column_names: statement.metadata.column_names.clone(), |
| 75 | // parameters: Some(Either::Left( |
| 76 | // statement |
| 77 | // .metadata |
| 78 | // .parameters |
| 79 | // .iter() |
| 80 | // .map(|ty| ty.clone().into()) |
| 81 | // .collect(), |
| 82 | // )), |
| 83 | // sql: statement.sql, |
| 84 | // } |
| 85 | // } |
| 86 | // } |