// set table alias (internally) internal void SetAlias(AliasAs alias) { // if a table already has an alias => remove it if (_alias != null) { Statement.RemoveAlias(_alias); _alias = null; } _alias = alias; }
private TableChainer(Chainer prev) : base(prev) { // set default table alias _alias = new AliasAs(Query.GetIncrementalTableAlias()); Build = (buildContext, buildArgs) => { return(BaseBuildMethod(buildContext, buildArgs)); }; }
// set table alias (by client) internal void SetAliasByClient(AliasAs alias) { // if a table already has an alias => remove it if (_alias != null) { Statement.RemoveAlias(_alias); _alias = null; } Statement.CheckAlias(alias); TryThrow(Statement.Exception); _alias = alias; }
// ctor for Pivot/Unpivot internal TableChainer(Chainer prev, bool overload) : base(prev) { var cfrom = GetPrev <FromChainer>(); if (cfrom.Node != null) { SetNode(cfrom.Node); } _alias = new AliasAs(Query.GetIncrementalTableAlias()); Query.AddTableObject(this); // no build method: build is done by PivotChainer object }
private void ProcessTableArgument(Table table) { Query.AddTableObject(this); CheckNullAndThrow(Arg(() => table, table)); TryThrow(table.Exception); Query.AddArgument(table); _table = table; _alias = table.Alias ?? _alias; if (chainException != null) { chainException.Extra = String.Format("Check {0} method.", chainException.Method); TryThrow(); } TableArgument = table; }
internal void CheckAlias(AliasAs alias) { // check alias name if (IsDefaultAlias(alias.Name)) { _exception = new QueryTalkException("Statement.CheckAlias", QueryTalkExceptionType.InvalidTableAlias, String.Format("table alias = {0}", alias.Name)); return; } // alias should be unique in the build context if (_aliases.Select(a => a.Name).Contains(alias.Name)) { _exception = new QueryTalkException("Statement.CheckAlias", QueryTalkExceptionType.TableAliasDuplicate, String.Format("table alias = {0}", alias)); return; } _aliases.Add(alias); }
internal void RemoveAlias(AliasAs alias) { _aliases.Remove(alias); }