@@ -69,93 +69,6 @@ VALUE rb_tinytds_new_result_obj(tinytds_client_wrapper *cwrap) {
6969 return obj ;
7070}
7171
72- // No GVL Helpers
73-
74- #define NOGVL_DBCALL (_dbfunction , _client ) ( \
75- (RETCODE)(intptr_t)rb_thread_call_without_gvl( \
76- (void *(*)(void *))_dbfunction, _client, \
77- (rb_unblock_function_t*)dbcancel_ubf, _client ) \
78- )
79-
80- static void dbcancel_ubf (DBPROCESS * client ) {
81- GET_CLIENT_USERDATA (client );
82- dbcancel (client );
83- userdata -> dbcancel_sent = 1 ;
84- }
85-
86- static void nogvl_setup (DBPROCESS * client ) {
87- GET_CLIENT_USERDATA (client );
88- userdata -> nonblocking = 1 ;
89- userdata -> nonblocking_errors_length = 0 ;
90- userdata -> nonblocking_errors = malloc (ERRORS_STACK_INIT_SIZE * sizeof (tinytds_errordata ));
91- userdata -> nonblocking_errors_size = ERRORS_STACK_INIT_SIZE ;
92- }
93-
94- static void nogvl_cleanup (DBPROCESS * client ) {
95- GET_CLIENT_USERDATA (client );
96- userdata -> nonblocking = 0 ;
97- userdata -> timing_out = 0 ;
98- /*
99- Now that the blocking operation is done, we can finally throw any
100- exceptions based on errors from SQL Server.
101- */
102- short int i ;
103- for (i = 0 ; i < userdata -> nonblocking_errors_length ; i ++ ) {
104- tinytds_errordata error = userdata -> nonblocking_errors [i ];
105-
106- // lookahead to drain any info messages ahead of raising error
107- if (!error .is_message ) {
108- short int j ;
109- for (j = i ; j < userdata -> nonblocking_errors_length ; j ++ ) {
110- tinytds_errordata msg_error = userdata -> nonblocking_errors [j ];
111- if (msg_error .is_message ) {
112- rb_tinytds_raise_error (client , msg_error );
113- }
114- }
115- }
116-
117- rb_tinytds_raise_error (client , error );
118- }
119-
120- free (userdata -> nonblocking_errors );
121- userdata -> nonblocking_errors_length = 0 ;
122- userdata -> nonblocking_errors_size = 0 ;
123- }
124-
125- static RETCODE nogvl_dbsqlok (DBPROCESS * client ) {
126- int retcode = FAIL ;
127- GET_CLIENT_USERDATA (client );
128- nogvl_setup (client );
129- retcode = NOGVL_DBCALL (dbsqlok , client );
130- nogvl_cleanup (client );
131- userdata -> dbsqlok_sent = 1 ;
132- return retcode ;
133- }
134-
135- static RETCODE nogvl_dbsqlexec (DBPROCESS * client ) {
136- int retcode = FAIL ;
137- nogvl_setup (client );
138- retcode = NOGVL_DBCALL (dbsqlexec , client );
139- nogvl_cleanup (client );
140- return retcode ;
141- }
142-
143- static RETCODE nogvl_dbresults (DBPROCESS * client ) {
144- int retcode = FAIL ;
145- nogvl_setup (client );
146- retcode = NOGVL_DBCALL (dbresults , client );
147- nogvl_cleanup (client );
148- return retcode ;
149- }
150-
151- static RETCODE nogvl_dbnextrow (DBPROCESS * client ) {
152- int retcode = FAIL ;
153- nogvl_setup (client );
154- retcode = NOGVL_DBCALL (dbnextrow , client );
155- nogvl_cleanup (client );
156- return retcode ;
157- }
158-
15972// Lib Backend (Helpers)
16073
16174static RETCODE rb_tinytds_result_dbresults_retcode (VALUE self ) {
0 commit comments