FieldComparisons

FieldComparisons

Finds a function to be used for doing data comparisons. The WHERE condition needs to execute the exact same data comparison for all records, so there is no need to find (through the switch) what to execute for every record.

Constructor

new FieldComparisons()

Source:

Methods

(static) existsCondition(rightValue)

Description:
  • Test if input is not empty

Source:
Parameters:
Name Type Description
rightValue *

value to check if empty

Returns:
  • true if NOT empty

(static) getComparisonFunction(operator) → {function}

Description:
  • Returns a function to be used for data comparisons.

Source:
Parameters:
Name Type Description
operator String

SQL comparison operator.

Returns:

}}

Type
function

(static) inCondition(leftValue, rightValue) → {Boolean}

Description:
  • Check if leftValue is contained in list in rightValue

Source:
Parameters:
Name Type Description
leftValue any

value to find in right value

rightValue String

list of comma separated values

Returns:
  • Is contained IN list.
Type
Boolean

(static) isCondition(leftValue, rightValue) → {Boolean}

Description:
  • If leftValue is empty (we will consider that as NULL), condition will be true

Source:
Parameters:
Name Type Description
leftValue any

test this value for NULL

rightValue any

'NULL' considered as NULL.

Returns:
  • Is leftValue NULL (like).
Type
Boolean

(static) likeCondition(leftValue, rightValue) → {Boolean}

Description:
  • Compare strings in LIKE condition

Source:
Parameters:
Name Type Description
leftValue String

string for comparison

rightValue String

string with wildcard

Returns:
  • Do strings match?
Type
Boolean

(static) likeConditionMatch(leftValue, rightValue) → {Number}

Description:
  • Compare strings in (NOT) LIKE condition

Source:
Parameters:
Name Type Description
leftValue String

string for comparison

rightValue String

string with wildcard

Returns:
  • Found position (not found === -1)
Type
Number

(static) notLikeCondition(leftValue, rightValue) → {Boolean}

Description:
  • Compare strings in NOT LIKE condition

Source:
Parameters:
Name Type Description
leftValue String

string for comparison

rightValue String

string with wildcard

Returns:
  • Do strings NOT match?
Type
Boolean