public virtual ISqlNode VisitSet(SqlSetNode n) { var v = Visit(n.Variable); var op = Visit(n.Operator) as SqlOperatorNode; var r = Visit(n.Right); return(n.Update(v, op, r)); }
public override ISqlNode VisitSet(SqlSetNode n) { // If the LHS is an identifier, ensure that it is defined already. if (n.Variable is SqlIdentifierNode id) { // TODO: Mark that it's the target of an assignment? Current.GetInfoOrThrow(id.Name, n.Location); return(base.VisitSet(n)); } // Otherwise just do normal visit. All the parts will be accounted for later return(base.VisitSet(n)); }
public ISqlNode VisitSet(SqlSetNode n) { if (n.Operator.Operator == ":=" || n.Operator.Operator == "=") { Append(n.Variable, " := ", n.Right); } else if (n.Operator.Operator.Length == 2 && n.Operator.Operator[1] == '=') { Append(n.Variable, " := ", n.Variable, n.Operator.Operator[0].ToString(), n.Right); } else { Append(n.Variable, " := /* ERROR: Operator ", n.Operator, " unsupported in PostgreSQL */", n.Right); } return(n); }
public override ISqlNode VisitSet(SqlSetNode n) { // If the LHS is a variable, ensure that it is defined already if (n.Variable is SqlVariableNode variable) { Current.GetInfoOrThrow(variable.Name, n.Location); return(base.VisitSet(n)); } // This might happen if the source was from a different dialect parser where variables are written // without "@". if (n.Variable is SqlIdentifierNode id) { // The symbol is already defined in the symbol table, so mark that we are trying to assign // to it and just continue var existingSymbol = Current.GetInfo(id.Name); if (existingSymbol != null) { existingSymbol.AssignedTo(id.Location); return(base.VisitSet(n)); } // We will set up an entry in the symbol table for it, assuming it's just a misnamed variable var originalSymbol = new SymbolInfo { OriginalName = id.Name, Translate = x => new SqlIdentifierNode("@" + ((SqlIdentifierNode)x).Name, x.Location) }; Current.AddSymbol(id.Name, originalSymbol); // Add a shadow symbol, with the correct name, just in case Current.AddSymbol("@" + id.Name, new SymbolInfo { OriginalName = id.Name, CreatedFrom = originalSymbol }); return(base.VisitSet(n)); } return(base.VisitSet(n)); }
public ISqlNode VisitSet(SqlSetNode n) { Append("SET ", n.Variable, " ", n.Operator, " ", n.Right); return(n); }
public override ISqlNode VisitSet(SqlSetNode n) { return(base.VisitSet(n)); }