Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hantmac committed Mar 19, 2024
1 parent 52f55c3 commit 60a1b79
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 36 deletions.
17 changes: 14 additions & 3 deletions driver/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RowStatsIterator> {
let mut total_count: usize = 0;
Expand Down
15 changes: 0 additions & 15 deletions driver/src/flight_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 0 additions & 15 deletions driver/src/rest_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions sql/src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
match t {
DataType::Null => Ok(Self::Null),
Expand Down Expand Up @@ -522,7 +521,6 @@ impl_try_from_number_value!(f64);

impl TryFrom<Value> for NaiveDateTime {
type Error = Error;
#[allow(deprecated)]
fn try_from(val: Value) -> Result<Self> {
match val {
Value::Timestamp(i) => {
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 60a1b79

Please sign in to comment.