Skip to content

Latest commit

 

History

History
1979 lines (1279 loc) · 82.2 KB

File metadata and controls

1979 lines (1279 loc) · 82.2 KB

src/minisql/sql/binder.ml

Home · Files

Provides minisql sql binder facilities for this project.

Package: minisql.sql.binder

Reachable from entry: yes

Imports

Declarations

appendInformationColumn

function appendInformationColumn(columns, name, kind, nullable)

Appends one column definition to a virtual INFORMATION_SCHEMA table.

Parameter Type Default Description
columns dynamic columns value consumed by this operation.
name dynamic Name of the affected item.
kind dynamic kind value consumed by this operation.
nullable dynamic nullable value consumed by this operation.

View source

appendNamedSource

function appendNamedSource(sources, named, alias)

Appends named source using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.
named dynamic named value consumed by this operation.
alias dynamic alias value consumed by this operation.

View source

appendResolvedSource

function appendResolvedSource(sources, database, name, alias, availableQueries, viewStack)

Appends resolved source using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.
database dynamic database value consumed by this operation.
name dynamic Name of the affected item.
alias dynamic alias value consumed by this operation.
availableQueries dynamic availableQueries value consumed by this operation.
viewStack dynamic viewStack value consumed by this operation.

View source

appendSource

function appendSource(sources, table, alias)

Appends source using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.
table dynamic table value consumed by this operation.
alias dynamic alias value consumed by this operation.

View source

bindAggregate

function bindAggregate(expression, sources, database)

Binds aggregate using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindAlterTable

function bindAlterTable(statement, database)

Binds alter table using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindBetweenExpression

function bindBetweenExpression(expression, sources, allowAggregates, database)

Binds one BETWEEN predicate and validates both boundary types.

Parameter Type Default Description
expression dynamic BETWEEN expression node to bind.
sources dynamic Visible row sources for the operand and boundaries.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

bindBinaryExpression

function bindBinaryExpression(expression, sources, allowAggregates, database)

Binds a binary operator and computes its SQL result type.

Parameter Type Default Description
expression dynamic Binary expression node to bind.
sources dynamic Visible row sources for both operands.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

bindCaseExpression

function bindCaseExpression(expression, sources, allowAggregates, database)

Binds all CASE branches while deriving their common nullable result type.

Parameter Type Default Description
expression dynamic CASE expression node to bind.
sources dynamic Visible row sources for branch expressions.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

bindColumnSources

function bindColumnSources(expression, sources)

Binds column sources using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.

View source

bindConflictAssignments

function bindConflictAssignments(statement, table, sources)

Binds conflict assignments using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
table dynamic table value consumed by this operation.
sources dynamic sources value consumed by this operation.

View source

bindConflictExpression

function bindConflictExpression(expression, table, sources)

Binds conflict expression using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
table dynamic table value consumed by this operation.
sources dynamic sources value consumed by this operation.

View source

bindCreateIndex

function bindCreateIndex(statement, database)

Binds index columns and validates an optional immutable row predicate.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindCreateTable

function bindCreateTable(statement, database)

Binds create table using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindDelete

function bindDelete(statement, database)

Binds delete using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindDropIndex

function bindDropIndex(statement, database)

Binds DROP INDEX by resolving the database-wide index name to its owning table. Constraint-backed PRIMARY KEY and table-constraint UNIQUE indexes must be removed through ALTER TABLE DROP CONSTRAINT; explicitly created UNIQUE indexes remain DROP INDEX objects.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindDropTable

function bindDropTable(statement, database)

Binds drop table using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindExpression

function bindExpression(expression, table, alias)

Binds expression using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
table dynamic table value consumed by this operation.
alias dynamic alias value consumed by this operation.

View source

bindExpressionInternal

function bindExpressionInternal(expression, sources, allowAggregates, database)

Dispatches one AST expression to its node-specific binder.

Parameter Type Default Description
expression dynamic AST expression node to bind.
sources dynamic Visible row sources for name resolution.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

bindInExpression

function bindInExpression(expression, sources, allowAggregates, database)

Binds one IN-list predicate and verifies every candidate type.

Parameter Type Default Description
expression dynamic IN-list expression node to bind.
sources dynamic Visible row sources for operands and candidates.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

BINDING_ERROR

const BINDING_ERROR = 9020

Defines the binding error constant used by the minisql sql binder module.

View source

bindInsert

function bindInsert(statement, database)

Binds insert using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindInsertValue

function bindInsertValue(expression, targetType)

Binds insert value using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
targetType dynamic targetType value consumed by this operation.

View source

bindLiteral

function bindLiteral(expression)

Binds literal using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

bindReturning

function bindReturning(items, table)

Binds returning using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
items dynamic Items consumed or updated by the operation.
table dynamic table value consumed by this operation.

View source

bindScalarFunction

function bindScalarFunction(expression, sources, allowAggregates, database)

Binds scalar function using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.
allowAggregates dynamic allowAggregates value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindSelect

function bindSelect(statement, database)

Binds select using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindSelectInternal

function bindSelectInternal(statement, database, inheritedQueries, viewStack)

Binds select internal using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. May mutate supplied state as documented by the operation name.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.
inheritedQueries dynamic inheritedQueries value consumed by this operation.
viewStack dynamic viewStack value consumed by this operation.

View source

bindStatement

function bindStatement(statement, database)

Binds statement using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindSubqueryExpression

function bindSubqueryExpression(expression, sources, allowAggregates, database)

Binds a scalar, EXISTS, or IN subquery after masking correlated references.

Parameter Type Default Description
expression dynamic Subquery expression node to bind.
sources dynamic Visible outer sources that must not become correlations.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used to bind the nested SELECT.

View source

bindTruncate

function bindTruncate(statement, database)

Binds truncate using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindUnaryExpression

function bindUnaryExpression(expression, sources, allowAggregates, database)

Binds a unary operator, including the signed-literal minimum-value path.

Parameter Type Default Description
expression dynamic Unary expression node to bind.
sources dynamic Visible row sources for the operand.
allowAggregates dynamic Whether this clause permits aggregate expressions.
database dynamic Catalog handle used by nested expression binding.

View source

bindUpdate

function bindUpdate(statement, database)

Binds update using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindWhere

function bindWhere(expression, table, alias)

Binds where using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
table dynamic table value consumed by this operation.
alias dynamic alias value consumed by this operation.

View source

bindWhereSources

function bindWhereSources(expression, sources, operation, database)

Binds where sources using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.
operation dynamic operation value consumed by this operation.
database dynamic database value consumed by this operation.

View source

bindWindowExpression

function bindWindowExpression(expression, sources, database)

Binds one window expression and preserves its ordering metadata arrays.

Parameter Type Default Description
expression dynamic Window expression node to bind.
sources dynamic Visible row sources for columns and scalar expressions.
database dynamic Catalog handle used by nested expression binding.

View source

boundItemIndex

function boundItemIndex(items, expression)

Implements bound item index for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
items dynamic Items consumed or updated by the operation.
expression dynamic expression value consumed by this operation.

View source

componentName

function componentName()

Performs the componentName operation for the minisql sql binder module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

conflictBindingSources

function conflictBindingSources(table)

Implements conflict binding sources for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
table dynamic table value consumed by this operation.

View source

conflictConstraint

function conflictConstraint(database, table, target)

Implements conflict constraint for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
table dynamic table value consumed by this operation.
target dynamic target value consumed by this operation.

View source

constantSchemaExpression

function constantSchemaExpression(expression)

Implements constant schema expression for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

CONSTRAINT_VIOLATION

const CONSTRAINT_VIOLATION = 9021

Defines the constraint violation constant used by the minisql sql binder module.

View source

containsAggregateList

function containsAggregateList(items)

Returns whether the supplied value satisfies the aggregate list condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
items dynamic Items consumed or updated by the operation.

View source

crossJoinEqualityForSource

function crossJoinEqualityForSource(expression, source)

Finds one WHERE equality connecting a newly introduced CROSS/comma source to any source already present on its left. Only top-level AND conjuncts are eligible, so the equality may safely become the mandatory INNER-join edge.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
source dynamic source value consumed by this operation.

View source

decimalLiteralText

function decimalLiteralText(expression)

Implements decimal literal text for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

ensureBoolean

function ensureBoolean(expression, operation)

Ensures boolean using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

fail

function fail(code, operation, message)

Performs the fail operation for the minisql sql binder module. Returns its result or propagates a structured error from validation or a dependency. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
code dynamic code value consumed by this operation.
operation dynamic operation value consumed by this operation.
message dynamic Human-readable message associated with the operation.

View source

findBoundColumn

function findBoundColumn(sources, expression)

Finds bound column using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.
expression dynamic expression value consumed by this operation.

View source

findColumn

function findColumn(table, name)

Finds column using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
table dynamic table value consumed by this operation.
name dynamic Name of the affected item.

View source

findColumnIndex

function findColumnIndex(table, name)

Finds column index using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
table dynamic table value consumed by this operation.
name dynamic Name of the affected item.

View source

groupedExpressionSafe

function groupedExpressionSafe(expression, groups)

Implements grouped expression safe for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
groups dynamic groups value consumed by this operation.

View source

indexKeyAstDeterministic

function indexKeyAstDeterministic(expression)

Accepts scalar AST shapes whose value is stable for a stored row. This check runs before binding because CURRENT_TIMESTAMP otherwise becomes an ordinary literal and loses the information needed to reject the volatile source.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

indexKeyExpressionReferencesColumn

function indexKeyExpressionReferencesColumn(expression)

Requires at least one table column so constant scalar expressions cannot create a redundant index whose single key changes between rebuilds.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

indexKeyExpressionRoundTrips

function indexKeyExpressionRoundTrips(expression, boundExpression, table)

Verifies that canonical catalog SQL reparses to the same typed expression. Column-expression AST nodes intentionally store canonical names rather than quoting state, so an identifier that still needs quotes must be rejected before it could make persisted index metadata ambiguous after a restart.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
boundExpression dynamic boundExpression value consumed by this operation.
table dynamic table value consumed by this operation.

View source

indexKeyExpressionSafe

function indexKeyExpressionSafe(expression)

Combines reproducible scalar-shape and row-dependency validation.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

indexKeyExpressionShapeSafe

function indexKeyExpressionShapeSafe(expression)

Accepts the bound scalar shapes that the row evaluator can reproduce during inserts, updates, uniqueness checks, rebuilds, and index verification.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

indexPredicateSafe

function indexPredicateSafe(expression)

Accepts only immutable row-local expression nodes for partial indexes.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

INFORMATION_COLUMNS

const INFORMATION_COLUMNS = 3

Defines the information columns constant used by the minisql sql binder module.

View source

INFORMATION_ROUTINES

const INFORMATION_ROUTINES = 6

Defines the information routines constant used by the minisql sql binder module.

View source

INFORMATION_SCHEMATA

const INFORMATION_SCHEMATA = 1

Defines the information schemata constant used by the minisql sql binder module.

View source

INFORMATION_TABLE_CONSTRAINTS

const INFORMATION_TABLE_CONSTRAINTS = 4

Defines the information table constraints constant used by the minisql sql binder module.

View source

INFORMATION_TABLES

const INFORMATION_TABLES = 2

Defines the information tables constant used by the minisql sql binder module.

View source

INFORMATION_VIEWS

const INFORMATION_VIEWS = 5

Defines the information views constant used by the minisql sql binder module.

View source

informationSchemaTable

function informationSchemaTable(name)

Builds the stable SQL-visible shape for a supported INFORMATION_SCHEMA relation.

Parameter Type Default Description
name dynamic Name of the affected item.

View source

INVALID_ARGUMENT

const INVALID_ARGUMENT = 9001

Defines the invalid argument constant used by the minisql sql binder module.

View source

isAggregateName

function isAggregateName(name)

Returns whether the supplied value satisfies the aggregate name condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
name dynamic Name of the affected item.

View source

isBoundAlterTable

function isBoundAlterTable(value)

Returns whether the supplied value satisfies the bound alter table condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundCreateIndex

function isBoundCreateIndex(value)

Returns whether the supplied value satisfies the bound create index condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundCreateTable

function isBoundCreateTable(value)

Returns whether the supplied value satisfies the bound create table condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundDelete

function isBoundDelete(value)

Returns whether the supplied value satisfies the bound delete condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundDropTable

function isBoundDropTable(value)

Returns whether the supplied value satisfies the bound drop table condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundInformationSchemaSource

function isBoundInformationSchemaSource(value)

Returns whether a source is a virtual INFORMATION_SCHEMA metadata relation.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundInsert

function isBoundInsert(value)

Returns whether the supplied value satisfies the bound insert condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundJoin

function isBoundJoin(value)

Returns whether the supplied value satisfies the bound join condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundNamedQuery

function isBoundNamedQuery(value)

Returns whether the supplied value satisfies the bound named query condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundRecursiveQuery

function isBoundRecursiveQuery(value)

Returns whether a named query is an executable recursive fixpoint.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundRecursiveReference

function isBoundRecursiveReference(value)

Returns whether a source reads the current recursive working-table delta.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundReturningItem

function isBoundReturningItem(value)

Returns whether the supplied value satisfies the bound returning item condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundSelect

function isBoundSelect(value)

Returns whether the supplied value satisfies the bound select condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundSetOperation

function isBoundSetOperation(value)

Returns whether the supplied value satisfies the bound set operation condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundSource

function isBoundSource(value)

Returns whether the supplied value satisfies the bound source condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundTruncate

function isBoundTruncate(value)

Returns whether the supplied value satisfies the bound truncate condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isBoundUpdate

function isBoundUpdate(value)

Returns whether the supplied value satisfies the bound update condition. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

isImplemented

function isImplemented()

Returns whether implemented satisfies the condition required by the minisql sql binder module. Returns the computed value or operation status. Does not modify its inputs.

View source

isNullBoundLiteral

function isNullBoundLiteral(expression)

Returns whether the supplied value satisfies the null bound literal condition. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Does not modify its inputs.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source

isScalarFunctionName

function isScalarFunctionName(name)

Returns whether the name belongs to the built-in scalar function library.

Parameter Type Default Description
name dynamic Name of the affected item.

View source

isWindowAggregateName

function isWindowAggregateName(name)

Returns whether the named aggregate is supported as a window aggregate.

Parameter Type Default Description
name dynamic Name of the affected item.

View source

literalType

function literalType(value)

Implements literal type for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
value dynamic Value consumed or transformed by the operation.

View source

maskOuterColumn

function maskOuterColumn(expression, sources, statement)

Replaces an explicitly qualified outer-column reference with a typed NULL. The placeholder lets the ordinary nested-query binder infer and validate its output shape without depending on a concrete outer row.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.
statement dynamic statement value consumed by this operation.

View source

maskOuterExpression

function maskOuterExpression(expression, sources, statement)

Recursively masks outer references throughout one nested expression tree.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
sources dynamic sources value consumed by this operation.
statement dynamic statement value consumed by this operation.

View source

maskOuterSelect

function maskOuterSelect(statement, sources)

Copies a nested SELECT while replacing only references resolved against outer sources.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
sources dynamic sources value consumed by this operation.

View source

mergeConcreteTypes

function mergeConcreteTypes(left, right)

Implements merge concrete types for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
left dynamic left value consumed by this operation.
right dynamic right value consumed by this operation.

View source

mergeResultType

function mergeResultType(currentType, hasConcrete, nextExpression)

Implements merge result type for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
currentType dynamic currentType value consumed by this operation.
hasConcrete dynamic hasConcrete value consumed by this operation.
nextExpression dynamic nextExpression value consumed by this operation.

View source

namedQueryIndex

function namedQueryIndex(availableQueries, name)

Implements named query index for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
availableQueries dynamic availableQueries value consumed by this operation.
name dynamic Name of the affected item.

View source

namesContain

function namesContain(names, value)

Implements names contain for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
names dynamic names value consumed by this operation.
value dynamic Value consumed or transformed by the operation.

View source

OBJECT_NOT_FOUND

const OBJECT_NOT_FOUND = 9014

Defines the object not found constant used by the minisql sql binder module.

View source

objectLocalName

function objectLocalName(name)

Returns the unqualified component of a canonical schema-qualified object name.

Parameter Type Default Description
name dynamic Name of the affected item.

View source

parseSingleSelect

function parseSingleSelect(sqlText, operation)

Parses single select using the supplied inputs. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sqlText dynamic sqlText value consumed by this operation.
operation dynamic operation value consumed by this operation.

View source

promoteCrossJoinEqualities

function promoteCrossJoinEqualities(joins, whereExpression)

Promotes a WHERE-restricted cartesian edge to an INNER equality edge so the existing hash/index join cost model avoids materializing the full product. The returned pair contains the promoted joins and the residual WHERE tree; consumed equalities are enforced by the join and must not be evaluated twice.

Parameter Type Default Description
joins dynamic joins value consumed by this operation.
whereExpression dynamic whereExpression value consumed by this operation.

View source

removeBoundConjunct

function removeBoundConjunct(expression, target)

Removes every exact occurrence of one guaranteed conjunct from an AND tree. Rebuilding only affected branches preserves every unrelated predicate and its SQL three-valued evaluation semantics.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
target dynamic target value consumed by this operation.

View source

resolveInsertColumns

function resolveInsertColumns(statement, table)

Implements resolve insert columns for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
table dynamic table value consumed by this operation.

View source

resolveNamedQuery

function resolveNamedQuery(database, name, availableQueries, viewStack)

Implements resolve named query for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
database dynamic database value consumed by this operation.
name dynamic Name of the affected item.
availableQueries dynamic availableQueries value consumed by this operation.
viewStack dynamic viewStack value consumed by this operation.

View source

resultTypeWithNullability

function resultTypeWithNullability(typeInfo, nullable)

Implements result type with nullability for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
typeInfo dynamic typeInfo value consumed by this operation.
nullable dynamic nullable value consumed by this operation.

View source

rewriteConflictExpression

function rewriteConflictExpression(expression, targetName)

Rewrites conflict expression using the supplied inputs. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.
targetName dynamic targetName value consumed by this operation.

View source

sameNameArray

function sameNameArray(left, right)

Implements same name array for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
left dynamic left value consumed by this operation.
right dynamic right value consumed by this operation.

View source

schemaPreservingRename

function schemaPreservingRename(currentName, newLocalName)

Keeps an unqualified ALTER TABLE rename inside the table's current schema.

Parameter Type Default Description
currentName dynamic currentName value consumed by this operation.
newLocalName dynamic newLocalName value consumed by this operation.

View source

selectDeclaresQualifier

function selectDeclaresQualifier(statement, qualifier)

Returns true when a qualifier belongs to a source declared by this nested SELECT. Such names shadow outer aliases and must remain ordinary inner-column references.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
qualifier dynamic qualifier value consumed by this operation.

View source

selectReferencesSource

function selectReferencesSource(statement, name)

Returns true when a SELECT tree names a candidate recursive working table.

Parameter Type Default Description
statement dynamic statement value consumed by this operation.
name dynamic Name of the affected item.

View source

sourceTypes

function sourceTypes(sources)

Implements source types for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.

View source

sourceVisibleName

function sourceVisibleName(source)

Implements source visible name for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
source dynamic source value consumed by this operation.

View source

sourceWidth

function sourceWidth(sources)

Implements source width for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
sources dynamic sources value consumed by this operation.

View source

stringArrayContains

function stringArrayContains(values, name)

Returns whether a string array contains the requested column name.

Parameter Type Default Description
values dynamic values value consumed by this operation.
name dynamic Name of the affected item.

View source

tableForQuery

function tableForQuery(name, bound, explicitNames)

Implements table for query for this module. Requires arguments that satisfy the validation performed below. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
name dynamic Name of the affected item.
bound dynamic bound value consumed by this operation.
explicitNames dynamic explicitNames value consumed by this operation.

View source

targetMilestone

function targetMilestone()

Performs the targetMilestone operation for the minisql sql binder module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

View source

TYPE_MISMATCH

const TYPE_MISMATCH = 9017

Defines the type mismatch constant used by the minisql sql binder module.

View source

UNSUPPORTED_SQL

const UNSUPPORTED_SQL = 9025

Defines the unsupported sql constant used by the minisql sql binder module.

View source

validateWindowArguments

function validateWindowArguments(name, ranking, countStar, arguments)

Validates the arity and types required by one supported window function.

Parameter Type Default Description
name dynamic Normalized window-function name.
ranking dynamic Whether the function belongs to the ranking family.
countStar dynamic Whether the function represents COUNT(*).
arguments dynamic Bound window-function arguments.

View source

windowTopLevelSafe

function windowTopLevelSafe(expression)

Implements window top level safe for this module. Returns the computed value or operation status. Any side effects are limited to the explicitly invoked dependencies.

Parameter Type Default Description
expression dynamic expression value consumed by this operation.

View source