Defined in: packages/core/src/transformers/QueryBuilder.ts:16
QueryBuilder provides static methods to build or convert various SQL query objects.
Methods
buildBinaryQuery()
static
buildBinaryQuery(queries
,operator
):BinarySelectQuery
Defined in: packages/core/src/transformers/QueryBuilder.ts:24
Builds a BinarySelectQuery by combining an array of SelectQuery using the specified operator. Throws if less than two queries are provided.
Parameters
queries
Array of SelectQuery to combine
operator
string
SQL operator to use (e.g. 'union', 'union all', 'intersect', 'except')
Returns
BinarySelectQuery
buildSimpleQuery()
static
buildSimpleQuery(query
):SimpleSelectQuery
Defined in: packages/core/src/transformers/QueryBuilder.ts:55
Converts a SELECT query to a standard SimpleSelectQuery form.
Parameters
query
The query to convert
Returns
A SimpleSelectQuery
buildCreateTableQuery()
static
buildCreateTableQuery(query
,tableName
,isTemporary
):CreateTableQuery
Defined in: packages/core/src/transformers/QueryBuilder.ts:212
Converts a SELECT query to a CREATE TABLE query (CREATE [TEMPORARY] TABLE ... AS SELECT ...)
Parameters
query
The SELECT query to use as the source
tableName
string
The name of the table to create
isTemporary
boolean
= false
If true, creates a temporary table
Returns
CreateTableQuery
A CreateTableQuery instance
buildInsertQuery()
static
buildInsertQuery(selectQuery
,tableName
):InsertQuery
Defined in: packages/core/src/transformers/QueryBuilder.ts:227
Converts a SELECT query to an INSERT query (INSERT INTO ... SELECT ...)
Parameters
selectQuery
The SELECT query to use as the source
tableName
string
The name of the table to insert into
Returns
An InsertQuery instance
buildUpdateQuery()
static
buildUpdateQuery(selectQuery
,selectSourceName
,updateTableExprRaw
,primaryKeys
):UpdateQuery
Defined in: packages/core/src/transformers/QueryBuilder.ts:261
Builds an UPDATE query from a SELECT query, table name, and primary key(s).
Parameters
selectQuery
The SELECT query providing new values (must select all columns to update and PKs)
selectSourceName
string
updateTableExprRaw
string
The table name to update
primaryKeys
The primary key column name(s)
string
| string
[]
Returns
UpdateQuery
UpdateQuery instance