## org.eclipse.datatools.sqltools.sql.parser
Class ParsingResult

    java.lang.Object
      org.eclipse.datatools.sqltools.sql.parser.ParsingResult

Direct Known Subclasses:
  DerbyParsingResult, GenericParsingResult

    public abstract class ParsingResult

extends java.lang.Object

Used to cache the parsing result of a sql text. TODO: move the findXXX and getXXX methods to Visitor.

Author:
  Hui Cao

Constructor Summary
`ParsingResult()`
`ParsingResult(Node rootNode, java.util.ArrayList exceptions)`

Method Summary
`void` `addCurrentTables(Node simpleNode, Token token, boolean isContentAssist)` Add a new table object into the current table list.
`void` `addCurrentTables(java.lang.String tableName, java.lang.String aliasName, boolean isContentAssist)` Add a new table object into the current table list.
`void` `addEntry(java.lang.Object t, java.lang.String type)`
`void` `addExpectedUnreservedKeywords(java.lang.String unReservedKeyword)` Adds an unreserved keyword if it doesn't exist in the list.
`void` `clearCurrentTableNames(boolean isContentAssist)` Clear the content of the current table list.
`Node` `findContainingDeployable(org.eclipse.jface.text.IDocument document, int offset, IASTStart start)` Finds the containing SP/event/function/trigger statement, or _rootNode if there're standalone statements before offset, else return null
`static Node` `findNode(org.eclipse.jface.text.IDocument document, int offset, Node rootNode, boolean inclusive)` Finds the node that offset belongs to, or return null if none is found.
`Node` `findParentCompound(org.eclipse.jface.text.IDocument document, int offset, Node rootNode)` Finds the immediate containing compound statement, or return null
`java.util.List` `getCurrentTables()` Return the current table list.
`java.util.ArrayList` `getCursorNames(org.eclipse.jface.text.IDocument document, int offset)` Returns all the cursor names that can be used at the position indicated by offset.
`java.util.HashMap` `getCursors(org.eclipse.jface.text.IDocument document, int offset)` Gets all the parameter definitions indexed by their names in the surrounding stored procedure
`java.lang.String[]` `getEntries(java.lang.String type)`
`java.util.ArrayList` `getExceptions()` Accumulates all the exceptions during the parsing process
`java.util.List` `getExpectedUnreservedKeywords()` Returns the expected unreserved keywords, used in content assist.
`java.util.HashMap` `getParameters(org.eclipse.jface.text.IDocument document, int offset)` Gets all the parameter definitions indexed by their names in the surrounding stored procedure
`abstract java.util.ArrayList` `getPrefix(java.util.ArrayList tokenLists, Node node)` Gets prefix name of result.
`java.util.ArrayList` `getReferencedTables()`
`IASTStart` `getRootNode()`
`int` `getScope()` Gets the current scope at the position where content assist is invoked.
`abstract java.util.ArrayList` `getUnSharableTempTables(org.eclipse.jface.text.IDocument document, int offset)` Gets non-sharable temp tables referenced in sp/trigger which have not been defined explicitly in sp/trigger,not in annotation.
`java.util.HashMap` `getVariables(org.eclipse.jface.text.IDocument document, int offset)` Gets all the variable definitions indexed by their names that can be used at the position indicated by offset
`abstract boolean` `isValidObjectsFormats(java.util.ArrayList tokenLists)` Checks whether the token list represents a valiad database object.
`abstract boolean` `isVarOrPara(java.util.ArrayList tokenLists)` Checks whether the token list is variable or parameter.
`void` `setExceptions(java.util.ArrayList exceptions)` /** Accumulates all the exceptions during the parsing process
`void` `setRootNode(Node rootNode)`
`void` `setScope(int scope)` Sets the current scope

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ParsingResult

    public ParsingResult()

### ParsingResult

    public ParsingResult(Node rootNode,
                         java.util.ArrayList exceptions)

Method Detail

### getExceptions

    public java.util.ArrayList getExceptions()

  Accumulates all the exceptions during the parsing process

  Returns:
    Collections of ParseExceptions

### getRootNode

    public IASTStart getRootNode()

### setExceptions

    public void setExceptions(java.util.ArrayList exceptions)

  /** Accumulates all the exceptions during the parsing process

### setRootNode

    public void setRootNode(Node rootNode)

### getExpectedUnreservedKeywords

    public java.util.List getExpectedUnreservedKeywords()

  Returns the expected unreserved keywords, used in content assist.

  Returns:
    String list

### addExpectedUnreservedKeywords

    public void addExpectedUnreservedKeywords(java.lang.String unReservedKeyword)

  Adds an unreserved keyword if it doesn't exist in the list.

### getCursorNames

    public java.util.ArrayList getCursorNames(org.eclipse.jface.text.IDocument document,
                                              int offset)

  Returns all the cursor names that can be used at the position indicated by offset.

  Parameters:
    `document` -
    `offset` -
    `rootNode` -
  Returns:
    all the cursor names that can be used at the position indicated by offset

### getVariables

    public java.util.HashMap getVariables(org.eclipse.jface.text.IDocument document,
                                          int offset)

  Gets all the variable definitions indexed by their names that can be used at the position indicated by offset

  Parameters:
    `document` -
    `offset` -
  Returns:
    key: String; value: IASTSQLParam

### getParameters

    public java.util.HashMap getParameters(org.eclipse.jface.text.IDocument document,
                                           int offset)

  Gets all the parameter definitions indexed by their names in the surrounding stored procedure

  Parameters:
    `document` -
    `offset` -
  Returns:
    key: String; value: IASTSQLParam

### findParentCompound

    public Node findParentCompound(org.eclipse.jface.text.IDocument document,
                                   int offset,
                                   Node rootNode)

  Finds the immediate containing compound statement, or return null

  Parameters:
    `document` -
    `offset` -
  Returns:

### findNode

    public static Node findNode(org.eclipse.jface.text.IDocument document,
                                int offset,
                                Node rootNode,
                                boolean inclusive)

  Finds the node that offset belongs to, or return null if none is found.

  Parameters:
    `document` -
    `offset` -
    `rootNode` - the outmost node to search for
    `inclusive` - whether to include the trailing spaces
  Returns:

### findContainingDeployable

    public Node findContainingDeployable(org.eclipse.jface.text.IDocument document,
                                         int offset,
                                         IASTStart start)

  Finds the containing SP/event/function/trigger statement, or _rootNode if there're standalone statements before offset, else return null

  Parameters:
    `document` -
    `offset` -
    `start` - TODO
  Returns:

### getCursors

    public java.util.HashMap getCursors(org.eclipse.jface.text.IDocument document,
                                        int offset)

  Gets all the parameter definitions indexed by their names in the surrounding stored procedure

  Parameters:
    `document` -
    `offset` -
  Returns:
    key: String; value: IASTSQLParam

### getScope

    public int getScope()

  Gets the current scope at the position where content assist is invoked. This is used by content assist processor to determine what database meta info should be retrieved.

  Returns:
    scope constants defined in `SQLParserConstants`
  See Also:
    `SQLParserConstants`

### setScope

    public void setScope(int scope)

  Sets the current scope

### getCurrentTables

    public java.util.List getCurrentTables()

  Return the current table list.

  Returns:
    List the current table list.

### addCurrentTables

    public void addCurrentTables(Node simpleNode,
                                 Token token,
                                 boolean isContentAssist)

  Add a new table object into the current table list. The new table object will not be added when isContentAssist is true for avoiding to be done repeatedly.

  Parameters:
    `simpleNode` - the node's text which is the table name.
    `token` - the token's image which is the alias name of table.
    `isContentAssist` - true for content assist. TODO revisit the necessity of isContentAssist

### addCurrentTables

    public void addCurrentTables(java.lang.String tableName,
                                 java.lang.String aliasName,
                                 boolean isContentAssist)

  Add a new table object into the current table list. The new table object will not be added when isContentAssist is true for avoiding to be done repeatedly.

  Parameters:
    `tableName` - the table name.
    `aliasName` - the alias name of the table.
    `isContentAssist` - true for content assist.

### clearCurrentTableNames

    public void clearCurrentTableNames(boolean isContentAssist)

  Clear the content of the current table list. If isContentAssist is true, just return.

  Parameters:
    `isContentAssist` - true for content assist.

### isValidObjectsFormats

    public abstract boolean isValidObjectsFormats(java.util.ArrayList tokenLists)

  Checks whether the token list represents a valiad database object.

  Parameters:
    `tokenLists` -
  Returns:

### isVarOrPara

    public abstract boolean isVarOrPara(java.util.ArrayList tokenLists)

  Checks whether the token list is variable or parameter.

  Parameters:
    `tokenLists` -
  Returns:

### getPrefix

    public abstract java.util.ArrayList getPrefix(java.util.ArrayList tokenLists,
                                                  Node node)

  Gets prefix name of result.

  Parameters:
    `tokenLists` -
    `node` -
  Returns:

### getUnSharableTempTables

    public abstract java.util.ArrayList getUnSharableTempTables(org.eclipse.jface.text.IDocument document,
                                                                int offset)

  Gets non-sharable temp tables referenced in sp/trigger which have not been defined explicitly in sp/trigger,not in annotation.

  Parameters:
    `document` -
    `offset` -
  Returns:

### getReferencedTables

    public java.util.ArrayList getReferencedTables()

### addEntry

    public void addEntry(java.lang.Object t,
                         java.lang.String type)

### getEntries

    public java.lang.String[] getEntries(java.lang.String type)

  Parameters:
    `type` - defined in SQLParserConstants
  Returns: