mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
connection.bak -> connection
This commit is contained in:
parent
ec6a3d8021
commit
42c3073089
@ -21,7 +21,7 @@ use std::{
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
/// A connection.bak to the database.
|
||||
/// A connection to the database.
|
||||
///
|
||||
/// This trait is not intended to be used directly. Instead [sqlx::Connection] or [sqlx::Pool] should be used instead, which provide
|
||||
/// concurrent access and typed retrieval of results.
|
||||
@ -30,20 +30,20 @@ pub trait RawConnection: Send {
|
||||
// The database backend this type connects to.
|
||||
type Backend: Backend;
|
||||
|
||||
/// Establish a new connection.bak to the database server.
|
||||
/// Establish a new connection to the database server.
|
||||
async fn establish(url: &str) -> crate::Result<Self>
|
||||
where
|
||||
Self: Sized;
|
||||
|
||||
/// Release resources for this database connection.bak immediately.
|
||||
/// Release resources for this database connection immediately.
|
||||
///
|
||||
/// This method is not required to be called. A database server will eventually notice
|
||||
/// and clean up not fully closed connections.
|
||||
///
|
||||
/// It is safe to close an already closed connection.bak.
|
||||
/// It is safe to close an already closed connection.
|
||||
async fn close(mut self) -> crate::Result<()>;
|
||||
|
||||
/// Verifies a connection.bak to the database is still alive.
|
||||
/// Verifies a connection to the database is still alive.
|
||||
async fn ping(&mut self) -> crate::Result<()> {
|
||||
let _ = self
|
||||
.execute(
|
||||
@ -115,7 +115,7 @@ where
|
||||
Ok(Self::new(live, None))
|
||||
}
|
||||
|
||||
/// Verifies a connection.bak to the database is still alive.
|
||||
/// Verifies a connection to the database is still alive.
|
||||
pub async fn ping(&self) -> crate::Result<()> {
|
||||
let mut live = self.0.acquire().await;
|
||||
live.raw.ping().await?;
|
||||
@ -216,8 +216,8 @@ where
|
||||
{
|
||||
async fn acquire(&self) -> Live<DB> {
|
||||
if let Some(live) = self.live.swap(None) {
|
||||
// Fast path, this connection.bak is not currently in use.
|
||||
// We can directly return the inner connection.bak.
|
||||
// Fast path, this connection is not currently in use.
|
||||
// We can directly return the inner connection.
|
||||
return live;
|
||||
}
|
||||
|
||||
@ -230,7 +230,7 @@ where
|
||||
// which would drop this future
|
||||
receiver
|
||||
.await
|
||||
.expect("waiter dropped without dropping connection.bak")
|
||||
.expect("waiter dropped without dropping connection")
|
||||
}
|
||||
|
||||
fn release(&self, mut live: Live<DB>) {
|
||||
|
@ -16,11 +16,11 @@ pub enum Error {
|
||||
///
|
||||
/// - [io::ErrorKind::ConnectionRefused] - Database backend is most likely behind a firewall.
|
||||
///
|
||||
/// - [io::ErrorKind::ConnectionReset] - Database backend dropped the client connection.bak (perhaps from an administrator action).
|
||||
/// - [io::ErrorKind::ConnectionReset] - Database backend dropped the client connection (perhaps from an administrator action).
|
||||
///
|
||||
/// - [io::ErrorKind::InvalidData] - Unexpected or invalid data was encountered. This would indicate that we received data that we were not
|
||||
/// expecting or it was in a format we did not understand. This generally means either there is a programming error in a SQLx driver or
|
||||
/// something with the connection.bak or the database backend itself is corrupted. Additional details are provided along with the
|
||||
/// something with the connection or the database backend itself is corrupted. Additional details are provided along with the
|
||||
/// error.
|
||||
///
|
||||
Io(io::Error),
|
||||
|
@ -41,7 +41,7 @@ bitflags::bitflags! {
|
||||
// Client supports plugin authentication
|
||||
const PLUGIN_AUTH = 1 << 19;
|
||||
|
||||
// Client send connection.bak attributes
|
||||
// Client send connection attributes
|
||||
const CONNECT_ATTRS = 1 << 20;
|
||||
|
||||
// Enable authentication response packet to be larger than 255 bytes
|
||||
|
@ -119,7 +119,7 @@ mod test {
|
||||
10u8,
|
||||
//string<NUL> server version (MariaDB server version is by default prefixed by "5.5.5-")
|
||||
b"5.5.5-10.4.6-MariaDB-1:10.4.6+maria~bionic\0",
|
||||
//int<4> connection.bak id
|
||||
//int<4> connection id
|
||||
13u8, 0u8, 0u8, 0u8,
|
||||
//string<8> scramble 1st part (authentication seed)
|
||||
b"?~~|vZAu",
|
||||
|
@ -74,7 +74,7 @@ impl<'a> Encode for HandshakeResponsePacket<'a> {
|
||||
|
||||
// if (capabilities & CLIENT_CONNECT_ATTRS)
|
||||
if capabilities.contains(Capabilities::CONNECT_ATTRS) {
|
||||
// size of connection.bak attributes : int<lenenc>
|
||||
// size of connection attributes : int<lenenc>
|
||||
buf.put_uint_lenenc::<LittleEndian, _>(self.connection_attrs.len() as u64);
|
||||
|
||||
for (key, value) in self.connection_attrs {
|
||||
|
@ -5,7 +5,7 @@ use crate::{
|
||||
};
|
||||
use byteorder::LittleEndian;
|
||||
|
||||
/// Forces the server to terminate a specified connection.bak.
|
||||
/// Forces the server to terminate a specified connection.
|
||||
pub struct ComProcessKill {
|
||||
pub process_id: u32,
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use crate::{
|
||||
mariadb::protocol::{Capabilities, Encode},
|
||||
};
|
||||
|
||||
/// Resets a connection.bak without re-authentication.
|
||||
/// Resets a connection without re-authentication.
|
||||
#[derive(Debug)]
|
||||
pub struct ComResetConnection;
|
||||
|
||||
|
@ -2,8 +2,8 @@ use super::Encode;
|
||||
use crate::io::BufMut;
|
||||
use byteorder::NetworkEndian;
|
||||
|
||||
/// Sent instead of [`StartupMessage`] with a new connection.bak to cancel a running query on an existing
|
||||
/// connection.bak.
|
||||
/// Sent instead of [`StartupMessage`] with a new connection to cancel a running query on an existing
|
||||
/// connection.
|
||||
///
|
||||
/// https://www.postgresql.org/docs/devel/protocol-flow.html#id-1.10.5.7.9
|
||||
pub struct CancelRequest {
|
||||
|
Loading…
x
Reference in New Issue
Block a user