Skip to content

Commit

Permalink
fix(cli): send formatted query to server
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Oct 18, 2023
1 parent ac1264d commit 6771481
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use tokio::io::AsyncWriteExt;
use tokio::time::Instant;
use tokio_stream::StreamExt;

use crate::ast::format_query;
use crate::ast::{TokenKind, Tokenizer};
use crate::config::Settings;
use crate::config::TimeOption;
Expand Down Expand Up @@ -311,11 +312,12 @@ impl Session {
return Ok(Some(ServerStats::default()));
}

let formatted_query = format_query(query);
let start = Instant::now();
let kind = QueryKind::from(query);
match (kind, is_repl) {
(QueryKind::Update, false) => {
let affected = self.conn.exec(query).await?;
let affected = self.conn.exec(&formatted_query).await?;
if is_repl {
if affected > 0 {
eprintln!(
Expand Down Expand Up @@ -354,7 +356,7 @@ impl Session {
}
self.conn.get_files(&args[1], &args[2]).await?
}
_ => self.conn.query_iter_ext(query).await?,
_ => self.conn.query_iter_ext(&formatted_query).await?,
};

let mut displayer = FormatDisplay::new(
Expand Down

0 comments on commit 6771481

Please sign in to comment.