(t *testing.T)
| 1274 | } |
| 1275 | |
| 1276 | func TestConnExecParamsMaxNumberOfParams(t *testing.T) { |
| 1277 | t.Parallel() |
| 1278 | |
| 1279 | ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second) |
| 1280 | defer cancel() |
| 1281 | |
| 1282 | pgConn, err := pgconn.Connect(ctx, os.Getenv("PGX_TEST_DATABASE")) |
| 1283 | require.NoError(t, err) |
| 1284 | defer closeConn(t, pgConn) |
| 1285 | |
| 1286 | paramCount := math.MaxUint16 |
| 1287 | params := make([]string, 0, paramCount) |
| 1288 | args := make([][]byte, 0, paramCount) |
| 1289 | for i := range paramCount { |
| 1290 | params = append(params, fmt.Sprintf("($%d::text)", i+1)) |
| 1291 | args = append(args, []byte(strconv.Itoa(i))) |
| 1292 | } |
| 1293 | sql := "values" + strings.Join(params, ", ") |
| 1294 | |
| 1295 | result := pgConn.ExecParams(ctx, sql, args, nil, nil, nil).Read() |
| 1296 | require.NoError(t, result.Err) |
| 1297 | require.Len(t, result.Rows, paramCount) |
| 1298 | |
| 1299 | ensureConnValid(t, pgConn) |
| 1300 | } |
| 1301 | |
| 1302 | func TestConnExecParamsTooManyParams(t *testing.T) { |
| 1303 | t.Parallel() |
nothing calls this directly
no test coverage detected