aboutsummaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
authorapocelipes <seve3r@outlook.com>2024-05-14 09:42:57 +0000
committerGopher Robot <gobot@golang.org>2024-05-14 20:18:21 +0000
commit1f6a983baf4b9a636e9e4bbd827fcb4d6ef4ebe0 (patch)
tree0c351243d1cbe44a4f6e286771c5df0ca36442f6 /src/database
parentc7597a8d23ff2124c3de1dfc8f26b29a203cdf10 (diff)
downloadgo-1f6a983baf4b9a636e9e4bbd827fcb4d6ef4ebe0.tar.gz
go-1f6a983baf4b9a636e9e4bbd827fcb4d6ef4ebe0.zip
database/sql: reordering fields to reduce struct sizes
There are 16 bytes reduced. Change-Id: I33ca96fd22002b3111f0462c3029d70df48adb6e GitHub-Last-Rev: 8df56a9655ef261be3ff9403491cbbe1ebda1ec0 GitHub-Pull-Request: golang/go#67055 Reviewed-on: https://go-review.googlesource.com/c/go/+/581935 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/database')
-rw-r--r--src/database/sql/sql.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/database/sql/sql.go b/src/database/sql/sql.go
index fdbe4b2172..9373aa1c58 100644
--- a/src/database/sql/sql.go
+++ b/src/database/sql/sql.go
@@ -551,9 +551,9 @@ type driverConn struct {
// guarded by db.mu
inUse bool
+ dbmuClosed bool // same as closed, but guarded by db.mu, for removeClosedStmtLocked
returnedAt time.Time // Time the connection was created or returned.
onPut []func() // code (with db.mu held) run when conn is next returned
- dbmuClosed bool // same as closed, but guarded by db.mu, for removeClosedStmtLocked
}
func (dc *driverConn) releaseConn(err error) {
@@ -2923,19 +2923,8 @@ type Rows struct {
//
// closemu guards lasterr and closed.
closemu sync.RWMutex
- closed bool
lasterr error // non-nil only if closed is true
-
- // lastcols is only used in Scan, Next, and NextResultSet which are expected
- // not to be called concurrently.
- lastcols []driver.Value
-
- // raw is a buffer for RawBytes that persists between Scan calls.
- // This is used when the driver returns a mismatched type that requires
- // a cloning allocation. For example, if the driver returns a *string and
- // the user is scanning into a *RawBytes, we need to copy the string.
- // The raw buffer here lets us reuse the memory for that copy across Scan calls.
- raw []byte
+ closed bool
// closemuScanHold is whether the previous call to Scan kept closemu RLock'ed
// without unlocking it. It does that when the user passes a *RawBytes scan
@@ -2951,6 +2940,17 @@ type Rows struct {
// returning. It's only used by Next and Err which are
// expected not to be called concurrently.
hitEOF bool
+
+ // lastcols is only used in Scan, Next, and NextResultSet which are expected
+ // not to be called concurrently.
+ lastcols []driver.Value
+
+ // raw is a buffer for RawBytes that persists between Scan calls.
+ // This is used when the driver returns a mismatched type that requires
+ // a cloning allocation. For example, if the driver returns a *string and
+ // the user is scanning into a *RawBytes, we need to copy the string.
+ // The raw buffer here lets us reuse the memory for that copy across Scan calls.
+ raw []byte
}
// lasterrOrErrLocked returns either lasterr or the provided err.