~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/database/sql/driver/driver.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
 
11
11
import "errors"
12
12
 
13
 
// A driver Value is a value that drivers must be able to handle.
14
 
// A Value is either nil or an instance of one of these types:
 
13
// Value is a value that drivers must be able to handle.
 
14
// It is either nil or an instance of one of these types:
15
15
//
16
16
//   int64
17
17
//   float64
56
56
 
57
57
// Execer is an optional interface that may be implemented by a Conn.
58
58
//
59
 
// If a Conn does not implement Execer, the db package's DB.Exec will
 
59
// If a Conn does not implement Execer, the sql package's DB.Exec will
60
60
// first prepare a query, execute the statement, and then close the
61
61
// statement.
62
62
//
65
65
        Exec(query string, args []Value) (Result, error)
66
66
}
67
67
 
 
68
// Queryer is an optional interface that may be implemented by a Conn.
 
69
//
 
70
// If a Conn does not implement Queryer, the sql package's DB.Query will
 
71
// first prepare a query, execute the statement, and then close the
 
72
// statement.
 
73
//
 
74
// Query may return ErrSkip.
 
75
type Queryer interface {
 
76
        Query(query string, args []Value) (Rows, error)
 
77
}
 
78
 
68
79
// Conn is a connection to a database. It is not used concurrently
69
80
// by multiple goroutines.
70
81
//
104
115
type Stmt interface {
105
116
        // Close closes the statement.
106
117
        //
107
 
        // Closing a statement should not interrupt any outstanding
108
 
        // query created from that statement. That is, the following
109
 
        // order of operations is valid:
110
 
        //
111
 
        //  * create a driver statement
112
 
        //  * call Query on statement, returning Rows
113
 
        //  * close the statement
114
 
        //  * read from Rows
115
 
        //
116
 
        // If closing a statement invalidates currently-running
117
 
        // queries, the final step above will incorrectly fail.
118
 
        //
119
 
        // TODO(bradfitz): possibly remove the restriction above, if
120
 
        // enough driver authors object and find it complicates their
121
 
        // code too much. The sql package could be smarter about
122
 
        // refcounting the statement and closing it at the appropriate
123
 
        // time.
 
118
        // As of Go 1.1, a Stmt will not be closed if it's in use
 
119
        // by any queries.
124
120
        Close() error
125
121
 
126
122
        // NumInput returns the number of placeholder parameters.