MCPcopy
hub / github.com/jackc/pgx / Exec

Method Exec

pgxpool/pool.go:727–735  ·  view source on GitHub ↗

Exec acquires a connection from the [Pool] and executes the given SQL. SQL can be either a prepared statement name or an SQL string. Arguments should be referenced positionally from the SQL string as $1, $2, etc. The acquired connection is returned to the pool when the [Pool.Exec] function returns.

(ctx context.Context, sql string, arguments ...any)

Source from the content-addressed store, hash-verified

725// Arguments should be referenced positionally from the SQL string as $1, $2, etc.
726// The acquired connection is returned to the pool when the [Pool.Exec] function returns.
727func (p *Pool) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) {
728 c, err := p.Acquire(ctx)
729 if err != nil {
730 return pgconn.CommandTag{}, err
731 }
732 defer c.Release()
733
734 return c.Exec(ctx, sql, arguments...)
735}
736
737// Query acquires a connection and executes a query that returns [pgx.Rows].
738// Arguments should be referenced positionally from the SQL string as $1, $2, etc.

Callers

nothing calls this directly

Calls 3

AcquireMethod · 0.95
ReleaseMethod · 0.80
ExecMethod · 0.65

Tested by

no test coverage detected