From 83363da3fd9fd723c352ba9c8c0724d7b909b101 Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Fri, 12 Nov 2021 05:13:04 +0000 Subject: [PATCH 1/2] expose PgCopyIn --- sqlx-core/src/postgres/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlx-core/src/postgres/mod.rs b/sqlx-core/src/postgres/mod.rs index ae71a18de5..cac6c004b7 100644 --- a/sqlx-core/src/postgres/mod.rs +++ b/sqlx-core/src/postgres/mod.rs @@ -26,6 +26,7 @@ mod migrate; pub use arguments::{PgArgumentBuffer, PgArguments}; pub use column::PgColumn; pub use connection::{PgConnection, PgConnectionInfo}; +pub use copy::PgCopyIn; pub use database::Postgres; pub use error::{PgDatabaseError, PgErrorPosition}; pub use listener::{PgListener, PgNotification}; From 97644999d532ef8ae3b24274c6eca0d7eda456d9 Mon Sep 17 00:00:00 2001 From: Akira Hayakawa Date: Fri, 12 Nov 2021 05:15:47 +0000 Subject: [PATCH 2/2] downgrade Pool copy_in_raw/out_row to take &self --- sqlx-core/src/postgres/copy.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sqlx-core/src/postgres/copy.rs b/sqlx-core/src/postgres/copy.rs index 18771e3e53..babdecca47 100644 --- a/sqlx-core/src/postgres/copy.rs +++ b/sqlx-core/src/postgres/copy.rs @@ -75,10 +75,7 @@ impl Pool { /// ### Note /// [PgCopyIn::finish] or [PgCopyIn::abort] *must* be called when finished or the connection /// will return an error the next time it is used. - pub async fn copy_in_raw( - &mut self, - statement: &str, - ) -> Result>> { + pub async fn copy_in_raw(&self, statement: &str) -> Result>> { PgCopyIn::begin(self.acquire().await?, statement).await } @@ -101,10 +98,7 @@ impl Pool { /// /// Command examples and accepted formats for `COPY` data are shown here: /// https://www.postgresql.org/docs/current/sql-copy.html - pub async fn copy_out_raw( - &mut self, - statement: &str, - ) -> Result>> { + pub async fn copy_out_raw(&self, statement: &str) -> Result>> { pg_begin_copy_out(self.acquire().await?, statement).await } }