aboutsummaryrefslogtreecommitdiff
path: root/src/database
AgeCommit message (Collapse)Author
2020-12-10database/sql: fix typo in commentHein Khant Zaw
Fixes #43116 Change-Id: Ib04fab6ae03f322aa1508ec00523f628d891247a GitHub-Last-Rev: 0a86e665b2c320e0b2aef75ee53bd7281b19b013 GitHub-Pull-Request: golang/go#43122 Reviewed-on: https://go-review.googlesource.com/c/go/+/276992 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-10-31database/sql, runtime: correct *.Fatal inside goroutines in testsEmmanuel T Odeke
Found by go vet pass "testinggoroutines". Change-Id: I6360af2079617b7aa62dcb9bd7254578ca5d1c1d Reviewed-on: https://go-review.googlesource.com/c/go/+/235527 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-29database/sql: fix TestTxStmtDeadlock testTzu-Chiao Yeh
Drop error check because errors can be not only ErrTxDone for tx stmt executions, and the purpose of the test is just reproducing deadlock. Fixes #42259 Change-Id: I9e7105ada1403ec7064dcc1c3385b36893a1c195 Reviewed-on: https://go-review.googlesource.com/c/go/+/266097 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org>
2020-10-28database/sql: fix tx stmt deadlock when rollbackTzu-Chiao Yeh
Tx acquires tx.closemu W-lock and then acquires stmt.closemu.W-lock to fully close the transaction and associated prepared statement. Stmt query and execution run in reverse ways - acquires stmt.closemu.R-lock and then acquires tx.closemu.R-lock to grab tx connection, which may cause deadlock. Prevent the lock is held around tx.closePrepared to ensure no deadlock happens. Fixes #40985 Change-Id: If53909822b87bce11861a6e3035ecb9476d2cd17 Reviewed-on: https://go-review.googlesource.com/c/go/+/250178 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-27database/sql: fix comment on DB.stop()Ayzat Sadykov
Previously, 2 goroutines were created in OpenDB and a comment in the DB.close() field indicated that they were canceled. Later, session Resetter () was removed, but the comment remained the same. This commit just fixes this message Change-Id: Ie81026f51d7770e9cf8004818154021f626fb2e8 GitHub-Last-Rev: 38b338a0d1cd713d71fa547aa842d395e6d75484 GitHub-Pull-Request: golang/go#42191 Reviewed-on: https://go-review.googlesource.com/c/go/+/264838 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Trust: Brad Fitzpatrick <bradfitz@golang.org>
2020-08-29database/sql: shortestIdleTimeLocked correct min comparisonShinnosuke Sawada
When zero or less, maxIdleTime and maxLifetime means unlimited. Helper function shortestIdleTimeLocked must not return the minimum of the two until both are verified to be greater then zero. Fixes #40841 Change-Id: I1130332baf4ad259cd90c10f4221f5def8510655 Reviewed-on: https://go-review.googlesource.com/c/go/+/248817 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-08-14database/sql: make Rows.Scan properly wrap underlying errorsTim Möhlmann
The prior implementation used the format verb %v which unfortunately improperly wrapped any underlying scanner errors, and we couldn't use errors.Is nor errors.As. This change fixes that by using the %w verb. Added a unit to ensure that both error sub string matching works, but also that errors.Is works as expected. Fixes #38099 Change-Id: Iea667041dd8081d961246f77f2542330417292dc Reviewed-on: https://go-review.googlesource.com/c/go/+/248337 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-05-30database/sql/driver: use correct method name "Connect" in DriverContext docsBrad Erickson
Change-Id: I755fedebb1f8f4d3f27b2b3f8626bca03bd36c88 GitHub-Last-Rev: 4a123572d55ad3b0104d3e6501eef5b2f37af4cd GitHub-Pull-Request: golang/go#39305 Reviewed-on: https://go-review.googlesource.com/c/go/+/235518 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-05-08database/sql: form a complete sentence in code commentKevin Burke
Change-Id: Ib6d0f81b5f64473f9ee6be26a08d5102e8edadc4 Reviewed-on: https://go-review.googlesource.com/c/go/+/229477 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-04-28database/sql: document Connect and Close may need a timeoutDaniel Theophanes
Opening a connection with Connect should still create a derived context with a timeout because some clients will not use a timeout and the connection pool may open a connection asynchronously. Likewise, if a connection close makes a network operation it should provide some type of sane timeout for the operation. Fixes #38185 Change-Id: I9b7ce2996c81c486170dcc84b12672a99610fa27 Reviewed-on: https://go-review.googlesource.com/c/go/+/230438 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-04-28database/sql: fix incorrect function name in example_testVivian Liang
fixes incorrect function name prefix in `example_test.go` Change-Id: I0cce8afc89f6ee6dab3e5152246d28deb597fe53 GitHub-Last-Rev: 4e9a6067c8307e049ace2e35414a838bf6c8a8a4 GitHub-Pull-Request: golang/go#38715 Reviewed-on: https://go-review.googlesource.com/c/go/+/230381 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-04-27database/sql/driver: enhance driver package documentationDaniel Theophanes
Change-Id: I455acdb71354f14e0bc4104cbd7abd5c89958dd9 Reviewed-on: https://go-review.googlesource.com/c/go/+/230214 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-04-22database/sql: de-flake TestTxCannotCommitAfterRollbackDaniel Theophanes
Do not cancel rows during test. Only cancel the Tx. Correct the referenced issue number on the test. Fixes #38597 Change-Id: I0e8ba1bf2a8ba638d121c9c6938501fec1d5e961 Reviewed-on: https://go-review.googlesource.com/c/go/+/229478 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-22database/sql: count connections expired in foreground with MaxLifetimeClosedColin
Previously the connection pool would only count connections expired in the background connectionCleaner goroutine towards the MaxLifetimeClosed stat. This change increments the stat correctly when checking for expiry in when acquiring and releasing a connection. Fixes #38058 Change-Id: Id707ddd40a42a4c38658d5f2931da131647d6c29 GitHub-Last-Rev: 0f205ede439efa355a628b6112450f2ca9ced005 GitHub-Pull-Request: golang/go#38263 Reviewed-on: https://go-review.googlesource.com/c/go/+/227278 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-04-20database/sql: on Tx rollback, retain connection if driver can reset sessionDaniel Theophanes
Previously the Tx would drop the connection after rolling back from a context cancel. Now if the driver can reset the session, keep the connection. Change-Id: Ie6a3124275632787629844d91a06bb2e70cc060b Reviewed-on: https://go-review.googlesource.com/c/go/+/216241 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-20database/sql: prevent Tx statement from committing after rollbackDaniel Theophanes
It was possible for a Tx that was aborted for rollback asynchronously to execute a query after the rollback had completed on the database, which often would auto commit the query outside of the transaction. By W-locking the tx.closemu prior to issuing the rollback connection it ensures any Tx query either fails or finishes on the Tx, and never after the Tx has rolled back. Fixes #34775 Fixes #32942 Change-Id: I017b7932082f2f4ead70bae08b61ed9068ac1d01 Reviewed-on: https://go-review.googlesource.com/c/go/+/216240 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-04-20database/sql: check conn expiry when returning to pool, not when handing it outDaniel Theophanes
With the original connection reuse strategy, it was possible that when a new connection was requested, the pool would wait for an an existing connection to return for re-use in a full connection pool, and then it would check if the returned connection was expired. If the returned connection expired while awaiting re-use, it would return an error to the location requestiong the new connection. The existing call sites requesting a new connection was often the last attempt at returning a connection for a query. This would then result in a failed query. This change ensures that we perform the expiry check right before a connection is inserted back in to the connection pool for while requesting a new connection. If requesting a new connection it will no longer fail due to the connection expiring. Fixes #32530 Change-Id: If16379befe0e14d90160219c0c9396243fe062f7 Reviewed-on: https://go-review.googlesource.com/c/go/+/216197 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-03-29database/sql: add test for Conn.Validator interfaceDaniel Theophanes
This addresses comments made by Russ after https://golang.org/cl/174122 was merged. It addes a test for the connection validator and renames the interface to just "Validator". Change-Id: Iea53e9b250c9be2e86e9b75906e7353e26437c5c Reviewed-on: https://go-review.googlesource.com/c/go/+/223963 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
2020-03-19database/sql: add method Err on sql.RowTim Möhlmann
The Row.Err method is intended to assist wrapping sql.DB. Because sql.Row is a struct with private fields, a wrapper in an existing code base cannot easily provide users with a different implementation without large rewrites. Adding this method allows query level errors to be handled centrally. Fixes #35804 Change-Id: I94e6329de89a7ee1284ce9ef76af4363d2d081f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/214317 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-18database/sql: fix variable name in exampleHarmen
It's a very minor error, but it's a bad copy/paste example. Change-Id: Ia6a723c31f2205c933857ce2cf715bddf773ebb6 GitHub-Last-Rev: 7f14b1a5c1ea3775aa2009184b0b1790e03225eb GitHub-Pull-Request: golang/go#37932 Reviewed-on: https://go-review.googlesource.com/c/go/+/223960 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2020-03-17database/sql: process all Session Resets synchronouslyDaniel Theophanes
Adds a new interface, driver.ConnectionValidator, to allow drivers to signal they should not be used again, separatly from the session resetter interface. This is done now that the session reset is done after the connection is put into the connection pool. Previous behavior attempted to run Session Resets in a background worker. This implementation had two problems: untested performance gains for additional complexity, and failures when the pool size exceeded the connection reset channel buffer size. Fixes #31480 Change-Id: I7d483b883c24a362c292471e87a88db5b204d1d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/174122 Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-02-21database/sql: add SetConnMaxIdleTimeDaniel Theophanes
Allow removing a connection from the connection pool after it has been idle for a period of time, without regard to the total lifespan of the connection. Fixes #25232 Change-Id: Icff157b906769a2d2d45c67525e04a72feb8d832 Reviewed-on: https://go-review.googlesource.com/c/go/+/145758 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-03all: fix invalid invocations of Fatalf in goroutinesEmmanuel T Odeke
Found by running the go vet pass 'testinggoroutine' that I started in CL 212920. Change-Id: Ic9462fac85dbafc437fe4a323b886755a67a1efa Reviewed-on: https://go-review.googlesource.com/c/go/+/213097 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-21database/sql: remove forced log import from testDmitri Shuralyov
This var _ = log.Printf line was added 8 years ago, in CL 4973055, which created the database/sql package and its tests. There was no goimports back then, so this was likely added to make it easier to use log package during development of tests. It's no longer needed, so remove it. It can always be conveniently re-added via goimports whenever needed. Change-Id: I7c32ae3e593c194d970920084139dfa5a42386dc Reviewed-on: https://go-review.googlesource.com/c/go/+/202481 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-30database/sql: preallocate list slice in Drivers()Julien Schmidt
The required slice capacity is already known. Thus, preallocate a slice with the correct capacity before appending to it. Change-Id: I45ac2c5f1701caeb3dda20451d371713ae7e7365 GitHub-Last-Rev: 2bf575be65e9a449322540270988eaf87cec4245 GitHub-Pull-Request: golang/go#34602 Reviewed-on: https://go-review.googlesource.com/c/go/+/197917 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-09-08all: fix typosAinar Garipov
Use the following (suboptimal) script to obtain a list of possible typos: #!/usr/bin/env sh set -x git ls-files |\ grep -e '\.\(c\|cc\|go\)$' |\ xargs -n 1\ awk\ '/\/\// { gsub(/.*\/\//, ""); print; } /\/\*/, /\*\// { gsub(/.*\/\*/, ""); gsub(/\*\/.*/, ""); }' |\ hunspell -d en_US -l |\ grep '^[[:upper:]]\{0,1\}[[:lower:]]\{1,\}$' |\ grep -v -e '^.\{1,4\}$' -e '^.\{16,\}$' |\ sort -f |\ uniq -c |\ awk '$1 == 1 { print $2; }' Then, go through the results manually and fix the most obvious typos in the non-vendored code. Change-Id: I3cb5830a176850e1a0584b8a40b47bde7b260eae Reviewed-on: https://go-review.googlesource.com/c/go/+/193848 Reviewed-by: Robert Griesemer <gri@golang.org>
2019-09-02std: remove unused bits of code all over the placeDaniel Martí
Some were never used, and some haven't been used for years. One exception is net/http's readerAndCloser, which was only used in a test. Move it to a test file. While at it, remove a check in regexp that could never fire; the field is an uint32, so it can never be negative. Change-Id: Ia2200f6afa106bae4034045ea8233b452f38747b Reviewed-on: https://go-review.googlesource.com/c/go/+/192621 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-06-13database/sql: add support for decimal interfaceDaniel Theophanes
Add support for scanning decimal types into values. If the dest supports the decimal composer interface and the src supports the decimal decomposer, set the value of the decimal when Scanning. Add support for sending decimal decomposer interface values as parameters. For #30870 Change-Id: Ic5dbf9069df8d56405852b17542a9188d55c2947 Reviewed-on: https://go-review.googlesource.com/c/go/+/174181 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-13database/sql: add Conn.Raw to expose the driver Conn safelyDaniel Theophanes
Exposing the underlying driver conn will allow the use of the standard connection pool while still able to run special function directly on the driver. Fixes #29835 Change-Id: Ib6d3b9535e730f008916805ae3bf76e4494c88f9 Reviewed-on: https://go-review.googlesource.com/c/go/+/174182 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-06-13database/sql/driver: document Valuer must not panicDaniel Theophanes
While it is possible for the connection pool to guard against panics on every valuer read, this seems like a high cost to be added, in both code complexity and possible runtime performance. Most uses of the Valuer will be trivial, like returning a struct field. Optimize for that case. If sometime may panic the valuer should itself use recover and return an error. Fixes #26332 Change-Id: Iad18780b8028f669f5a7841b74a5384d62fb6a7e Reviewed-on: https://go-review.googlesource.com/c/go/+/170700 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-05-14database/sql: fix subject of unexported func commentBrad Fitzpatrick
Change-Id: I5db429c86e01b55ec3abc6ab4ca11c221b27f189 Reviewed-on: https://go-review.googlesource.com/c/go/+/177039 Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2019-05-06all: simplify code using "gofmt -s -w"Shulhan
Most changes are removing redundant declaration of type when direct instantiating value of map or slice, e.g. []T{T{}} become []T{{}}. Small changes are removing the high order of subslice if its value is the length of slice itself, e.g. T[:len(T)] become T[:]. The following file is excluded due to incompatibility with go1.4, - src/cmd/compile/internal/gc/ssa.go Change-Id: Id3abb09401795ce1e6da591a89749cba8502fb26 Reviewed-on: https://go-review.googlesource.com/c/go/+/166437 Run-TryBot: Dave Cheney <dave@cheney.net> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-26database/sql: add NullInt32Daniel Theophanes
It is common for database integers to be represented as int32 internally. Although NullInt64 is already defined, this should remove some type casts and make working with those eaiser. For #31231 Change-Id: Ia0c37ecef035fee0734c1d1fb6f58aef6905cf5e Reviewed-on: https://go-review.googlesource.com/c/go/+/174178 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26database/sql: check if src is nil before converting to stringDaniel Theophanes
A nil src (NULL database value) will result in a "nil" string, which will never parse correctly in a ParseInt or similar numeric conversion. The resulting error is confusing. Check for a nil src prior to converting the value to string if the resulting string will be parsed after that. Closes #31274 Change-Id: I90f12cceff00fbbfdd3e343b04fa7e2596390e6d Reviewed-on: https://go-review.googlesource.com/c/go/+/174177 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-16all: s/cancelation/cancellation/Josh Bleecher Snyder
Though there is variation in the spelling of canceled, cancellation is always spelled with a double l. Reference: https://www.grammarly.com/blog/canceled-vs-cancelled/ Change-Id: I240f1a297776c8e27e74f3eca566d2bc4c856f2f Reviewed-on: https://go-review.googlesource.com/c/go/+/170060 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-05database/sql: add NullTimeDaniel Theophanes
This matches NullBool, NullFloat64, and NullInt64. Fixes #30305 Change-Id: I79bfcf04a3d43b965d2a3159b0ac22f3e8084a53 Reviewed-on: https://go-review.googlesource.com/c/go/+/170699 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-25database/sql: add example for DB.Prepare and Tx.PrepareHasan Ozgan
Change-Id: Ib9272a7713ed7aaf8ad54c4827be8c095763e648 Reviewed-on: https://go-review.googlesource.com/c/go/+/161677 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-07database/sql: fix comment grammarAndrei Matei
Change-Id: I92d8c93967c5ec57f07151affd0041f00e405057 GitHub-Last-Rev: 2dea977d938a504604aed6a9ae87986001f96acd GitHub-Pull-Request: golang/go#30551 Reviewed-on: https://go-review.googlesource.com/c/go/+/164970 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-15database/sql/driver: fix typoZhou Peng
Change-Id: I6e7035db4b3e2a09e5655eb7646eea9d99fb7118 Reviewed-on: https://go-review.googlesource.com/c/162917 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-02-08database/sql: document Stmt lifetimeJustin Li
When prepared on a DB, prepared statement code in database/sql handles everything to keep the prepared statement alive as it moves across the connection pool. Understanding this is an important part of using this API correctly, but it was only documented indirectly via `(*Tx) Prepare*`. Change-Id: Ic8757e0150d59e675d9f0252f6c15aef2cc2e831 GitHub-Last-Rev: 55dba87458542cb631baac80aeea0c3607d8f421 GitHub-Pull-Request: golang/go#29890 Reviewed-on: https://go-review.googlesource.com/c/159077 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2019-01-14database/sql: fix logic for pulling a Conn from DBDaniel Theophanes
The logic for pulling a database connection from the DB pool should proceed as follows: attempt to pull either a cached connection or new connection N times in a loop. If each connection results in a bad connection, then create a new connection (no cache). Previously pulling a Conn from the pool, the last step also looked at the cache, rather then always creating a new connection. Fixes #29684 Change-Id: I8f436fd9b96eb35502a620ebe8da4ab89fb06a2e Reviewed-on: https://go-review.googlesource.com/c/157637 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-02all: use "reports whether" consistently instead of "returns whether"Tobias Klauser
Follow-up for CL 147037 and after Brad noticed the "returns whether" pattern during the review of CL 150621. Go documentation style for boolean funcs is to say: // Foo reports whether ... func Foo() bool (rather than "returns whether") Created with: $ perl -i -npe 's/returns whether/reports whether/' $(git grep -l "returns whether" | grep -v vendor) Change-Id: I15fe9ff99180ad97750cd05a10eceafdb12dc0b4 Reviewed-on: https://go-review.googlesource.com/c/150918 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-16database/sql: add examples for opening and testing a DB poolDaniel Theophanes
Show two larger application examples. One example that could be used in a CLI, the other in a long running service. These demonstarates different strategies for handling DB.Ping errors in context. Fixes #23738 Change-Id: Id01213caf1f47917239a7506b01d30e37db74d31 Reviewed-on: https://go-review.googlesource.com/c/101216 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-08database/sql: add support for returning cursors to clientDaniel Theophanes
This CL add support for converting a returned cursor (presented to this package as a driver.Rows) and scanning it into a *Rows. Fixes #28515 Change-Id: Id8191c568dc135af9e5e8555efcd01987708edcb Reviewed-on: https://go-review.googlesource.com/c/145738 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02all: use "reports whether" consistently in the few places that didn'tBrad Fitzpatrick
Go documentation style for boolean funcs is to say: // Foo reports whether ... func Foo() bool (rather than "returns true if") This CL also replaces 4 uses of "iff" with the same "reports whether" wording, which doesn't lose any meaning, and will prevent people from sending typo fixes when they don't realize it's "if and only if". In the past I think we've had the typo CLs updated to just say "reports whether". So do them all at once. (Inspired by the addition of another "returns true if" in CL 146938 in fd_plan9.go) Created with: $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true iff" | grep -v vendor) $ perl -i -npe 's/returns true if/reports whether/' $(git grep -l "returns true if" | grep -v vendor) Change-Id: Ided502237f5ab0d25cb625dbab12529c361a8b9f Reviewed-on: https://go-review.googlesource.com/c/147037 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-02database/sql: add description to String method of IsolationLevel struct.Vladimir Kovpak
Add simple description to String method of IsolationLevel struct. Change-Id: I8bdf829c81d4895b8542a3f21437bed61c6e925d GitHub-Last-Rev: 7e16d6a93a9560cf3a09413dfc47d0cb04bb2fde GitHub-Pull-Request: golang/go#28560 Reviewed-on: https://go-review.googlesource.com/c/147040 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-29database/sql: prefer to return Rows.lasterr rather then a static errorDaniel Theophanes
Fixes #25829 Change-Id: I400fdaf0ef3a23bc0d61c4873ffa298e0cf0fc6a Reviewed-on: https://go-review.googlesource.com/c/145204 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-17database/sql: remove commented debug printsUmang Parmar
Fixes #28234 Change-Id: I89090ffb8285c4936b0c9b5c2475849c0643186a GitHub-Last-Rev: 4dd0ec162d0ce1548045d4119fd3295570f65d85 GitHub-Pull-Request: golang/go#28246 Reviewed-on: https://go-review.googlesource.com/c/142877 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-08all: fix a bunch of misspellingsIgor Zhilianin
Change-Id: I94cebca86706e072fbe3be782d3edbe0e22b9432 GitHub-Last-Rev: 8e15a40545704fb21b41a8768079f2da19341ef3 GitHub-Pull-Request: golang/go#28067 Reviewed-on: https://go-review.googlesource.com/c/140437 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-10-06all: fix a bunch of misspellingsIgor Zhilianin
Change-Id: If2954bdfc551515403706b2cd0dde94e45936e08 GitHub-Last-Rev: d4cfc41a5504cf10befefdb881d4c45986a1d1f8 GitHub-Pull-Request: golang/go#28049 Reviewed-on: https://go-review.googlesource.com/c/140299 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>