diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2013-03-18 15:54:22 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2013-03-18 15:54:22 -0700 |
| commit | 646e54106d915b7305f327849e61ef8100d6fa39 (patch) | |
| tree | cb65454144e2a564190498e5218fe54acaefdbdc /src/pkg/database/sql | |
| parent | 3a2fe62f44a8a8513a087f75798425db7f9cc7bd (diff) | |
| download | go-646e54106d915b7305f327849e61ef8100d6fa39.tar.xz | |
database/sql: doc cleanup on the DB type
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7865044
Diffstat (limited to 'src/pkg/database/sql')
| -rw-r--r-- | src/pkg/database/sql/sql.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go index 8c6ffbc700..bc92ecd8e6 100644 --- a/src/pkg/database/sql/sql.go +++ b/src/pkg/database/sql/sql.go @@ -177,15 +177,14 @@ var ErrNoRows = errors.New("sql: no rows in result set") // DB is a database handle. It's safe for concurrent use by multiple // goroutines. // -// If the underlying database driver has the concept of a connection -// and per-connection session state, the sql package manages creating -// and freeing connections automatically, including maintaining a free -// pool of idle connections. If observing session state is required, -// either do not share a *DB between multiple concurrent goroutines or -// create and observe all state only within a transaction. Once -// DB.Open is called, the returned Tx is bound to a single isolated -// connection. Once Tx.Commit or Tx.Rollback is called, that -// connection is returned to DB's idle connection pool. +// The sql package creates and frees connections automatically; it +// also maintains a free pool of idle connections. If the database has +// a concept of per-connection state, such state can only be reliably +// observed within a transaction. Once DB.Begin is called, the +// returned Tx is bound to a single connection. Once Commit or +// Rollback is called on the transaction, that transaction's +// connection is returned to DB's idle connection pool. The pool size +// can be controlled with SetMaxIdleConns. type DB struct { driver driver.Driver dsn string |
