FROM
/// <exception cref="System.SqlSyntaxErrorException" /> public DmlSelectStatement(SelectOption option, IList<Pair<IExpression, string>> selectExprList, TableReferences tables, IExpression where, GroupBy group, IExpression having, OrderBy order, Limit limit) { if (option == null) { throw new ArgumentException("argument 'option' is null"); } Option = option; if (selectExprList == null || selectExprList.IsEmpty()) { this.selectExprList = new List<Pair<IExpression, string>>(0); } else { this.selectExprList = EnsureListType(selectExprList); } Tables = tables; Where = where; Group = group; Having = having; Order = order; Limit = limit; }
public DmlUpdateStatement(bool lowPriority, bool ignore, TableReferences tableRefs, IList<Pair<Identifier, IExpression>> values, IExpression where, OrderBy orderBy, Limit limit) { IsLowPriority = lowPriority; IsIgnore = ignore; if (tableRefs == null) { throw new ArgumentException("argument tableRefs is null for update stmt"); } TableRefs = tableRefs; if (values == null || values.Count <= 0) { Values = new List<Pair<Identifier, IExpression>>(0); } else { if (!(values is List<Pair<Identifier, IExpression>>)) { Values = new List<Pair<Identifier, IExpression>>(values); } else { Values = values; } } Where = where; OrderBy = orderBy; Limit = limit; }
/// <exception cref="System.SqlSyntaxErrorException" /> public DmlDeleteStatement(bool lowPriority, bool quick, bool ignore, IList<Identifier> tableNameList, TableReferences tableRefs) : this(lowPriority, quick, ignore, tableNameList, tableRefs, null) { }
/// <exception cref="System.SqlSyntaxErrorException" /> public override DmlSelectStatement Select() { Match(MySqlToken.KwSelect); var option = SelectOption(); var exprList = SelectExprList(); TableReferences tables = null; IExpression where = null; GroupBy group = null; IExpression having = null; OrderBy order = null; Limit limit = null; var dual = false; if (lexer.Token() == MySqlToken.KwFrom) { if (lexer.NextToken() == MySqlToken.KwDual) { lexer.NextToken(); dual = true; IList<TableReference> trs = new List<TableReference>(1); trs.Add(new Dual()); tables = new TableReferences(trs); } else { tables = TableRefs(); } } if (lexer.Token() == MySqlToken.KwWhere) { lexer.NextToken(); where = exprParser.Expression(); } if (!dual) { group = GroupBy(); if (lexer.Token() == MySqlToken.KwHaving) { lexer.NextToken(); having = exprParser.Expression(); } order = OrderBy(); } limit = Limit(); if (!dual) { switch (lexer.Token()) { case MySqlToken.KwFor: { lexer.NextToken(); Match(MySqlToken.KwUpdate); option.lockMode = LockMode.ForUpdate; break; } case MySqlToken.KwLock: { lexer.NextToken(); Match(MySqlToken.KwIn); MatchIdentifier("SHARE"); MatchIdentifier("MODE"); option.lockMode = LockMode.LockInShareMode; break; } } } return new DmlSelectStatement(option, exprList, tables, where, group, having, order, limit); }
/// <exception cref="System.SqlSyntaxErrorException" /> public DmlDeleteStatement(bool lowPriority, bool quick, bool ignore, IList<Identifier> tableNameList, TableReferences tableRefs, IExpression whereCondition) { // ------- multi-row delete------------ IsLowPriority = lowPriority; IsQuick = quick; IsIgnore = ignore; if (tableNameList == null || tableNameList.IsEmpty()) { throw new ArgumentException("argument 'tableNameList' is empty"); } if (tableNameList is List<Identifier>) { tableNames = tableNameList; } else { tableNames = new List<Identifier>(tableNameList); } if (tableRefs == null) { throw new ArgumentException("argument 'tableRefs' is null"); } TableRefs = tableRefs; WhereCondition = whereCondition; OrderBy = null; Limit = null; }
public virtual void Visit(TableReferences node) { VisitInternal(node.TableReferenceList); }