From 60a1b79e646aebc96acb1dd5f8d5b1e2deabd4bf Mon Sep 17 00:00:00 2001 From: hantmac Date: Tue, 19 Mar 2024 14:46:39 +0800 Subject: [PATCH] fix --- driver/src/conn.rs | 17 ++++++++++++++--- driver/src/flight_sql.rs | 15 --------------- driver/src/rest_api.rs | 15 --------------- sql/src/value.rs | 3 --- 4 files changed, 14 insertions(+), 36 deletions(-) diff --git a/driver/src/conn.rs b/driver/src/conn.rs index 016e6914c..641e9e75e 100644 --- a/driver/src/conn.rs +++ b/driver/src/conn.rs @@ -190,9 +190,20 @@ pub trait Connection: DynClone + Send + Sync { )) } - async fn begin(&self) -> Result<()>; - async fn commit(&self) -> Result<()>; - async fn rollback(&self) -> Result<()>; + async fn begin(&self) -> Result<()> { + let _ = self.exec("BEGIN").await; + Ok(()) + } + + async fn commit(&self) -> Result<()> { + let _ = self.exec("COMMIT").await; + Ok(()) + } + + async fn rollback(&self) -> Result<()> { + let _ = self.exec("ROLLBACK").await; + Ok(()) + } async fn get_files(&self, stage: &str, local_file: &str) -> Result { let mut total_count: usize = 0; diff --git a/driver/src/flight_sql.rs b/driver/src/flight_sql.rs index 7c0e9d9cd..48a34251e 100644 --- a/driver/src/flight_sql.rs +++ b/driver/src/flight_sql.rs @@ -143,21 +143,6 @@ impl Connection for FlightSQLConnection { "STREAM LOAD unavailable for FlightSQL".to_string(), )) } - - async fn begin(&self) -> Result<()> { - self.exec("BEGIN").await.unwrap(); - Ok(()) - } - - async fn commit(&self) -> Result<()> { - self.exec("COMMIT").await.unwrap(); - Ok(()) - } - - async fn rollback(&self) -> Result<()> { - self.exec("ROLLBACK").await.unwrap(); - Ok(()) - } } impl FlightSQLConnection { diff --git a/driver/src/rest_api.rs b/driver/src/rest_api.rs index 639e0b3a1..8b0f23d50 100644 --- a/driver/src/rest_api.rs +++ b/driver/src/rest_api.rs @@ -187,21 +187,6 @@ impl Connection for RestAPIConnection { let stats = self.load_data(sql, reader, size, None, None).await?; Ok(stats) } - - async fn begin(&self) -> Result<()> { - self.exec("BEGIN").await.unwrap(); - Ok(()) - } - - async fn commit(&self) -> Result<()> { - self.exec("COMMIT").await.unwrap(); - Ok(()) - } - - async fn rollback(&self) -> Result<()> { - self.exec("ROLLBACK").await.unwrap(); - Ok(()) - } } impl<'o> RestAPIConnection { diff --git a/sql/src/value.rs b/sql/src/value.rs index f7d00ac2d..7f8ea27e5 100644 --- a/sql/src/value.rs +++ b/sql/src/value.rs @@ -138,7 +138,6 @@ impl Value { impl TryFrom<(&DataType, &str)> for Value { type Error = Error; - #[allow(deprecated)] fn try_from((t, v): (&DataType, &str)) -> Result { match t { DataType::Null => Ok(Self::Null), @@ -522,7 +521,6 @@ impl_try_from_number_value!(f64); impl TryFrom for NaiveDateTime { type Error = Error; - #[allow(deprecated)] fn try_from(val: Value) -> Result { match val { Value::Timestamp(i) => { @@ -618,7 +616,6 @@ impl std::fmt::Display for Value { } // Compatible with Databend, inner values of nested types are quoted. -#[allow(deprecated)] fn encode_value(f: &mut std::fmt::Formatter<'_>, val: &Value, raw: bool) -> std::fmt::Result { match val { Value::Null => write!(f, "NULL"),