public override void EnterFrom(SelectSQLParser.FromContext context)
        {
            var table         = context.table();
            var tableLockType = context.tableLockType();

            if (table == null || table.IsEmpty)
            {
                throw new MissingTableNameException();
            }

            var tableName = table.GetText();

            if (string.IsNullOrEmpty(tableName))
            {
                throw new MissingTableNameException();
            }

            TableReadType readType = TableReadType.NONE;

            if (tableLockType != null && !tableLockType.IsEmpty)
            {
                var nolockOption   = tableLockType.NOLOCK();
                var readpastOption = tableLockType.READPAST();

                if (nolockOption != null)
                {
                    readType = TableReadType.NOLOCK;
                }
                else if (readpastOption != null)
                {
                    readType = TableReadType.READPAST;
                }
            }

            this.SelectStmt.TableDescriptor = new TableDescriptor()
            {
                TableName = tableName, TableReadType = readType
            };
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="SelectSQLParser.from"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitFrom([NotNull] SelectSQLParser.FromContext context)
 {
     return(VisitChildren(context));
 }
Exemple #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="SelectSQLParser.from"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitFrom([NotNull] SelectSQLParser.FromContext context)
 {
 }