mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-10 03:34:20 +01:00
move our dbsp-based views to materialized views
We will implement normal SQLite-style view-as-an-alias for compatibility, and will call our incremental views materialized views.
This commit is contained in:
@@ -391,6 +391,29 @@ impl ToTokens for Stmt {
|
||||
s.append(TK_AS, None)?;
|
||||
select.to_tokens_with_context(s, context)
|
||||
}
|
||||
Self::CreateMaterializedView {
|
||||
if_not_exists,
|
||||
view_name,
|
||||
columns,
|
||||
select,
|
||||
} => {
|
||||
s.append(TK_CREATE, None)?;
|
||||
s.append(TK_MATERIALIZED, None)?;
|
||||
s.append(TK_VIEW, None)?;
|
||||
if *if_not_exists {
|
||||
s.append(TK_IF, None)?;
|
||||
s.append(TK_NOT, None)?;
|
||||
s.append(TK_EXISTS, None)?;
|
||||
}
|
||||
view_name.to_tokens_with_context(s, context)?;
|
||||
if let Some(columns) = columns {
|
||||
s.append(TK_LP, None)?;
|
||||
comma(columns, s, context)?;
|
||||
s.append(TK_RP, None)?;
|
||||
}
|
||||
s.append(TK_AS, None)?;
|
||||
select.to_tokens_with_context(s, context)
|
||||
}
|
||||
Self::CreateVirtualTable(create_virtual_table) => {
|
||||
let CreateVirtualTable {
|
||||
if_not_exists,
|
||||
|
||||
@@ -130,6 +130,17 @@ pub enum Stmt {
|
||||
/// query
|
||||
select: Box<Select>,
|
||||
},
|
||||
/// `CREATE MATERIALIZED VIEW`
|
||||
CreateMaterializedView {
|
||||
/// `IF NOT EXISTS`
|
||||
if_not_exists: bool,
|
||||
/// view name
|
||||
view_name: QualifiedName,
|
||||
/// columns
|
||||
columns: Option<Vec<IndexedColumn>>,
|
||||
/// query
|
||||
select: Box<Select>,
|
||||
},
|
||||
/// `CREATE VIRTUAL TABLE`
|
||||
CreateVirtualTable(Box<CreateVirtualTable>),
|
||||
/// `DELETE`
|
||||
|
||||
Reference in New Issue
Block a user