mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-01 15:34:19 +01:00
fix get_column_name() when column name doesn't exist
This commit is contained in:
@@ -12,7 +12,7 @@ pub trait ToSqlContext {
|
||||
/// Currently not considering aliases
|
||||
fn get_table_name(&self, id: TableInternalId) -> &str;
|
||||
/// Given a table id and a column index, get the column name
|
||||
fn get_column_name(&self, table_id: TableInternalId, col_idx: usize) -> &str;
|
||||
fn get_column_name(&self, table_id: TableInternalId, col_idx: usize) -> String;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -22,8 +22,12 @@ mod tests {
|
||||
struct TestContext;
|
||||
|
||||
impl ToSqlContext for TestContext {
|
||||
fn get_column_name(&self, _table_id: crate::ast::TableInternalId, _col_idx: usize) -> &str {
|
||||
"placeholder_column"
|
||||
fn get_column_name(
|
||||
&self,
|
||||
_table_id: crate::ast::TableInternalId,
|
||||
_col_idx: usize,
|
||||
) -> String {
|
||||
"placeholder_column".to_string()
|
||||
}
|
||||
|
||||
fn get_table_name(&self, _id: crate::ast::TableInternalId) -> &str {
|
||||
|
||||
@@ -54,7 +54,11 @@ mod tests {
|
||||
// Placeholders for compilation
|
||||
// Context only necessary parsing inside turso_core or in the simulator
|
||||
impl ToSqlContext for TestContext {
|
||||
fn get_column_name(&self, _table_id: crate::ast::TableInternalId, _col_idx: usize) -> &str {
|
||||
fn get_column_name(
|
||||
&self,
|
||||
_table_id: crate::ast::TableInternalId,
|
||||
_col_idx: usize,
|
||||
) -> String {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user