SelectKeywordAnalysis

SelectKeywordAnalysis

Analyze each distinct component of SELECT statement.

Constructor

new SelectKeywordAnalysis()

Source:

Methods

(static) EXCEPT(str) → {String}

Description:
  • Sql EXCEPT

Source:
Parameters:
Name Type Description
str String
Returns:
Type
String

(static) FROM(str) → {Object}

Description:
  • Sql FROM

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) FULL_JOIN(str) → {Object}

Description:
  • Sql FULL JOIN

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) GROUP_BY(str) → {Array.<Object>}

Description:
  • Sql GROUP BY

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Array.<Object>

(static) HAVING(str) → {Object}

Description:
  • Sql HAVING

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) INNER_JOIN(str) → {Object}

Description:
  • Sql INNER JOIN

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) INTERSECT(str) → {String}

Description:
  • Sql INTERSECT

Source:
Parameters:
Name Type Description
str String
Returns:
Type
String

(static) LEFT_JOIN(str) → {Object}

Description:
  • Sql LEFT JOIN

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) LIMIT(str) → {Object}

Description:
  • Sql LIMIT

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) ORDER_BY(str) → {Array.<Object>}

Description:
  • Sql ORDER BY

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Array.<Object>

(static) PIVOT(str) → {Array.<Object>}

Description:
  • Sql PIVOT

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Array.<Object>

(static) RIGHT_JOIN(str) → {Object}

Description:
  • Sql RIGHT JOIN

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) SELECT(str, isOrderBy) → {Array.<Object>}

Description:
  • Sql SELECT

Source:
Parameters:
Name Type Default Description
str String
isOrderBy Boolean false
Returns:
Type
Array.<Object>

(static) UNION(str) → {String}

Description:
  • Sql UNION

Source:
Parameters:
Name Type Description
str String
Returns:
Type
String

(static) UNION_ALL(str) → {String}

Description:
  • Sql UNION ALL

Source:
Parameters:
Name Type Description
str String
Returns:
Type
String

(static) WHERE(str) → {Object}

Description:
  • Sql WHERE

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) allJoins(str) → {Object}

Source:
Parameters:
Name Type Description
str String
Returns:
Type
Object

(static) analyze(itemName, part) → {any}

Source:
Parameters:
Name Type Description
itemName String
part Object
Returns:
Type
any

(static) extractSelectField(item, isOrderBy) → {Object}

Source:
Parameters:
Name Type Description
item String
isOrderBy Boolean
Returns:
Type
Object

(static) getNameAndAlias(item) → {Array.<String>}

Description:
  • If an ALIAS is specified after 'AS', return the field/table name and the alias.

Source:
Parameters:
Name Type Description
item String
Returns:

Two items: Real Name, Alias

Type
Array.<String>

(static) hideQuotedConstants(srcString, proFuncion) → {String}

Source:
Parameters:
Name Type Description
srcString String

Source string. Parse and convert any literal string constants in source.

proFuncion function

this function is performed on string literal constant.

Returns:
  • converted source string. If no literal constants found, original string is returned.
Type
String

(static) lastIndexOfOutsideLiteral(srcString, searchString) → {Number}

Description:
  • Search for last occurence of a string that is NOT inside a quoted string literal.

Source:
Parameters:
Name Type Description
srcString String

String to search

searchString String

String to find outside of a string constant. WARNING: If this search is SPACE(S), function will fail.

Returns:

-1 indicates search string not found. Otherwise it is start position of found string.

Type
Number

(static) parseForCorrelatedSubQuery(selectField) → {Object}

Description:
  • If we find 'SELECT ' within brackets, parse the string within brackets as a correlated sub-query.

Source:
Parameters:
Name Type Description
selectField String
Returns:
Type
Object

(static) protect_split(separator, str) → {Array.<String>}

Description:
  • Split a string using a separator, only if this separator isn't beetween brackets

Source:
Parameters:
Name Type Description
separator String
str String
Returns:
Type
Array.<String>

(static) trim(data) → {any}

Description:
  • Trim input if input is a string.

Source:
Parameters:
Name Type Description
data any

trim() if a string.

Returns:

Trimmed input OR original data if not a string.

Type
any