mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
fix(ci): pin Rust version, ditch unmaintained actions (#3234)
This commit is contained in:
@@ -211,20 +211,13 @@ impl<C: DerefMut<Target = PgConnection>> PgCopyIn<C> {
|
||||
/// If both `runtime-async-std` and `runtime-tokio` features are enabled, the Tokio version
|
||||
/// takes precedent.
|
||||
pub async fn read_from(&mut self, mut source: impl AsyncRead + Unpin) -> Result<&mut Self> {
|
||||
// this is a separate guard from WriteAndFlush so we can reuse the buffer without zeroing
|
||||
struct BufGuard<'s>(&'s mut Vec<u8>);
|
||||
|
||||
impl Drop for BufGuard<'_> {
|
||||
fn drop(&mut self) {
|
||||
self.0.clear()
|
||||
}
|
||||
}
|
||||
|
||||
let conn: &mut PgConnection = self.conn.as_deref_mut().expect("copy_from: conn taken");
|
||||
loop {
|
||||
let buf = conn.stream.write_buffer_mut();
|
||||
|
||||
// CopyData format code and reserved space for length
|
||||
// Write the CopyData format code and reserve space for the length.
|
||||
// This may end up sending an empty `CopyData` packet if, after this point,
|
||||
// we get canceled or read 0 bytes, but that should be fine.
|
||||
buf.put_slice(b"d\0\0\0\x04");
|
||||
|
||||
let read = match () {
|
||||
@@ -236,7 +229,6 @@ impl<C: DerefMut<Target = PgConnection>> PgCopyIn<C> {
|
||||
};
|
||||
|
||||
if read == 0 {
|
||||
// This will end up sending an empty `CopyData` packet but that should be fine.
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ pub use advisory_lock::{PgAdvisoryLock, PgAdvisoryLockGuard, PgAdvisoryLockKey};
|
||||
pub use arguments::{PgArgumentBuffer, PgArguments};
|
||||
pub use column::PgColumn;
|
||||
pub use connection::PgConnection;
|
||||
pub use copy::PgCopyIn;
|
||||
pub use copy::{PgCopyIn, PgPoolCopyExt};
|
||||
pub use database::Postgres;
|
||||
pub use error::{PgDatabaseError, PgErrorPosition};
|
||||
pub use listener::{PgListener, PgNotification};
|
||||
|
||||
Reference in New Issue
Block a user