mirror of
https://github.com/jackc/pgx.git
synced 2025-07-11 13:08:49 +00:00
Prepare takes context
Also remove PrepareEx. It's primary usage was for context. Supplying parameter OIDs is unnecessary when you can type cast in the query SQL. If it does become necessary or desirable to add options back it can be added in a backwards compatible way by adding a varargs as last argument.
This commit is contained in:
parent
78eda7d567
commit
6161728ff9
@ -70,7 +70,7 @@ func TestHstoreArrayTranscode(t *testing.T) {
|
||||
Status: pgtype.Present,
|
||||
}
|
||||
|
||||
ps, err := conn.Prepare("test", "select $1::hstore[]")
|
||||
ps, err := conn.Prepare(context.Background(), "test", "select $1::hstore[]")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ func TestRecordTranscode(t *testing.T) {
|
||||
|
||||
for i, tt := range tests {
|
||||
psName := fmt.Sprintf("test%d", i)
|
||||
ps, err := conn.Prepare(psName, tt.sql)
|
||||
ps, err := conn.Prepare(context.Background(), psName, tt.sql)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ func TestPgxSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values []
|
||||
conn := MustConnectPgx(t)
|
||||
defer MustCloseContext(t, conn)
|
||||
|
||||
_, err := conn.Prepare("test", fmt.Sprintf("select $1::%s", pgTypeName))
|
||||
_, err := conn.Prepare(context.Background(), "test", fmt.Sprintf("select $1::%s", pgTypeName))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -225,7 +225,7 @@ func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFun
|
||||
for i, tt := range tests {
|
||||
for _, fc := range formats {
|
||||
psName := fmt.Sprintf("test%d", i)
|
||||
ps, err := conn.Prepare(psName, tt.SQL)
|
||||
ps, err := conn.Prepare(context.Background(), psName, tt.SQL)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user