Esempio n. 1
0
        public override ISqlNode VisitVariable(SqlVariableNode n)
        {
            // @ variables are only used as parameters in parameterized queries, so if they are defined
            // at all they must have been defined environmentally. Check if the symbol exists already. If
            // so it's a parameter and we leave it as-is. Otherwise it's a misnamed variable (probably
            // output from a parser of a different dialect) so we need to setup a translation rule if one
            // doesn't exist already.
            var info = Current.GetInfo(n.Name);

            if (info != null)
            {
                return(n);
            }

            // Add this symbol with a translation rule
            var originalSymbol = new SymbolInfo {
                OriginalName = n.Name,
                Translate    = x => new SqlIdentifierNode(((SqlVariableNode)x).GetBareName(), x.Location)
            };

            Current.AddSymbol(n.Name, originalSymbol);

            // Add a shadow symbol, with the correct name, just in case
            Current.AddSymbol(n.GetBareName(), new SymbolInfo
            {
                OriginalName = n.Name,
                CreatedFrom  = originalSymbol
            });
            return(n);
        }
Esempio n. 2
0
 public ISqlNode VisitVariable(SqlVariableNode n)
 {
     Append(n.Name);
     return(n);
 }
Esempio n. 3
0
 public virtual ISqlNode VisitVariable(SqlVariableNode n) => n;
 public override ISqlNode VisitVariable(SqlVariableNode n)
 {
     return(base.VisitVariable(n));
 }
 public override ISqlNode VisitVariable(SqlVariableNode n)
 {
     Current.GetInfoOrThrow(n.Name, n.Location);
     return(n);
 }