aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/database/sql/convert.go
AgeCommit message (Collapse)Author
2014-09-08build: move package sources from src/pkg to srcRuss Cox
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.
2014-01-10database/sql: avoiding fmt.Sprintf while scanning, avoid allocs with RawBytesBrad Fitzpatrick
A user reported heavy contention on fmt's printer cache. Avoid fmt.Sprint. We have to do reflection anyway, and there was already an asString function to use strconv, so use it. This CL also eliminates a redundant allocation + copy when scanning into *[]byte (avoiding the intermediate string) and avoids an extra alloc when assigning to a caller's RawBytes (trying to reuse the caller's memory). Fixes #7086 R=golang-codereviews, nightlyone CC=golang-codereviews https://golang.org/cl/50240044
2013-03-25database/sql: optimized []byte copy + []byte(nil) -> *interface fixJulien Schmidt
Make the copy directly in the convert switch instead of an extra loop. Also stops converting nil-[]byte to zero-[]byte when assigning to *interface R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7962044
2013-03-22database/sql: add missing []byte and RawBytes conversionsJulien Schmidt
E.g conversions from numeric types to RawBytes are missing, what makes RawBytes unusable in some cases. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/7783046
2013-03-14database/sql: associate a mutex with each driver interfaceBrad Fitzpatrick
The database/sql/driver docs make this promise: "Conn is a connection to a database. It is not used concurrently by multiple goroutines." That promises exists as part of database/sql's overall goal of making drivers relatively easy to write. So far this promise has been kept without the use of locks by being careful in the database/sql package, but sometimes too careful. (cf. golang.org/issue/3857) The CL associates a Mutex with each driver.Conn, and with the interface value progeny thereof. (e.g. each driver.Tx, driver.Stmt, driver.Rows, driver.Result, etc) Then whenever those interface values are used, the Locker is locked. This CL should be a no-op (aside from some new Lock/Unlock pairs) and doesn't attempt to fix Issue 3857 or Issue 4459, but should make it much easier in a subsequent CL. Update #3857 R=golang-dev, adg CC=golang-dev https://golang.org/cl/7803043
2013-02-21database/sql: check for nil Scan pointersBrad Fitzpatrick
Return nice errors and don't panic. Fixes #4859 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7383046
2012-05-29database/sql: use driver.ColumnConverter everywhere consistentlyBrad Fitzpatrick
It was only being used for (*Stmt).Exec, not Query, and not for the same two methods on *DB. This unifies (*Stmt).Exec's old inline code into the old subsetArgs function, renaming it in the process (changing the old word "subset" to "driver", mostly converted earlier) Fixes #3640 R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6258045
2012-02-20database/sql/driver: API cleanupsBrad Fitzpatrick
-- add driver.Value type and documentation, convert from interface{} to Value where appropriate. -- don't say "subset" anywhere, -- SubsetValuer -> Valuer -- SubsetValue -> Value -- IsParameterSubsetType -> IsValue -- IsScanSubsetType -> IsScanValue Fixes #2842 R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/5674084
2012-02-10database/sql: remove Into from ScannerInto/ScanIntoBrad Fitzpatrick
Also fix a doc error. Fixes #2843 R=golang-dev, r, rsc CC=golang-dev https://golang.org/cl/5653050
2012-02-08database/sql: treat pointers as nullable types like encoding/jsonAndrew Pritchard
- convert from nil pointers to the nil interface{} - dereference non-nil pointers - convert from nil interface{}s to nil pointers - allocate pointers for non-nil interface{}s - tests for all of the above R=golang-dev, bradfitz, rsc, rogpeppe CC=golang-dev https://golang.org/cl/5630052
2012-02-06database/sql: permit scanning into interface{}Brad Fitzpatrick
See thread http://goo.gl/7zzzU for background. R=rsc CC=golang-dev https://golang.org/cl/5624051
2012-01-26 database/sql: convert SQL null values to []byte as nil.James P. Cooper
Also allow string values to scan into []byte. Fixes #2788. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5577054
2012-01-19database/sql: move from exp/sqlBrad Fitzpatrick
R=golang-dev, r CC=golang-dev https://golang.org/cl/5536076