Class: BasicDBDriver

x2node-dbos~ BasicDBDriver

SQL database driver base class.

<abstract> new BasicDBDriver()

Implements:

Methods


booleanLiteral(val)

Get Boolean SQL literal.
Parameters:
Name Type Description
val * The ES value.
Implements:
Returns:
String representing Boolean true or false in SQL.
Type
string

booleanToNull(expr)

Make SQL expression that evaluates the specified SQL expression and resolves into SQL TRUE or SQL NULL if the result is true or false respectively.
Parameters:
Name Type Description
expr string The Boolean SQL expression to evaluate.
Implements:
Returns:
SQL expression that evaluates to TRUE or NULL.
Type
string

coalesce(exprs)

Make SQL expression that evaluates to the result of the first of the specified SQL expressions that is not NULL, or NULL if all evaluate to NULL.
Parameters:
Name Type Argument Description
exprs string <repeatable>
SQL expressions to evaluate.
Implements:
Returns:
SQL expression that evaluates to the first non-NULL.
Type
string

safeLabel(label)

Get SQL fragment that can be used as a column label in a SELECT clause from the specified string.
Parameters:
Name Type Description
label string The ES string to use as a column label.
Implements:
Returns:
SQL fragment for the label.
Type
string

safeLikePatternFromString(str)

Make necessary escapes in the specified string to make it safe to use as a SQL LIKE condition pattern.
Parameters:
Name Type Description
str string The ES string to make safe to use as a pattern.
Implements:
Returns:
The string with all the necessary escapes.
Type
string

sql(val)

Get SQL for the specified ES value.
Parameters:
Name Type Description
val * The ES value. If object, toString() is called on it and the result is returned as is. If null, string "NULL" is returned.
Implements:
Returns:
String representing the value in SQL, or null if the value cannot be represented in SQL (includes undefined, NaN, Infinity and arrays).
Type
string

stringLeftPad(expr, width, pad)

Make SQL expression that pads the specified string SQL expression with the specified character on the left until the specified length is achieved.
Parameters:
Name Type Description
expr string The string SQL expression.
width number Minimum resulting string length to achieve with padding.
pad string The character to use as the padding.
Implements:
Returns:
SQL expression that pads the string on the left.
Type
string

stringLength(expr)

Make SQL expression that gets the string length for the specified string SQL expression.
Parameters:
Name Type Description
expr string The string SQL expression.
Implements:
Returns:
SQL expression that gets the string length.
Type
string

stringLiteral(val)

Get string SQL literal.
Parameters:
Name Type Description
val string The ES string.
Implements:
Returns:
String representing the string in SQL.
Type
string

stringLowercase(expr)

Make SQL expression that converts the specified string SQL expression to lower case.
Parameters:
Name Type Description
expr string The string SQL expression.
Implements:
Returns:
SQL expression that converts the string to lower case.
Type
string

stringUppercase(expr)

Make SQL expression that converts the specified string SQL expression to upper case.
Parameters:
Name Type Description
expr string The string SQL expression.
Implements:
Returns:
SQL expression that converts the string to upper case.
Type
string