// Generate SQL for COUNT DataTableSql GenCount() { var sql = _gen.SelectCount(GetFrom()); var newtable = DataTableSql.CreateFromSql(DataHeading.Empty, sql); return(newtable); }
// generate SQL code for dyadic set operations DataTableSql DyadicSet(DataTableSql other, DataHeading newheading, JoinOps joinop) { var sql = _gen.SelectSet(GetFrom(), other.GetFrom(), newheading, joinop); var newtable = DataTableSql.CreateFromSql(newheading, sql); return(newtable); }
// generate SQL code for dyadic join operations DataTableSql DyadicJoin(DataTableSql other, DataHeading joinhdg, DataHeading newheading) { var sql = _gen.SelectJoin(GetFrom(), other.GetFrom(), newheading, joinhdg); var newtable = DataTableSql.CreateFromSql(newheading, sql); return(newtable); }
public override DataTable Transform(DataHeading heading, ExpressionEval[] exprs) { _database.RegisterExpressions(exprs); var sql = _gen.SelectAs(GetFrom(), exprs); var newtable = DataTableSql.CreateFromSql(heading, sql); Logger.WriteLine(4, "[Trn '{0}']", newtable); return(newtable); }
public override DataTable Project(ExpressionEval[] exprs) { var heading = DataHeading.Create(exprs); var sql = _gen.SelectAs(GetFrom(), exprs); var newtable = DataTableSql.CreateFromSql(heading, sql); Logger.WriteLine(4, "[Pro '{0}']", newtable); return(newtable); }
public override DataTable Rename(ExpressionEval[] exprs) { // note: heading order must match exprs (cf Local) var heading = DataHeading.Create(exprs); var sql = _gen.SelectAs(GetFrom(), exprs); var newtable = DataTableSql.CreateFromSql(heading, sql); Logger.WriteLine(4, "[Ren '{0}']", newtable); return(newtable); }
public override DataTable TransformAggregate(DataHeading heading, ExpressionEval[] exprs) { _database.RegisterExpressions(exprs); // groups must include all cols that are input to anything other than Aggregate var groups = GroupColumns(exprs); var sql = _gen.SelectAsGroup(GetFrom(), exprs, groups); var newtable = DataTableSql.CreateFromSql(heading, sql); newtable.HasGroupBy = true; Logger.WriteLine(4, "[TrnA '{0}']", newtable); return(newtable); }
public override DataTable TransformOrdered(DataHeading heading, ExpressionEval[] exprs, ExpressionEval[] orderexps) { _database.RegisterExpressions(exprs); var names = exprs.Where(e => e.IsProject).Select(e => e.Name); var isagg = exprs.Any(e => e.HasFold); var allin = orderexps.All(o => names.Contains(o.Name)); // if all ordering fields are in exprs then add order to newtable, else to this table if (!allin) { AddOrderBy(orderexps); } var sql = (isagg) ? _gen.SelectAsGroup(GetFrom(), exprs, GroupColumns(exprs)) : _gen.SelectAs(GetFrom(), exprs); var newtable = DataTableSql.CreateFromSql(heading, sql); if (allin) { newtable.AddOrderBy(orderexps); } newtable.HasGroupBy = isagg; Logger.WriteLine(4, "[TrnO '{0}']", newtable); return(newtable); }