public override object VisitFromSimpleTable([NotNull] SQLiteParser.FromSimpleTableContext context) { SelectStmt.TableSample sample = null; if (context.tablesample_clause() != null) { sample = VisitTablesample_clause(context.tablesample_clause()) as SelectStmt.TableSample; } return(new BaseTableRef(context.table_name().GetText(), context.table_alias()?.GetText(), sample)); }
public BaseTableRef(string name, string alias = null, SelectStmt.TableSample tableSample = null) { Debug.Assert(name != null); relname_ = qpmodel.utils.Utils.normalizeName(name); if (alias is null) { alias_ = relname_; } else { alias_ = qpmodel.utils.Utils.normalizeName(alias); } tableSample_ = tableSample; }
public AnalyzeStmt(BaseTableRef target, string text, SelectStmt.TableSample ts) : base(text) { // SELECT statement is used so later optimizations can be kicked in easier targetref_ = target; string sql = $"select * from {target.relname_} "; if (ts != null) { sql += $" tablesample row ({ts.rowcnt_})"; } select_ = RawParser.ParseSingleSqlStatement(sql) as SelectStmt; // select_ is a different statement, binding their options select_.queryOpt_ = queryOpt_; }