refactor: use "USE" keyword (#785)

Co-authored-by: luofucong <luofucong@greptime.com>
This commit is contained in:
LFC
2022-12-23 14:29:47 +08:00
committed by GitHub
parent dc52a51576
commit 1daba75e7b
2 changed files with 4 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ use std::time::Instant;
use async_trait::async_trait;
use common_query::Output;
use common_telemetry::{debug, error};
use common_telemetry::{error, trace};
use opensrv_mysql::{
AsyncMysqlShim, ErrorKind, InitWriter, ParamParser, QueryResultWriter, StatementMetaWriter,
};
@@ -74,7 +74,7 @@ impl MysqlInstanceShim {
}
async fn do_query(&self, query: &str) -> Vec<Result<Output>> {
debug!("Start executing query: '{}'", query);
trace!("Start executing query: '{}'", query);
let start = Instant::now();
// TODO(LFC): Find a better way to deal with these special federated queries:
@@ -89,7 +89,7 @@ impl MysqlInstanceShim {
.await
};
debug!(
trace!(
"Finished executing query: '{}', total time costs in microseconds: {}",
query,
start.elapsed().as_micros()

View File

@@ -102,8 +102,7 @@ impl<'a> ParserContext<'a> {
Keyword::DROP => self.parse_drop(),
// TODO(LFC): Use "Keyword::USE" when we can upgrade to newer version of crate sqlparser.
Keyword::NoKeyword if w.value.to_lowercase() == "use" => {
Keyword::USE => {
self.parser.next_token();
let database_name =