microsoft / SqlScriptDOM

ScriptDOM/SqlDOM is a .NET library for parsing T-SQL statements and interacting with its abstract syntax tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TSql150Parser strange behavior when visiting CursorOption node

FelicePollano opened this issue · comments

I really don't know if this is the right place to ask for this, but since had no reply on the topic on SO, and since here there is similar issues (ie TSSql*Parser related), let me try to ask.

I'm using TSQL150Parser to create a "prettyfier" for TSQL code. I've a TSQLFragmentVisitor class accepting the tree, which is supposed to handle the CursorOption node:

       public override void Visit(CursorOption node)
       {
           base.Visit(node);
       }

It looks like while CursorOption is visited, node.StartColumn and node.StartLine are -1 ( note: information is present on other note types ). The sql fragment I'm using for test is this below:

DECLARE MyCursor scroll CURSOR FOR  
        SELECT * FROM ANYTHING

where "scroll" is the option.
It looks like a bug to me, but I might be missing something. I even appreciate to help solving the issue.

@FelicePollano FYI I moved this to the DacFX repo since that's where the ScriptDom code comes from