$ open source · GPL-3.0 — need a commercial license? imqueue.com →

BaseModel.getViewDefinition() method

This view's SQL, with any dynamic parameters substituted in.

Signature:

static getViewDefinition(viewParams?: ViewParams, asQuery?: boolean): string;

Parameters

Parameter

Type

Description

viewParams

ViewParams

(Optional) Values overriding the decorated defaults.

asQuery

boolean

(Optional) Strips the leading create-view clause, leaving a statement that can be embedded as a subquery. This is how a dynamic view is spliced into a FROM or a join.

Returns:

string

The definition, whitespace-normalised and ending in a semicolon.

Remarks

Parameters are merged in two layers: the defaults given to DynamicView, then whatever is passed here. Each @{name} placeholder in the definition is replaced with the escaped value, which is what makes it safe to pass a caller's input — though only numbers and strings render as values, and everything else, including a missing parameter, becomes NULL.