Skip to content

Commit

Permalink
Merge pull request #6742 from ariesdevil/dev
Browse files Browse the repository at this point in the history
chore(query): Remove unnecessary session ref
  • Loading branch information
BohuTANG authored Jul 22, 2022
2 parents cc802a6 + fbd4825 commit 8f6b8ee
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions query/src/servers/mysql/mysql_interactive_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct InteractiveWorkerBase<W: std::io::Write> {
}

pub struct InteractiveWorker<W: std::io::Write> {
session: SessionRef,
base: InteractiveWorkerBase<W>,
version: String,
salt: [u8; 20],
Expand All @@ -73,7 +72,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
}

fn connect_id(&self) -> u32 {
match self.session.get_mysql_conn_id() {
match self.base.session.get_mysql_conn_id() {
Some(conn_id) => conn_id,
None => {
// default conn id
Expand Down Expand Up @@ -128,7 +127,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
query: &'a str,
writer: StatementMetaWriter<'a, W>,
) -> Result<()> {
if self.session.is_aborting() {
if self.base.session.is_aborting() {
writer.error(
ErrorKind::ER_ABORTING_CONNECTION,
"Aborting this connection. because we are try aborting server.".as_bytes(),
Expand All @@ -148,7 +147,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
param: ParamParser<'a>,
writer: QueryResultWriter<'a, W>,
) -> Result<()> {
if self.session.is_aborting() {
if self.base.session.is_aborting() {
writer.error(
ErrorKind::ER_ABORTING_CONNECTION,
"Aborting this connection. because we are try aborting server.".as_bytes(),
Expand All @@ -173,7 +172,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
query: &'a str,
writer: QueryResultWriter<'a, W>,
) -> Result<()> {
if self.session.is_aborting() {
if self.base.session.is_aborting() {
writer.error(
ErrorKind::ER_ABORTING_CONNECTION,
"Aborting this connection. because we are try aborting server.".as_bytes(),
Expand All @@ -189,7 +188,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
let instant = Instant::now();
let blocks = self.base.do_query(query).await;

let format = self.session.get_format_settings()?;
let format = self.base.session.get_format_settings()?;
let mut write_result = writer.write(blocks, &format);

if let Err(cause) = write_result {
Expand All @@ -210,7 +209,7 @@ impl<W: std::io::Write + Send + Sync> AsyncMysqlShim<W> for InteractiveWorker<W>
database_name: &'a str,
writer: InitWriter<'a, W>,
) -> Result<()> {
if self.session.is_aborting() {
if self.base.session.is_aborting() {
writer.error(
ErrorKind::ER_ABORTING_CONNECTION,
"Aborting this connection. because we are try aborting server.".as_bytes(),
Expand Down Expand Up @@ -459,7 +458,6 @@ impl<W: std::io::Write> InteractiveWorker<W> {
}

InteractiveWorker::<W> {
session: session.clone(),
base: InteractiveWorkerBase::<W> {
session,
generic_hold: PhantomData::default(),
Expand Down

1 comment on commit 8f6b8ee

@vercel
Copy link

@vercel vercel bot commented on 8f6b8ee Jul 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

databend – ./

databend.vercel.app
databend-git-main-databend.vercel.app
databend-databend.vercel.app
databend.rs

Please sign in to comment.