public static SelectStatement SelectC(this ITableExpression table, IEnumerable <string> customers) { return(SelectVarCustomer(table, customers)); }
private void setRootTable(LogicalTable rootTable) { string alias = createTableAlias(rootTable); LogicalQueryTable queryTable = new LogicalQueryTable() {Table = rootTable, Alias = alias}; PhysicalQueryTable physicalQueryTable = new PhysicalQueryTable() {Table = rootTable.PartOfTable, Alias = alias}; this.logicalTables.Add (queryTable); this.physicalTables.Add (physicalQueryTable); this.fromSource = physicalQueryTable.ToTableReference(); this.lastTableAdded = queryTable; }
private void attachTable(LogicalQueryTable source, LogicalTable joinWith) { // check if join can be performed, if not then exception is thrown validateAttachArguments(source, joinWith); // join tables LogicalQueryTable target = new LogicalQueryTable() {Table = joinWith}; // if the join table is in fact a part of another physical table already included in source logical table // then dont join them // always join tables if the target table is of entity type if (!isJoinRequired (source, target)) { target.Alias = source.Alias; } else { string alias = createTableAlias(joinWith); target.Alias = alias; PhysicalQueryTable physicalQueryTable = new PhysicalQueryTable() {Table = joinWith.PartOfTable, Alias = alias}; this.physicalTables.Add (physicalQueryTable); this.fromSource = createNewJoin (this.fromSource, source, target); } this.logicalTables.Add (target); this.lastTableAdded = target; }
public static InsertStatement InsertP(this ITableExpression table, params IColumnExpression[] columns) { return(InsertVarParam(table, columns)); }
private ITableExpression createNewJoin(ITableExpression oldJoin, LogicalQueryTable sourceTable, LogicalQueryTable targetTable) { LogicalQueryTable relationTable = (sourceTable.Table.TableType == LogicalTableType.JOIN ? sourceTable : targetTable); LogicalQueryTable entityTable = (sourceTable.Table.TableType == LogicalTableType.ENTITY ? sourceTable : targetTable); TableColumn primaryKey = entityTable.Table.GetPrimaryKey(); TableColumn foreignKey = relationTable.Table.GetForeignKey(primaryKey); ILogicalCondition on = Logical.Equal(Expression.Column(entityTable.Alias, primaryKey.Name), Expression.Column (relationTable.Alias, foreignKey.Name)); return From.Left (oldJoin, targetTable.ToTableReference(), on); }
public static ISelectStatement J(this ISelectStatement select, ITableExpression table, IFilterExpression on) { return(Join(select, table, on)); }
public static JoinedTables Left(ITableExpression table, ITableExpression withTable, ILogicalCondition on) { return new JoinedTables() {Table = table, JoinedWith = withTable, On = on, JoinType = JoinType.LEFTJOIN}; }
public static IInsertStatement Insert(ITableExpression table = null) { return(new InsertStatement(table)); }
public static IDeleteStatement Delete(ITableExpression table = null) { return(new DeleteStatement(table)); }
public static InsertStatement InsertVarParam(this ITableExpression table, params ColumnExpression[] columns) { return(InsertVarParam(table, columns.AsEnumerable())); }
public static IInsertStatement Into(this IInsertStatement insert, ITableExpression table) { insert.Table = table; return(insert); }
public static InsertStatement InsertVarParam(this ITableExpression table, IEnumerable <IColumnExpression> columns) { var _params = columns.Select(col => col.ToParam()); return(new InsertStatement(table, columns.ToArray(), _params.ToArray())); }
public static InsertStatement Insert(this ITableExpression table, IEnumerable <IColumnExpression> columns) { return(new InsertStatement(table, columns.ToArray(), new IValueExpression[columns.Count()])); }
public static InsertStatement Insert(this ITableExpression table) { return(new InsertStatement(table)); }
public static SelectStatement SelectC(this ITableExpression table, params string[] customers) { return(SelectVarCustomer(table, customers)); }
public static IUpdateStatement Update(ITableExpression table) { return(new UpdateStatement(table)); }
public static ISelectStatement J(this ISelectStatement select, ITableExpression table, IFilterExpression on, IJoinOperator joinOperator) { return(Join(select, table, on, joinOperator)); }
public static DeleteStatement Delete(this ITableExpression table) { return(new DeleteStatement(table, null)); }
public static JoinedTables Inner(ITableExpression table, ITableExpression withTable, ILogicalCondition on, string alias) { return new JoinedTables() {Table = table, JoinedWith = withTable, On = on, Alias = alias, JoinType = JoinType.INNERJOIN}; }
public static IDeleteStatement From(this IDeleteStatement delete, ITableExpression table) { delete.Table = table; return(delete); }
public static JoinedTables Cross(ITableExpression table, ITableExpression withTable, string alias) { return new JoinedTables() {Table = table, JoinedWith = withTable, Alias = alias, JoinType = JoinType.CROSSJOIN}; }
public static InsertStatement InsertP(this ITableExpression table, IEnumerable <IColumnExpression> columns) { return(InsertVarParam(table, columns)); }