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.
non-blocking
Jack Christensen 2019-04-20 11:47:16 -05:00
parent 78eda7d567
commit 6161728ff9
3 changed files with 4 additions and 4 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)
}