TableExtract

TableExtract

Deals with extracting all TABLE names referenece inside SELECT.

Constructor

new TableExtract()

Source:

Methods

(static) extractAstTables(ast, tableSet)

Description:
  • Search for all referenced tables in SELECT.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT.

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getReferencedTableNames(statement) → {Array.<Array.<String>>}

Description:
  • Create table definition array from select string.

Source:
Parameters:
Name Type Description
statement String

full sql select statement.

Returns:
  • table definition array.
Type
Array.<Array.<String>>

(static) getReferencedTableNamesFromAst(ast) → {Array.<any>}

Description:
  • Create table definition array from select AST.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT.

Returns:
  • table definition array.
  • [0] - table name.
  • [1] - sheet tab name
  • [2] - cache seconds
  • [3] - output column title flag
Type
Array.<any>

(static) getTableNamesCorrelatedSelect(ast, tableSet)

Description:
  • Search CORRELATES sub-query for table names.

Source:
Parameters:
Name Type Description
ast *

AST to search

tableSet *

Function updates this map of table names and alias name.

(static) getTableNamesFrom(ast, tableSet)

Description:
  • Search for referenced table in FROM or JOIN part of select.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT.

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getTableNamesJoin(ast, tableSet)

Description:
  • Search for referenced table in FROM or JOIN part of select.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT.

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getTableNamesUnion(ast, tableSet)

Description:
  • Searches for table names within SELECT (union, intersect, except) statements.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getTableNamesWhereCondition(ast, tableSet)

Description:
  • Search for table references in the WHERE condition.

Source:
Parameters:
Name Type Description
ast Object

AST to search.

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getTableNamesWhereIn(ast, tableSet)

Description:
  • Searches for tables names within SELECT (in, exists) statements.

Source:
Parameters:
Name Type Description
ast Object

AST for SELECT

tableSet Map.<String, String>

Function updates this map of table names and alias name.

(static) getTableNamesWhereTerms(ast, tableSet)

Description:
  • Search WHERE to find referenced table names.

Source:
Parameters:
Name Type Description
ast Object

AST to search.

tableSet Map.<String, String>

Function updates this map of table names and alias name.