db/query
Documentation
- source: db/query.ts
Overview
Classes
Query
execute()
Executes a standard SQL query with positional parameters. Parameters array supports primitives e.g. `[1, 'John', 34.56]` or objects in format either `{'type':'[DATA_TYPE]', 'value':[VALUE]}` or `{'name':'[string]', 'type':'[DATA_TYPE]', 'value':[VALUE]}` e.g. `[{'type':'CHAR', 'value':'ISBN19202323322'}]` or `[{'name': 'order_number', 'type':'CHAR', 'value':'ISBN19202323322'}]`
tsstatic execute(sql: string, parameters: any, datasourceName: string, formatting: FormattingParameter): void;
Parameter Type Description sqlstringThe SQL query to execute. parametersanyAn optional array of values (primitives, TypedQueryParameter or NamedQueryParameter objects) to replace '?' or :paramName placeholders. datasourceNamestringThe name of the database connection to use (optional). formattingFormattingParameterOptional formatting parameters for the result set (e.g., date format). Returns
- Type:
void- Description: An array of records representing the query results.
executeNamed()
Executes a SQL query with named parameters (e.g., ":name", ":id").
tsstatic executeNamed(sql: string, parameters: any, datasourceName: string): void;
Parameter Type Description sqlstringThe SQL query to execute. parametersanyAn optional array of NamedQueryParameter objects. datasourceNamestringThe name of the database connection to use (optional). Returns
- Type:
void- Description: An array of records representing the query results.
