File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -944,8 +944,8 @@ static void *
944944dbuse_without_gvl (void * ptr )
945945{
946946 struct dbuse_args * args = (struct dbuse_args * )ptr ;
947- dbuse (args -> dbproc , args -> name );
948- return NULL ;
947+ RETCODE rc = dbuse (args -> dbproc , args -> name );
948+ return ( void * )( intptr_t ) rc ;
949949}
950950
951951static VALUE rb_tinytds_connect (VALUE self )
@@ -1060,14 +1060,18 @@ static VALUE rb_tinytds_connect(VALUE self)
10601060 use_args .dbproc = cwrap -> client ;
10611061 use_args .name = StringValueCStr (database );
10621062
1063- // in case of any errors, the tinytds_err_handler will be called
1064- // so we do not have to check the return code here
1065- rb_thread_call_without_gvl (
1066- dbuse_without_gvl ,
1067- & use_args ,
1068- NULL ,
1069- NULL
1070- );
1063+ nogvl_setup (cwrap -> client );
1064+ RETCODE retcode = (RETCODE )(intptr_t )rb_thread_call_without_gvl (
1065+ dbuse_without_gvl ,
1066+ & use_args ,
1067+ NULL ,
1068+ NULL
1069+ );
1070+ nogvl_cleanup (cwrap -> client );
1071+
1072+ if (retcode == FAIL ) {
1073+ rb_raise (cTinyTdsError , "Unable to change to database %s." , use_args .name );
1074+ }
10711075 }
10721076
10731077 transposed_encoding = rb_funcall (cTinyTdsClient , intern_transpose_iconv_encoding , 1 , charset );
You can’t perform that action at this time.
0 commit comments