Skip to content

Commit 6de0b85

Browse files
committed
drain info messages ahead of raising error
1 parent 81abe84 commit 6de0b85

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ext/tiny_tds/result.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,17 @@ static void nogvl_cleanup(DBPROCESS *client) {
100100
*/
101101
for (short int i = 0; i < userdata->nonblocking_errors_length; i++) {
102102
tinytds_errordata error = userdata->nonblocking_errors[i];
103+
104+
// lookahead to drain any info messages ahead of raising error
105+
if (!error.is_message) {
106+
for (short int j = i; j < userdata->nonblocking_errors_length; j++) {
107+
tinytds_errordata msg_error = userdata->nonblocking_errors[j];
108+
if (msg_error.is_message) {
109+
rb_tinytds_raise_error(client, msg_error);
110+
}
111+
}
112+
}
113+
103114
rb_tinytds_raise_error(client, error);
104115
}
105116

0 commit comments

Comments
 (0)