2
0

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:
Jack Christensen
2019-04-20 11:47:16 -05:00
parent dc699cefc7
commit 66625e6489
11 changed files with 25 additions and 82 deletions
+2 -7
View File
@@ -158,17 +158,12 @@ func (tx *Tx) Exec(ctx context.Context, sql string, arguments ...interface{}) (c
}
// Prepare delegates to the underlying *Conn
func (tx *Tx) Prepare(name, sql string) (*PreparedStatement, error) {
return tx.PrepareEx(context.Background(), name, sql, nil)
}
// PrepareEx delegates to the underlying *Conn
func (tx *Tx) PrepareEx(ctx context.Context, name, sql string, opts *PrepareExOptions) (*PreparedStatement, error) {
func (tx *Tx) Prepare(ctx context.Context, name, sql string) (*PreparedStatement, error) {
if tx.status != TxStatusInProgress {
return nil, ErrTxClosed
}
return tx.conn.PrepareEx(ctx, name, sql, opts)
return tx.conn.Prepare(ctx, name, sql)
}
// Query delegates to the underlying *Conn