(
query: string | NativeQueryBuilder | RawQueryFragment,
params: readonly unknown[] = [],
)
| 265 | } |
| 266 | |
| 267 | private prepareQuery( |
| 268 | query: string | NativeQueryBuilder | RawQueryFragment, |
| 269 | params: readonly unknown[] = [], |
| 270 | ): { query: string; params: readonly unknown[]; formatted: string } { |
| 271 | if (query instanceof NativeQueryBuilder) { |
| 272 | query = query.toRaw(); |
| 273 | } |
| 274 | |
| 275 | if (isRaw(query)) { |
| 276 | params = query.params; |
| 277 | query = query.sql; |
| 278 | } |
| 279 | |
| 280 | query = this.config.get('onQuery')(query, params); |
| 281 | const formatted = this.platform.formatQuery(query, params); |
| 282 | |
| 283 | return { query, params, formatted }; |
| 284 | } |
| 285 | |
| 286 | /** Executes a SQL query and returns the result based on the method: `'all'` for rows, `'get'` for single row, `'run'` for affected count. */ |
| 287 | async execute<T extends QueryResult | EntityData<AnyEntity> | EntityData<AnyEntity>[] = EntityData<AnyEntity>[]>( |
nothing calls this directly
no test coverage detected