Inada Naoki
Inada Naoki
When I replaced `UPDATE test_table SET value = 2` in your example with `SELECT SLEEP(4)`, "ExecContext Error" was happened always. It demonstrates "rarely does not get an error" is not...
Isn't it just because 1ms is too short? Single UPDATE query is too fast to cancel. Use `SELECT SLEEP(1)` instead.
Context may be cancelled anywhere. It may be cancelled during `database/sql` part. It may be cancelled during returning from function. It may be cancelled during CPU is fetching next instruction....
OK, now I understand it. `db.BeginTx()` takes `Background()`, not `ctx`. And `tx.Commit()` don't take `ctx` too. So you want to avoid error caused by `ctx` cancel returned from `tx.Commit()`. That...
By the way, I don't recommend to use ExecContext at all. MySQL don't provide a mechanism to cancel query safely. That's why we just close the TCP connection. It is...
> I think so, but the reason I use ExecContext is because I want to link requests and queries when tracing an application. Oh. It would be better to add...
0000-00-00 is not accepted by default from MySQL 5.7. So I'm +1 for NULL rather than 0000-00-00.
I tried but it's difficult than I thought. Currently, this driver support passing time.Time for TIME column. It means "0000-00-00 12:34:56" is valid for TIME column, but "0000-00-00 00:00:00" is...
There are no valid solution. Use just nil, don't use zero value of time.Time.
You can pass nil to DB.Exec() and DB.Query(). No need to assign nil to time.Time variable.