Commit 907b364
authored
FIX: Timeout during cursor creation and not execute (#348)
### Work Item / Issue Reference
<!--
IMPORTANT: Please follow the PR template guidelines below.
For mssql-python maintainers: Insert your ADO Work Item ID below (e.g.
AB#37452)
For external contributors: Insert Github Issue number below (e.g. #149)
Only one reference is required - either GitHub issue OR ADO Work Item.
-->
<!-- mssql-python maintainers: ADO Work Item -->
>
[AB#40635](https://sqlclientdrivers.visualstudio.com/c6d89619-62de-46a0-8b46-70b92a84d85e/_workitems/edit/40635)
<!-- External contributors: GitHub Issue -->
> GitHub Issue: #291
-------------------------------------------------------------------
### Summary
This pull request refactors how query timeouts are set for statement
handles in the `mssql_python/cursor.py` module. The main improvement is
moving the logic for setting the query timeout from the `execute` method
to the cursor initialization process, ensuring the timeout is
consistently applied whenever the statement handle is allocated or
reset.
Statement handle timeout management:
* Introduced a new `_set_timeout` method to set the query timeout
attribute on the statement handle during cursor initialization,
following best practices for performance. (`mssql_python/cursor.py`)
* Removed redundant timeout-setting logic from the `execute` method,
centralizing timeout management in the cursor lifecycle.
(`mssql_python/cursor.py`)1 parent f119d05 commit 907b364
File tree
4 files changed
+338
-18
lines changed- mssql_python
- pybind
- tests
4 files changed
+338
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
183 | 186 | | |
184 | 187 | | |
185 | 188 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| 684 | + | |
684 | 685 | | |
685 | 686 | | |
686 | 687 | | |
687 | 688 | | |
688 | 689 | | |
689 | 690 | | |
690 | 691 | | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
691 | 712 | | |
692 | 713 | | |
693 | 714 | | |
| |||
1216 | 1237 | | |
1217 | 1238 | | |
1218 | 1239 | | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
1230 | | - | |
1231 | | - | |
1232 | | - | |
1233 | 1240 | | |
1234 | 1241 | | |
1235 | 1242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2837 | 2837 | | |
2838 | 2838 | | |
2839 | 2839 | | |
2840 | | - | |
2841 | 2840 | | |
2842 | 2841 | | |
2843 | 2842 | | |
| |||
2916 | 2915 | | |
2917 | 2916 | | |
2918 | 2917 | | |
2919 | | - | |
2920 | 2918 | | |
2921 | 2919 | | |
2922 | 2920 | | |
| |||
4395 | 4393 | | |
4396 | 4394 | | |
4397 | 4395 | | |
4398 | | - | |
4399 | | - | |
| 4396 | + | |
| 4397 | + | |
| 4398 | + | |
| 4399 | + | |
| 4400 | + | |
| 4401 | + | |
| 4402 | + | |
| 4403 | + | |
| 4404 | + | |
| 4405 | + | |
| 4406 | + | |
4400 | 4407 | | |
4401 | 4408 | | |
4402 | 4409 | | |
| |||
0 commit comments