Skip to content

Commit 518513b

Browse files
authored
Merge pull request #304 from bgrainger/command-timeout
Implement CommandTimeout and DefaultCommandTimeout.
2 parents 416c3ab + e283475 commit 518513b

32 files changed

+681
-50
lines changed

.ci/config/config.buffer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;Use Affected Rows=true;BufferResultSets=true",
3+
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;BufferResultSets=true;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.compression+ssl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;use compression=true;Use Affected Rows=true",
3+
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;use compression=true;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.compression.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;UseCompression=true;Use Affected Rows=true",
3+
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;UseCompression=true;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;Use Affected Rows=true",
3+
"ConnectionString": "server=127.0.0.1;user id=mysqltest;password='test;key=\"val';port=3306;database=mysqltest;ssl mode=none;Use Affected Rows=true;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.ssl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;certificate file=../../../../../.ci/server/certs/ssl-client.pfx;Use Affected Rows=true",
3+
"ConnectionString": "server=127.0.0.1;user id=ssltest;password=test;port=3306;database=mysqltest;ssl mode=required;certificate file=../../../../../.ci/server/certs/ssl-client.pfx;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.uds+ssl.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=./../../../../../.ci/mysqld/mysqld.sock;user id=ssltest;password=test;database=mysqltest;ssl mode=required;Use Affected Rows=true",
3+
"ConnectionString": "server=./../../../../../.ci/mysqld/mysqld.sock;user id=ssltest;password=test;database=mysqltest;ssl mode=required;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.ci/config/config.uds.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Data": {
3-
"ConnectionString": "server=./../../../../../.ci/run/mysql/mysqld.sock;user id=mysqltest;password='test;key=\"val';database=mysqltest;ssl mode=none;Use Affected Rows=true",
3+
"ConnectionString": "server=./../../../../../.ci/run/mysql/mysqld.sock;user id=mysqltest;password='test;key=\"val';database=mysqltest;ssl mode=none;DefaultCommandTimeout=3600",
44
"PasswordlessUser": "no_password",
55
"SecondaryDatabase": "testdb2",
66
"SupportedFeatures": "Json,StoredProcedures,Sha256Password,LargePackets",

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ script:
3636
- echo 'Executing netcoreapp2.0 tests with No Compression, No SSL' && ../../.ci/use-config.sh config.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp2.0
3737
- echo 'Executing netcoreapp2.0 Debug Only tests' && time dotnet test -c Debug -f netcoreapp2.0 --filter="FullyQualifiedName~SideBySide.DebugOnlyTests"
3838
- echo 'Executing netcoreapp2.0 tests with Compression, No SSL' && ../../.ci/use-config.sh config.compression.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp2.0
39+
- echo 'Executing netcoreapp1.1.2 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp1.1.2
3940
- echo 'Executing netcoreapp2.0 tests with No Compression, SSL' && ../../.ci/use-config.sh config.ssl.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp2.0
4041
- echo 'Executing netcoreapp2.0 tests with Compression, SSL' && ../../.ci/use-config.sh config.compression+ssl.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp2.0
4142
- echo 'Executing netcoreapp2.0 tests with Unix Domain Socket, No Compression, No SSL' && ../../.ci/use-config.sh config.uds.json 172.17.0.1 3307 $NAME $FEATURES && time dotnet test -c Release -f netcoreapp2.0

docs/content/connection-options.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ These are the other options that MySqlConnector supports. They are set to sensi
162162
<tr>
163163
<td>BufferResultSets, Buffer Result Sets</td>
164164
<td>false</td>
165-
<td>Setting this to true immediately buffers all result sets to memory upon calling ExecuteReader/ExecuteReaderAsync. This will allow the connection
166-
to execute another statement while still holding the original postion of the reader. Do not use when result sets are bigger than available memory.</td>
165+
<td>Setting this to <code>true</code> immediately buffers all result sets to memory upon calling ExecuteReader/ExecuteReaderAsync. This will allow the connection
166+
to execute another statement while still holding the original postion of the reader. Do not use when result sets are bigger than available memory. When this is <code>true</code>, <code>CommandTimeout</code> will apply to the entire time required to read all the result sets,
167+
so must be set to a sufficiently large value.</td>
167168
</tr>
168169
<tr>
169170
<td>Compress, Use Compression, UseCompression</td>
@@ -182,6 +183,13 @@ These are the other options that MySqlConnector supports. They are set to sensi
182183
<td>false</td>
183184
<td>True to have MySqlDataReader.GetValue() and MySqlDataReader.GetDateTime() return DateTime.MinValue for date or datetime columns that have disallowed values.</td>
184185
</tr>
186+
<tr>
187+
<td>Default Command Timeout, Command Timeout, DefaultCommandTimeout</td>
188+
<td>30</td>
189+
<td>The length of time (in seconds) each command can execute before timing out and throwing an exception, or zero to disable timeouts.
190+
See the note in the <a href="https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient.sqlcommand.commandtimeout">Microsoft documentation</a>
191+
for more explanation of how this is determined.</td>
192+
</tr>
185193
<tr>
186194
<td>Keep Alive, Keepalive</td>
187195
<td>0</td>

docs/content/tutorials/migrating-from-connector-net.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ property doesn't reference the active transaction. See [#333](https://github.com
9393
* [#84701](https://bugs.mysql.com/bug.php?id=84701): Can't create a paramter using a 64-bit enum with a value greater than int.MaxValue
9494
* [#85185](https://bugs.mysql.com/bug.php?id=85185): `ConnectionReset=True` does not preserve connection charset
9595
* [#86263](https://bugs.mysql.com/bug.php?id=86263): Transaction isolation level affects all transactions in session
96+
* [#87307](https://bugs.mysql.com/bug.php?id=87307): NextResult hangs instead of timing out
97+
* [#87316](https://bugs.mysql.com/bug.php?id=87316): MySqlCommand.CommandTimeout can be set to a negative value
9698
* [#87868](https://bugs.mysql.com/bug.php?id=87868): `ColumnSize` in schema table is incorrect for `CHAR(36)` and `BLOB` columns
9799
* [#87876](https://bugs.mysql.com/bug.php?id=87876): `IsLong` is schema table is incorrect for `LONGTEXT` and `LONGBLOB` columns
98100
* [#88058](https://bugs.mysql.com/bug.php?id=88058): `decimal(n, 0)` has wrong `NumericPrecision`
101+
* [#88124](https://bugs.mysql.com/bug.php?id=88124): CommandTimeout isn't reset when calling Read/NextResult

0 commit comments

Comments
 (0)