mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-31 23:14:21 +01:00
initial stubs for ast::Select
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
//! ToSqlString trait definition and implementations
|
||||
|
||||
mod stmt;
|
||||
|
||||
use crate::ast::TableInternalId;
|
||||
|
||||
/// Context to be used in ToSqlString
|
||||
pub trait ToSqlContext {
|
||||
/// Given an id, get the table name
|
||||
/// Currently not considering alias
|
||||
///
|
||||
/// Currently not considering aliases
|
||||
fn get_table_name(&self, id: TableInternalId) -> &str;
|
||||
}
|
||||
|
||||
/// Trait to convert an ast to a string
|
||||
pub trait ToSqlString<C: ToSqlContext> {
|
||||
pub trait ToSqlString {
|
||||
/// Convert the given value to String
|
||||
fn to_sql_string(&self, context: &C) -> String;
|
||||
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String;
|
||||
}
|
||||
|
||||
1
vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs
Normal file
1
vendored/sqlite3-parser/src/to_sql_string/stmt/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
mod select;
|
||||
36
vendored/sqlite3-parser/src/to_sql_string/stmt/select.rs
Normal file
36
vendored/sqlite3-parser/src/to_sql_string/stmt/select.rs
Normal file
@@ -0,0 +1,36 @@
|
||||
use crate::{
|
||||
ast,
|
||||
to_sql_string::{ToSqlContext, ToSqlString},
|
||||
};
|
||||
|
||||
impl ToSqlString for ast::Select {
|
||||
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String {
|
||||
let mut ret = String::new();
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSqlString for ast::SelectBody {
|
||||
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String {
|
||||
let mut ret = String::new();
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSqlString for ast::OneSelect {
|
||||
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String {
|
||||
let mut ret = String::new();
|
||||
match self {
|
||||
ast::OneSelect::Select(select) => ret,
|
||||
// TODO: come back here when we implement ToSqlString for Expr
|
||||
ast::OneSelect::Values(values) => ret,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ToSqlString for ast::SelectInner {
|
||||
fn to_sql_string<C: ToSqlContext>(&self, context: &C) -> String {
|
||||
let mut ret = String::new();
|
||||
ret
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user