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

Method ExecParams

pgconn/pgconn.go:1255–1267  ·  view source on GitHub ↗

ExecParams executes a command via the PostgreSQL extended query protocol. sql is a SQL command string. It may only contain one query. Parameter substitution is positional using $1, $2, $3, etc. paramValues are the parameter values. It must be encoded in the format given by paramFormats. paramOIDs

(ctx context.Context, sql string, paramValues [][]byte, paramOIDs []uint32, paramFormats, resultFormats []int16)

Source from the content-addressed store, hash-verified

1253//
1254// [ResultReader] must be closed before [PgConn] can be used again.
1255func (pgConn *PgConn) ExecParams(ctx context.Context, sql string, paramValues [][]byte, paramOIDs []uint32, paramFormats, resultFormats []int16) *ResultReader {
1256 result := pgConn.execExtendedPrefix(ctx, paramValues)
1257 if result.closed {
1258 return result
1259 }
1260
1261 pgConn.frontend.SendParse(&pgproto3.Parse{Query: sql, ParameterOIDs: paramOIDs})
1262 pgConn.frontend.SendBind(&pgproto3.Bind{ParameterFormatCodes: paramFormats, Parameters: paramValues, ResultFormatCodes: resultFormats})
1263
1264 pgConn.execExtendedSuffix(result, nil, nil)
1265
1266 return result
1267}
1268
1269// ExecPrepared enqueues the execution of a prepared statement via the PostgreSQL extended query protocol.
1270//

Callers

nothing calls this directly

Calls 4

execExtendedPrefixMethod · 0.95
execExtendedSuffixMethod · 0.95
SendParseMethod · 0.80
SendBindMethod · 0.80

Tested by

no test coverage detected