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

Side by Side Diff: src/pkg/database/sql/driver/driver.go

Issue 17580043: database/sql: Add optional ColumnsCounter interface
Patch Set: diff -r f9af8b83c78c https://code.google.com/p/go Created 11 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/database/sql/sql.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package driver defines interfaces to be implemented by database 5 // Package driver defines interfaces to be implemented by database
6 // drivers as used by package sql. 6 // drivers as used by package sql.
7 // 7 //
8 // Most code should use package sql. 8 // Most code should use package sql.
9 package driver 9 package driver
10 10
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // size as the Columns() are wide. 166 // size as the Columns() are wide.
167 // 167 //
168 // The dest slice may be populated only with 168 // The dest slice may be populated only with
169 // a driver Value type, but excluding string. 169 // a driver Value type, but excluding string.
170 // All string values must be converted to []byte. 170 // All string values must be converted to []byte.
171 // 171 //
172 // Next should return io.EOF when there are no more rows. 172 // Next should return io.EOF when there are no more rows.
173 Next(dest []Value) error 173 Next(dest []Value) error
174 } 174 }
175 175
176 // ColumnsCounter may be optionally implemented by Rows if the number
177 // of columns is known without building a slice of all column names.
178 // If implemented, the number of columns of the result is inferred
179 // from ColumnsCount instead of the length of the slice returned by
180 // Columns.
181 type ColumnsCounter interface {
ahormann 2013/12/17 15:01:20 I'd name it NumColumns or ColumnCount for consiste
182 ColumnsCount() int
183 }
184
176 // Tx is a transaction. 185 // Tx is a transaction.
177 type Tx interface { 186 type Tx interface {
178 Commit() error 187 Commit() error
179 Rollback() error 188 Rollback() error
180 } 189 }
181 190
182 // RowsAffected implements Result for an INSERT or UPDATE operation 191 // RowsAffected implements Result for an INSERT or UPDATE operation
183 // which mutates a number of rows. 192 // which mutates a number of rows.
184 type RowsAffected int64 193 type RowsAffected int64
185 194
(...skipping 16 matching lines...) Expand all
202 211
203 var _ Result = noRows{} 212 var _ Result = noRows{}
204 213
205 func (noRows) LastInsertId() (int64, error) { 214 func (noRows) LastInsertId() (int64, error) {
206 return 0, errors.New("no LastInsertId available after DDL statement") 215 return 0, errors.New("no LastInsertId available after DDL statement")
207 } 216 }
208 217
209 func (noRows) RowsAffected() (int64, error) { 218 func (noRows) RowsAffected() (int64, error) {
210 return 0, errors.New("no RowsAffected available after DDL statement") 219 return 0, errors.New("no RowsAffected available after DDL statement")
211 } 220 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/database/sql/sql.go » ('j') | no next file with comments »

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