0
0
mirror of https://github.com/mattn/go-sqlite3.git synced 2025-06-09 06:19:24 +00:00

19 Commits

Author SHA1 Message Date
862b95943f Fix "cannot start a transaction within a transaction" issue () ()
* Fix "cannot start a transaction within a transaction" issue

[why]
If db.BeginTx(ctx, nil) context is cancelled too fast, "BEGIN" statement can be
completed inside DB, but we still try to cancel it with sqlite3_interrupt.
In such case we get context.Cancelled or context.DeadlineExceeded from exec(),
but operation really completed. Connection returned into pool, and returns "cannot
start a transaction within a transaction" error for next db.BeginTx() call.

[how]
Handle status code returned from cancelled operation.

[testing]
Added unit-test which reproduces issue.

* Reduce TestQueryRowContextCancelParallel concurrency

[why]
Tests times out in travis-ci when run with -race option.
2020-08-29 00:43:21 +09:00
590d44c02b Merge pull request from azavorotnii/ctx_cancel
Fix context cancellation racy handling
2019-11-19 01:19:53 +09:00
fc06e55305 Add build constraints for non cgo 2019-11-18 18:03:31 +09:00
7e1a61dbcd Fix context cancellation racy handling
[why]
Context cancellation goroutine is not in sync with Next() method lifetime.
It leads to sql.ErrNoRows instead of context.Canceled often (easy to reproduce).
It leads to interruption of next query executed on same connection (harder to reproduce).

[how]
Do query in goroutine, wait when interruption done.

[testing]
Add unit test that reproduces error cases.
2019-09-06 12:15:53 -07:00
57484d0899 Updated Ping to return ErrBadConn
Added TestOpenContext
Added TestFileCopyTruncate
Added ping to doTestOpen
2019-06-19 16:50:49 -07:00
668824341d Add Tests for Crypt Encoders
* Increase coverage
2018-06-12 13:57:14 +02:00
58004848f1 Fix race in ExecContext
When the context is cancelled, an interrupt should only be made if the
operation is still ongoing.
2017-11-21 13:40:00 +01:00
5160b48509 fix test 2017-09-28 13:00:20 +09:00
103e6ee9ee remove rows.Close() in TestShortTimeout
couldn't reproduce on local environment
2017-09-28 12:56:17 +09:00
c0f3d4135e fix broken test 2017-09-28 12:47:35 +09:00
49f9543f14 fix error handling
close 
2017-09-28 12:40:27 +09:00
68bcba68d9 use file instead of memory for TestShortTimeout 2017-09-28 12:04:07 +09:00
d40d490543 fixes 2017-08-28 18:58:02 +09:00
35cf400919 fix tests 2016-12-09 12:58:20 +09:00
8ecd77c707 fix test
see https://github.com/golang/go/issues/18099
2016-12-01 12:12:18 +09:00
ea2afbe9e8 revert Multiple Result Set 2016-11-08 13:22:46 +09:00
dd2c82226b fix trace callback.
Close 
2016-11-08 12:19:51 +09:00
15491aeb9c go vet && golint 2016-11-06 13:16:38 +09:00
57eaf4c070 separate test 2016-11-04 15:17:21 +09:00