TableAlias

TableAlias

Deals with the table ALIAS inside select AST.

Constructor

new TableAlias()

Source:

Methods

(static) getTableAlias(tableName, ast) → {String}

Description:
  • Find table alias name (if any) for input actual table name.

Source:
Parameters:
Name Type Description
tableName String

Actual table name.

ast Object

Abstract Syntax Tree for SQL.

Returns:
  • Table alias. Empty string if not found.
Type
String

(static) getTableAliasFromJoin(tableAlias, tableName, ast) → {String}

Description:
  • Searches the FROM and JOIN components of a SELECT to find the table alias.

Source:
Parameters:
Name Type Description
tableAlias String

Default alias name

tableName String

table name to search for.

ast Object

Abstract Syntax Tree to search

Returns:
  • Table alias name.
Type
String

(static) getTableAliasUnion(tableAlias, tableName, ast) → {String}

Description:
  • Searches the UNION portion of the SELECT to locate the table alias.

Source:
Parameters:
Name Type Description
tableAlias String

default table alias.

tableName String

table name to search for.

ast Object

Abstract Syntax Tree to search

Returns:
  • table alias
Type
String

(static) getTableAliasWhereIn(tableAlias, tableName, ast) → {String}

Description:
  • Search WHERE IN component of SELECT to find table alias.

Source:
Parameters:
Name Type Description
tableAlias String

default table alias

tableName String

table name to search for

ast Object

Abstract Syntax Tree to search

Returns:
  • table alias
Type
String

(static) getTableAliasWhereTerms(tableAlias, tableName, ast) → {String}

Description:
  • Search WHERE terms of SELECT to find table alias.

Source:
Parameters:
Name Type Description
tableAlias String

default table alias

tableName String

table name to search for.

ast Object

Abstract Syntax Tree to search.

Returns:
  • table alias
Type
String

(static) isIterable(input) → {Boolean}

Description:
  • Check if input is iterable.

Source:
Parameters:
Name Type Description
input any

Check this object to see if it can be iterated.

Returns:
  • true - can be iterated. false - cannot be iterated.
Type
Boolean

(static) locateAstTableAlias(tableName, ast, astBlock) → {String}

Description:
  • Search a property of AST for table alias name.

Source:
Parameters:
Name Type Description
tableName String

Table name to find in AST.

ast Object

AST of SELECT.

astBlock String

AST property to search.

Returns:
  • Alias name or "" if not found.
Type
String

(static) setTableAlias(tables, ast)

Description:
  • Updates 'tables' with associated table ALIAS name found in ast.

Source:
Parameters:
Name Type Description
tables Map.<String, Table>
ast Object