diff options
| author | Daniel Theophanes <kardianos@gmail.com> | 2017-06-09 18:45:46 +0000 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2017-06-12 15:50:16 +0000 |
| commit | 3820191839a5b87acab5106b5fb43113d4f18b08 (patch) | |
| tree | 888b3a205de8546bd455ff0fef0dd7d560945983 /src/database/sql/sql.go | |
| parent | 0e9d293db773b443e1e37b7cfcb75a114989c041 (diff) | |
| download | go-3820191839a5b87acab5106b5fb43113d4f18b08.tar.xz | |
Revert "database/sql: Use Tx.ctx in Tx non-context methods"
This reverts commit ef0f7fb92b9458d7d35ee3c10ae853e3dc3077eb.
Reason for revert: Altered behavior of Queries prior to Tx commit. See #20631.
Change-Id: I2548507c2935a7c60b92aae377dcc8e9aca66331
Reviewed-on: https://go-review.googlesource.com/45231
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
Reviewed-by: Bulat Gaifullin <gaifullinbf@gmail.com>
Reviewed-by: Michael Hudson-Doyle <michael.hudson@canonical.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/database/sql/sql.go')
| -rw-r--r-- | src/database/sql/sql.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go index 011df41fdc..f7919f983c 100644 --- a/src/database/sql/sql.go +++ b/src/database/sql/sql.go @@ -1830,7 +1830,7 @@ func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error) { // // To use an existing prepared statement on this transaction, see Tx.Stmt. func (tx *Tx) Prepare(query string) (*Stmt, error) { - return tx.PrepareContext(tx.ctx, query) + return tx.PrepareContext(context.Background(), query) } // StmtContext returns a transaction-specific prepared statement from @@ -1928,7 +1928,7 @@ func (tx *Tx) StmtContext(ctx context.Context, stmt *Stmt) *Stmt { // The returned statement operates within the transaction and will be closed // when the transaction has been committed or rolled back. func (tx *Tx) Stmt(stmt *Stmt) *Stmt { - return tx.StmtContext(tx.ctx, stmt) + return tx.StmtContext(context.Background(), stmt) } // ExecContext executes a query that doesn't return rows. @@ -1947,7 +1947,7 @@ func (tx *Tx) ExecContext(ctx context.Context, query string, args ...interface{} // Exec executes a query that doesn't return rows. // For example: an INSERT and UPDATE. func (tx *Tx) Exec(query string, args ...interface{}) (Result, error) { - return tx.ExecContext(tx.ctx, query, args...) + return tx.ExecContext(context.Background(), query, args...) } // QueryContext executes a query that returns rows, typically a SELECT. @@ -1965,7 +1965,7 @@ func (tx *Tx) QueryContext(ctx context.Context, query string, args ...interface{ // Query executes a query that returns rows, typically a SELECT. func (tx *Tx) Query(query string, args ...interface{}) (*Rows, error) { - return tx.QueryContext(tx.ctx, query, args...) + return tx.QueryContext(context.Background(), query, args...) } // QueryRowContext executes a query that is expected to return at most one row. @@ -1980,7 +1980,7 @@ func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...interfa // QueryRow always returns a non-nil value. Errors are deferred until // Row's Scan method is called. func (tx *Tx) QueryRow(query string, args ...interface{}) *Row { - return tx.QueryRowContext(tx.ctx, query, args...) + return tx.QueryRowContext(context.Background(), query, args...) } // connStmt is a prepared statement on a particular connection. |
