Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 445cd73

Browse files
committed
Minor tweaks
1 parent e7683d6 commit 445cd73

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

modifying.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ can call on the database itself, such as `Query()` and so forth.
7474

7575
Prepared statements that are created in a transaction are bound exclusively to
7676
that transaction, and can't be used outside of it. Likewise, prepared statements
77-
created only on a database handle can't be used within a transaction. In order to
78-
use a Prepared statement prepared outside the transaction, use `Tx.Stmt()`.
77+
created only on a database handle can't be used within a transaction. To
78+
use a prepared statement prepared outside the transaction, use `Tx.Stmt()`,
79+
which will create a new transaction-specific statement from the one prepared
80+
outside the transaction.
7981

8082
You should not mingle the use of transaction-related functions such as `Begin()`
8183
and `Commit()` with SQL statements such as `BEGIN` and `COMMIT` in your SQL

retrieving.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ defer rows.Close()
112112
for rows.Next() {
113113
// ...
114114
}
115+
if err = rows.Err(); err != nil {
116+
log.Fatal(err)
117+
}
115118
</pre>
116119

117120
Under the hood, `db.Query()` actually prepares, executes, and closes a prepared

surprises.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Prepared Statements in Transactions
123123
===================================
124124

125125
Caution must be exercised when working with prepared statements in
126-
transactions. Consider the following example:
126+
transactions. Consider the following example:
127127

128128
<pre class="prettyprint lang-go">
129129
tx, err := db.Begin()
@@ -157,5 +157,8 @@ underlying connection, rendering the connection state inconsistent.
157157
you should make sure the statement is always closed before the transaction is
158158
committed or rolled back.
159159

160+
This is a [known issue](https://code.google.com/p/go/issues/detail?id=4459) that
161+
will probably be fixed in Go 1.4 by [CR 131650043](https://codereview.appspot.com/131650043).
162+
160163
**Previous: [The Connection Pool](connection-pool.html)**
161164
**Next: [Related Reading and Resources](references.html)**

0 commit comments

Comments
 (0)