1
0
mirror of https://github.com/golang/go synced 2024-10-05 06:21:24 -06:00
Commit Graph

33 Commits

Author SHA1 Message Date
Brad Fitzpatrick
0c8ed71079 database/sql: fix doc references to old package name
It used to be package "db" but was long ago renamed
to be "sql".

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7322075
2013-02-13 18:47:25 -08:00
Julien Schmidt
2968e239b0 database/sql: Add an optional Queryer-Interface (like Execer)
Completly the same like the Execer-Interface, just for Queries.
This allows Drivers to execute Queries without preparing them first

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7085056
2013-02-13 15:25:39 -08:00
Brad Fitzpatrick
8f2430a533 database/sql: add currently-disabled broken test
Update #3865

R=golang-dev, alex.brainman, nightlyone
CC=golang-dev
https://golang.org/cl/7324051
2013-02-13 12:00:03 -08:00
Brad Fitzpatrick
20130f141f database/sql: document args, add a couple examples
Fixes #3460

R=golang-dev, alex.brainman
CC=golang-dev
https://golang.org/cl/7096046
2013-01-11 14:46:49 -08:00
Gwenael Treguier
7f0449a108 database/sql: check NumInput on Stmt.Exec
Fixes #3678.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6460087
2013-01-11 13:28:33 -08:00
Shenghou Ma
d1ef9b56fb all: fix typos
caught by https://github.com/lyda/misspell-check.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6949072
2012-12-19 03:04:09 +08:00
James David Chalfant
19e2f26b21 database/sql: adds test for fix in issue 4433.
Tests that here should be automatic retries if a database
driver's connection returns ErrBadConn on Begin. See
"TestTxErrBadConn" in sql_test.go

R=golang-dev
CC=golang-dev
https://golang.org/cl/6942050
2012-12-14 09:00:33 -08:00
James David Chalfant
309eae1923 database/sql: Alter *DB.begin to return driver.ErrBadConn when driver.Conn.Begin returns driver.ErrBadConn
Fixes #4433

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6845094
2012-12-12 22:04:55 -08:00
Mikio Hara
b602c3dbbd all: clear execute bit
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6826044
2012-11-01 10:04:42 +09:00
Julien Schmidt
37b40dab51 database/sql: stop reuse of bad connections
The second parameter for sql.putConn() (err) is always nil. As a result bad
connections are reused, even if the driver returns an driver.ErrBadConn.
Unsing a pointer to err instead achievs the desired behavior.
See http://code.google.com/p/go/issues/detail?id=3777 for more details.
Fixes #3777.

R=golang-dev, dave, bradfitz, jameshuachow, BlakeSGentry
CC=golang-dev
https://golang.org/cl/6348069
2012-08-23 19:29:47 -07:00
David G. Andersen
e66d29cdcf pkg: Removing duplicated words ("of of", etc.), mostly from comments.
Ran 'double.pl' on the pkg tree to identify doubled words.
One change to an error string return in x509;  the rest are in comments.
Thanks to Matt Jibson for the idea.

R=golang-dev, bsiegert
CC=golang-dev
https://golang.org/cl/6344089
2012-07-09 09:16:10 +10:00
Brad Fitzpatrick
93fe8c0c93 database/sql: use driver.ColumnConverter everywhere consistently
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-05-29 11:09:09 -07:00
Michael Lewis
86092b3d45 sql: Propagate error from subsetTypeArgs in Exec
Fixes #3449

R=golang-dev
CC=bradfitz, golang-dev
https://golang.org/cl/5970076
2012-04-03 15:36:48 -07:00
Gwenael Treguier
c3954dd5da database/sql: ensure Stmts are correctly closed.
To make sure that there is no resource leak,
I suggest to fix the 'fakedb' driver such as it fails when any
Stmt is not closed.
First, add a check in fakeConn.Close().
Then, fix all missing Stmt.Close()/Rows.Close().
I am not sure that the strategy choose in fakeConn.Prepare/prepare* is ok.
The weak point in this patch is the change in Tx.Query:
  - Tests pass without this change,
  - I found it by manually analyzing the code,
  - I just try to make Tx.Query look like DB.Query.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5759050
2012-03-10 15:21:44 -08:00
Brad Fitzpatrick
3297fc63d6 database/sql: fix double connection free on Stmt.Query error
In a transaction, on a Stmt.Query error, it was possible for a
connection to be added to a db's freelist twice. Should use
the local releaseConn function instead.

Thanks to Gwenael Treguier for the failing test.

Also in this CL: propagate driver errors through releaseConn
into *DB.putConn, which conditionally ignores the freelist
addition if the driver signaled ErrBadConn, introduced in a
previous CL.

R=golang-dev, gary.burd
CC=golang-dev
https://golang.org/cl/5798049
2012-03-10 10:00:02 -08:00
Robert Griesemer
56cae1c230 all: gofmt -w -s src misc
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5781058
2012-03-08 10:48:51 -08:00
Brad Fitzpatrick
9fb68a9a0a database/sql{,driver}: add ErrBadConn
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5785043
2012-03-08 10:09:52 -08:00
Brad Fitzpatrick
502e29f485 database/sql: add docs about connection state, pooling
Fixes #3223

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5755063
2012-03-06 17:44:47 -08:00
Brad Fitzpatrick
48eacd90a8 database/sql: fix typo bug resulting in double-Prepare
Bug reported by Blake Mizerany found while writing
his new Postgres driver.

R=golang-dev, blake.mizerany
CC=golang-dev
https://golang.org/cl/5754057
2012-03-06 14:10:58 -08:00
Brad Fitzpatrick
943f6cc837 database/sql/driver: API cleanups
-- 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-20 14:25:28 +11:00
Brad Fitzpatrick
6bdd791dec database/sql: remove Into from ScannerInto/ScanInto
Also fix a doc error.

Fixes #2843

R=golang-dev, r, rsc
CC=golang-dev
https://golang.org/cl/5653050
2012-02-10 10:20:49 +11:00
Andrew Balholm
aca4a6c933 database/sql: support ErrSkip in Tx.Exec
If the database driver supports the Execer interface but returns
ErrSkip, calling Exec on a transaction was returning the error instead
of using the slow path.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5654044
2012-02-10 09:19:22 +11:00
Brad Fitzpatrick
00651a2e63 database/sql: rename ErrTransactionFinished to ErrTxDone
Part of issue 2843

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5646063
2012-02-10 09:12:32 +11:00
Brad Fitzpatrick
29df93735c database/sql: more tests
Higher level tests for the pointer parameters
and scanning, complementing the existing ones
included in the previous CL.

R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5646050
2012-02-09 15:01:29 +11:00
Andrew Pritchard
cc39bb9068 database/sql: treat pointers as nullable types like encoding/json
- 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-08 17:14:15 +11:00
Russ Cox
ae7497bda6 doc: remove overuse of simply
Specifically, remove simply where it is claiming that the
code or the action to be carried out is simple, since the
reader might disagree.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5637048
2012-02-06 13:34:35 -05:00
Brad Fitzpatrick
9c060b8d60 database/sql: permit scanning into interface{}
See thread http://goo.gl/7zzzU for background.

R=rsc
CC=golang-dev
https://golang.org/cl/5624051
2012-02-06 10:06:22 -08:00
Nigel Tao
102638cb53 std: add struct field tags to untagged literals.
R=rsc, dsymonds, bsiegert, rogpeppe
CC=golang-dev
https://golang.org/cl/5619052
2012-02-03 10:12:25 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
James P. Cooper
2a22f35598 database/sql: convert SQL null values to []byte as nil.
Also allow string values to scan into []byte.
Fixes #2788.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5577054
2012-01-26 15:12:48 -08:00
Blake Mizerany
bcb976c5b2 database/sql: fix Tx.Query
Fixes #2784

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5574073
2012-01-25 17:49:30 -08:00
James P. Cooper
c21b343438 database/sql: add NullInt64, NullFloat64, NullBool
Fixes #2699

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5557063
2012-01-25 17:47:32 -08:00
Brad Fitzpatrick
7fc4c07172 database/sql: move from exp/sql
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5536076
2012-01-19 16:04:26 -08:00