Tx prepare/preparex

pull/146/head
William King 2016-05-18 15:05:32 -07:00
parent 2ba5bb405b
commit 682e688c5b
1 changed files with 18 additions and 0 deletions

18
tx.go
View File

@ -127,6 +127,24 @@ func (tx *Tx) Exec(sql string, arguments ...interface{}) (commandTag CommandTag,
return tx.conn.Exec(sql, arguments...)
}
// Prepare delegates to the underlying *Conn
func (tx *Tx) Prepare(name, sql string) (*PreparedStatement, error) {
if tx.status != TxStatusInProgress {
return nil, ErrTxClosed
}
return tx.conn.Prepare(name, sql)
}
// Prepare delegates to the underlying *Conn
func (tx *Tx) Preparex(name, sql string, opts PreparexOptions) (*PreparedStatement, error) {
if tx.status != TxStatusInProgress {
return nil, ErrTxClosed
}
return tx.conn.Preparex(name, sql, opts)
}
// Query delegates to the underlying *Conn
func (tx *Tx) Query(sql string, args ...interface{}) (*Rows, error) {
if tx.status != TxStatusInProgress {