Private
appThe global application instance.
Protected
appGet the global Application.
Protected
containerGet the expression for the current timestamp as an escaped value.
raw('NOW()')
Escape the given value and return the query-safe equivalent.
Get the method with the given name from this class, bound to this class.
function
Get the method with the given name from this class, bound to this class.
function
Rest
...args: any[]Protected
makePrivate
mapGiven a table schema-builder, render an ALTER TABLE...
query.
Protected
renderProtected
Given a column-builder, render the SQL-definition as used in CREATE TABLE and ALTER TABLE statements.
Type serial
only exists on CREATE TABLE... queries
Given a table schema-builder, render a series of queries as a transaction that apply the given schema to database.
handle constraints better - ConstraintBuilder
Protected
renderProtected
Given a constraint schema-builder, render the constraint definition.
Given an array of Constraint objects, render them as WHERE-clause SQL in this dialect.
This function should escape the values before they are included in the query string.
dialect.renderConstraints([
{
field: 'id',
operator: '<',
operand: 44,
preop: 'AND',
},
{
field: 'id',
operator: '>',
operand: 30,
preop: 'AND',
},
]) // => 'id < 44 AND id > 30'
Wrap the given query string as a "SELECT ..." query that returns the number of rows matched by the original query string.
The resultant query should return the extollo_render_count
field with the
number of rows that the original query
would return.
Given an index schema-builder, render a CREATE INDEX...
query.
Given a table schema-builder, render a CREATE TABLE...
query.
Render the given query builder as a "DELETE ..." query string.
This function should escape the values before they are included in the query string.
Given a column schema-builder, render an ALTER TABLE... DROP COLUMN...
query.
Given an index schema-builder, render a DROP INDEX...
query.
Given a table schema-builder, render a DROP TABLE...
query.
Render the given query builder as a query that can be used to test if at least 1 row exists for the given builder.
The resultant query should return at least 1 row if that condition is met, and should return NO rows otherwise.
This function should escape the values before they are included in the query string.
The PostgreSQL dialect achieves this by removing the user-specified fields,
select-ing TRUE
, and applying LIMIT 1
to the query. This returns a single
row if the constraints have results, and nothing otherwise.
Protected
renderRender the fields from the builder class to PostgreSQL syntax.
Render the given query as an "INSERT ..." query string, inserting rows for the given data object(s).
This function should escape the values before they are included in the query string.
Render a query source object as a qualified table name string ("tablename" as "alias").
Given an index schema-builder, render either an ALTER INDEX...
query,
or a DROP INDEX...; CREATE INDEX...
query.
Given an index schema-builder, render an ALTER INDEX... RENAME...
query.
Render the given query builder as a "SELECT ..." query string.
This function should escape the values before they are included in the query string.
Render the table-column definitions for the table defined by the given schema-builder.
dialect.renderTableColumns(builder)
// => ['col1 varchar(100) NULL', 'col2 serial NOT NULL']
Given a series of fully-formed queries, render them as a single transaction.
const queries = [
'SELECT * FROM a',
'UPDATE b SET col = 123',
]
dialect.renderTransaction(queries)
// => 'BEGIN; SELECT * FROM a; UPDATE b SET col = 123; COMMIT;'
Render the given query builder as an "UPDATE ..." query string, setting the column values from the given data object.
This function should escape the values before they are included in the query string.
Render the "SET ... [field = value ...]" portion of the update query.
This function should escape the values before they are included in the query string.
dialect.renderUpdateSet({field1: 'value', field2: 45})
// => "SET field1 = 'value', field2 = 45"
Abstract class defining a particular dialect of SQL that is used to render query builders to strings of SQL of that dialect for execution by Connection instances.