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)
| 1253 | // |
| 1254 | // [ResultReader] must be closed before [PgConn] can be used again. |
| 1255 | func (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 | // |
nothing calls this directly
no test coverage detected