Skip to content

Commit a894b7e

Browse files
committed
feat: Show View
1 parent 2fbd2df commit a894b7e

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/binder/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,10 @@ impl<'a, 'b, T: Transaction, A: AsRef<[(&'static str, DataValue)]>> Binder<'a, '
411411
Statement::Analyze { table_name, .. } => self.bind_analyze(table_name)?,
412412
Statement::Truncate { table_name, .. } => self.bind_truncate(table_name)?,
413413
Statement::ShowTables { .. } => self.bind_show_tables()?,
414-
Statement::ShowVariable { variable } => {
415-
let value = variable[0].value.clone();
416-
match &value[..] {
417-
"views" => self.bind_show_views()?,
418-
_ => return Err(DatabaseError::UnsupportedStmt(stmt.to_string())),
419-
}
420-
}
414+
Statement::ShowVariable { variable } => match &variable[0].value.to_lowercase()[..] {
415+
"views" => self.bind_show_views()?,
416+
_ => return Err(DatabaseError::UnsupportedStmt(stmt.to_string())),
417+
},
421418
Statement::Copy {
422419
source,
423420
to,

src/execution/dql/show_view.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use crate::catalog::view::View;
2-
use crate::catalog::TableMeta;
32
use crate::execution::{Executor, ReadExecutor};
43
use crate::storage::{StatisticsMetaCache, TableCache, Transaction, ViewCache};
54
use crate::throw;
@@ -18,7 +17,7 @@ impl<'a, T: Transaction + 'a> ReadExecutor<'a, T> for ShowViews {
1817
Box::new(
1918
#[coroutine]
2019
move || {
21-
let metas = throw!(unsafe { &mut (*transaction) }.view_metas(TableCache));
20+
let metas = throw!(unsafe { &mut (*transaction) }.views(TableCache));
2221

2322
for View { name, .. } in metas {
2423
let values = vec![DataValue::Utf8 {

src/storage/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ pub trait Transaction: Sized {
467467
})?))
468468
}
469469

470-
fn view_metas(&self, table_cache: &TableCache) -> Result<Vec<View>, DatabaseError> {
470+
fn views(&self, table_cache: &TableCache) -> Result<Vec<View>, DatabaseError> {
471471
let mut metas = vec![];
472472
let (min, max) = unsafe { &*self.table_codec() }.view_bound();
473473
let mut iter = self.range(Bound::Included(min), Bound::Included(max))?;

0 commit comments

Comments
 (0)