Home / Function/ execute() — drizzle-orm Function Reference

execute() — drizzle-orm Function Reference

Architecture documentation for the execute() function in db.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  0a6826ec_d3e6_da20_68f4_2ee2bebd305d["execute()"]
  7b170b6b_8109_4580_dc12_4da0d59d8d8d["PgDatabase"]
  0a6826ec_d3e6_da20_68f4_2ee2bebd305d -->|defined in| 7b170b6b_8109_4580_dc12_4da0d59d8d8d
  99f2c80b_960e_3f9d_a9fe_c8c1b4967d81["withReplicas()"]
  99f2c80b_960e_3f9d_a9fe_c8c1b4967d81 -->|calls| 0a6826ec_d3e6_da20_68f4_2ee2bebd305d
  5dd36ef9_8a2d_412a_8ed0_0808a622fa34["execute()"]
  0a6826ec_d3e6_da20_68f4_2ee2bebd305d -->|calls| 5dd36ef9_8a2d_412a_8ed0_0808a622fa34
  81878863_fd6d_6366_1fb8_8798e3a5c9cb["mapResult()"]
  0a6826ec_d3e6_da20_68f4_2ee2bebd305d -->|calls| 81878863_fd6d_6366_1fb8_8798e3a5c9cb
  3a239526_4d6f_6197_9901_ab0e6dd8caff["getSQL()"]
  0a6826ec_d3e6_da20_68f4_2ee2bebd305d -->|calls| 3a239526_4d6f_6197_9901_ab0e6dd8caff
  style 0a6826ec_d3e6_da20_68f4_2ee2bebd305d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/pg-core/db.ts lines 615–634

	execute<TRow extends Record<string, unknown> = Record<string, unknown>>(
		query: SQLWrapper | string,
	): PgRaw<PgQueryResultKind<TQueryResult, TRow>> {
		const sequel = typeof query === 'string' ? sql.raw(query) : query.getSQL();
		const builtQuery = this.dialect.sqlToQuery(sequel);
		const prepared = this.session.prepareQuery<
			PreparedQueryConfig & { execute: PgQueryResultKind<TQueryResult, TRow> }
		>(
			builtQuery,
			undefined,
			undefined,
			false,
		);
		return new PgRaw(
			() => prepared.execute(undefined, this.authToken),
			sequel,
			builtQuery,
			(result) => prepared.mapResult(result, true),
		);
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does execute() do?
execute() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/db.ts.
Where is execute() defined?
execute() is defined in drizzle-orm/src/pg-core/db.ts at line 615.
What does execute() call?
execute() calls 3 function(s): execute, getSQL, mapResult.
What calls execute()?
execute() is called by 1 function(s): withReplicas.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free