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