Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1031)

Issue 17580043: database/sql: Add optional ColumnsCounter interface

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years ago by julienschmidt
Modified:
10 years, 10 months ago
Reviewers:
ahormann, golang-dev
Visibility:
Public.

Description

database/sql: Add optional ColumnsCounter interface Creating a slice of all column names is expensive, since it requires allocations and, depending on the driver, maybe even additional network activity. Therefore rows.Columns should not be used just to get the length of the slice. ColumnsCounter adds an optional cheaper way, since getting the number of columns is often much cheaper.

Patch Set 1 #

Patch Set 2 : diff -r f9af8b83c78c https://code.google.com/p/go #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+14 lines, -1 line) Patch
M src/pkg/database/sql/driver/driver.go View 1 1 chunk +9 lines, -0 lines 1 comment Download
M src/pkg/database/sql/sql.go View 1 1 chunk +5 lines, -1 line 0 comments Download

Messages

Total messages: 4
julienschmidt
10 years, 10 months ago (2013-12-17 11:26:55 UTC) #1
ahormann
LGTM https://codereview.appspot.com/17580043/diff/20001/src/pkg/database/sql/driver/driver.go File src/pkg/database/sql/driver/driver.go (right): https://codereview.appspot.com/17580043/diff/20001/src/pkg/database/sql/driver/driver.go#newcode181 src/pkg/database/sql/driver/driver.go:181: type ColumnsCounter interface { I'd name it NumColumns ...
10 years, 10 months ago (2013-12-17 15:01:20 UTC) #2
julienschmidt
On 2013/12/17 15:01:20, ahormann wrote: > LGTM > > https://codereview.appspot.com/17580043/diff/20001/src/pkg/database/sql/driver/driver.go > File src/pkg/database/sql/driver/driver.go (right): > ...
10 years, 10 months ago (2013-12-17 16:44:53 UTC) #3
ahormann
10 years, 10 months ago (2013-12-17 16:48:04 UTC) #4
On 2013/12/17 16:44:53, julienschmidt wrote:
> On 2013/12/17 15:01:20, ahormann wrote:
> > LGTM
> > 
> >
>
https://codereview.appspot.com/17580043/diff/20001/src/pkg/database/sql/drive...
> > File src/pkg/database/sql/driver/driver.go (right):
> > 
> >
>
https://codereview.appspot.com/17580043/diff/20001/src/pkg/database/sql/drive...
> > src/pkg/database/sql/driver/driver.go:181: type ColumnsCounter interface {
> > I'd name it NumColumns or ColumnCount for consistency with Columns.
> > It's more of an attribute access than an action to me.
> 
> NumColumns might be the best name since it is consistent with (*Stmt).NumInput
> But how to name the Interface then? NumColumnser? Sounds weird to me.

IMO it can still be ColumnCounter, but please drop the infix "s", it reads weird
- or better, wait for a native speaker to argue that point, I might be wrong.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b