ibm_db 2.5.26-x86-mingw32 → 2.5.27-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f203d36d906884d58b39af4a01eaf769d1e9acd
4
- data.tar.gz: 88c9dd7109d993f25a3e4f22a7d783eefa72b4ca
3
+ metadata.gz: bfecc36c3cb45e37334de64860c57a31a9c3930a
4
+ data.tar.gz: 7b5e68da345fcf8fdc39584c6b0cc13b5762ff74
5
5
  SHA512:
6
- metadata.gz: 78c60ed4b5a50ad8db067bb879b44cda690ac4385207b7d66f02687c95b8b03dff9182e6650d62fc20efaf00eb8fabfab8928842432f0968d36f5cc06d2da12a
7
- data.tar.gz: 3987168631560807316e56fea1e0213ae74499d815729be65bb291e281d76147721129d0071c87886c622f4b085168d081b01372187e8ea335e3151cbdd91bed
6
+ metadata.gz: 71b5b2a685bf8de7f6c7544d0fbb49045bd2782ded7652c9493386db1ba2725a60b8c9161acd1cd6597427472ec74b3d8a299e16282367f19053bd476d48719a
7
+ data.tar.gz: 836a6a17093660ad3c19ba8a9a090e9b25d96cb1eb606f041e71b197843017aa198036ae714d2962b80065a40bfa873527e2038e1493b03b8991b759721e5397
data/CHANGES CHANGED
@@ -1,11 +1,15 @@
1
1
  Change Log
2
2
  ==============
3
+ 2015/06/08 (IBM_DB adapter 2.5.27, driver 2.5.27)
4
+ - Support for Ruby 2.2.x on Windows and Linux platform
5
+ - Fixed bug#28 Create table fails on db:migrate task in ActiveRecord 4.2.1 if database adapter not support foreign_keys.
6
+
3
7
  2015/04/08 (IBM_DB adapter 2.5.26, driver 2.5.26)
4
8
  - Fixed bug#22 - Error 'undefined method lookup_cast_type encountered' with rails version lesser than 4.2
5
9
 
6
10
  2015/03/24 (IBM_DB adapter 2.5.25, driver 2.5.25)
7
11
  - Support for Rails 4.2.x
8
- - Support for Ruby 2.2.x on Windows and Linus platform
12
+ - Support for Ruby 2.2.x on Windows and Linux platform
9
13
 
10
14
  2014/08/03 (IBM_DB adapter 2.5.18, driver 2.5.14) :
11
15
  - Support for Rails 4.1.x
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  =====================================================================
2
- README for the IBM_DB Adapter (2.5.26) and Driver (2.5.26) (2015/04/08)
2
+ README for the IBM_DB Adapter (2.5.27) and Driver (2.5.27) (2015/04/08)
3
3
  For ActiveRecord Version >= 1.15.5 (and Rails >= 1.2.5)
4
4
  =====================================================================
5
5
 
@@ -12,7 +12,7 @@
12
12
  +----------------------------------------------------------------------+
13
13
  */
14
14
 
15
- #define MODULE_RELEASE "2.5.26"
15
+ #define MODULE_RELEASE "2.5.27"
16
16
 
17
17
  #ifdef HAVE_CONFIG_H
18
18
  #include "config.h"
@@ -57,6 +57,7 @@ typedef struct _stmt_bind_data_array {
57
57
  SQLSMALLINT num;
58
58
  int bind_params;
59
59
  VALUE *error;
60
+ VALUE return_value;
60
61
  }stmt_bind_array;
61
62
 
62
63
  /*
@@ -69,7 +70,9 @@ typedef struct _ibm_db_connect_helper_args_struct {
69
70
  VALUE *options;
70
71
  VALUE *error;
71
72
  int literal_replacement;
72
- VALUE hKey;
73
+ VALUE hKey;
74
+ conn_handle *conn_res;
75
+ VALUE entry;
73
76
  } connect_helper_args;
74
77
 
75
78
  /*
@@ -79,6 +82,7 @@ typedef struct _ibm_db_result_args_struct {
79
82
  stmt_handle *stmt_res;
80
83
  VALUE column;
81
84
  VALUE *error;
85
+ VALUE return_value;
82
86
  } ibm_db_result_args;
83
87
 
84
88
  /*
@@ -90,6 +94,7 @@ typedef struct _ibm_db_fetch_helper_struct {
90
94
  int arg_count;
91
95
  int funcType;
92
96
  VALUE *error;
97
+ VALUE return_value;
93
98
  } ibm_db_fetch_helper_args;
94
99
 
95
100
  void ruby_init_ibm_db();
@@ -159,7 +164,6 @@ static VALUE id_id2name;
159
164
 
160
165
  utf8_enc = rb_enc_find("UTF-8");
161
166
  rbString = rb_external_str_new(str, strlen(str));
162
-
163
167
  return rb_str_export_to_enc(rbString, utf8_enc);
164
168
  }
165
169
 
@@ -171,7 +175,6 @@ static VALUE id_id2name;
171
175
  } else {
172
176
  utf16_enc = rb_enc_find("UTF-16LE");
173
177
  }
174
-
175
178
  return rb_external_str_new_with_enc((char *)str, len, utf16_enc);
176
179
  }
177
180
 
@@ -179,7 +182,7 @@ static VALUE id_id2name;
179
182
  VALUE rbString;
180
183
 
181
184
  rbString = _ruby_ibm_db_export_sqlwchar_to_utf16_rstr( str, len ); /*Construct the Ruby string from SQLWCHAR(which is in utf16)*/
182
-
185
+
183
186
  return _ruby_ibm_db_export_str_to_utf8(rbString); /*Convert the string to utf8 encoding*/
184
187
  }
185
188
 
@@ -187,7 +190,7 @@ static VALUE id_id2name;
187
190
  rb_encoding *utf8_enc;
188
191
 
189
192
  utf8_enc = rb_enc_find("UTF-8");
190
-
193
+
191
194
  return rb_external_str_new_with_enc((char *)str, len, utf8_enc);
192
195
  }
193
196
  #endif
@@ -195,6 +198,7 @@ static VALUE id_id2name;
195
198
  /* Every user visible function must have an entry in Init_ibm_db
196
199
  */
197
200
  void Init_ibm_db(void) {
201
+
198
202
  mDB = rb_define_module("IBM_DB");
199
203
 
200
204
  rb_define_module_function(mDB, "connect", ibm_db_connect, -1);
@@ -260,7 +264,7 @@ void Init_ibm_db(void) {
260
264
  rb_define_module_function(mDB, "server_info", ibm_db_server_info, -1);
261
265
  rb_define_module_function(mDB, "client_info", ibm_db_client_info, -1);
262
266
  rb_define_module_function(mDB, "active", ibm_db_active, -1);
263
-
267
+
264
268
  RUBY_FE(connect)
265
269
  RUBY_FE(commit)
266
270
  RUBY_FE(pconnect)
@@ -326,7 +330,7 @@ void Init_ibm_db(void) {
326
330
  id_keys = rb_intern("keys");
327
331
  id_new = rb_intern("new");
328
332
  id_id2name = rb_intern("id2name");
329
-
333
+
330
334
  };
331
335
  /* */
332
336
 
@@ -341,7 +345,7 @@ static void ruby_ibm_db_load_necessary_libs() {
341
345
  }
342
346
 
343
347
  #ifdef _WIN32
344
- static void ruby_ibm_db_check_sqlcreatedb(HINSTANCE cliLib) {
348
+ static void ruby_ibm_db_check_sqlcreatedb(HINSTANCE cliLib) {
345
349
  FARPROC sqlcreatedb;
346
350
  sqlcreatedb = DLSYM( cliLib, "SQLCreateDbW" );
347
351
  #else
@@ -397,6 +401,7 @@ static void ruby_ibm_db_init_globals(struct _ibm_db_globals *ibm_db_globals)
397
401
  memset(ibm_db_globals->__ruby_stmt_err_msg, '\0', DB2_MAX_ERR_MSG_LEN);
398
402
  memset(ibm_db_globals->__ruby_conn_err_state, '\0', SQL_SQLSTATE_SIZE + 1);
399
403
  memset(ibm_db_globals->__ruby_stmt_err_state, '\0', SQL_SQLSTATE_SIZE + 1);
404
+
400
405
  }
401
406
  /* */
402
407
 
@@ -481,11 +486,12 @@ static void _ruby_ibm_db_mark_conn_struct(conn_handle *handle)
481
486
  /* static void _ruby_ibm_db_free_conn_struct */
482
487
  static void _ruby_ibm_db_free_conn_struct(conn_handle *handle)
483
488
  {
489
+
484
490
  int rc;
485
491
  end_tran_args *end_X_args;
486
492
 
487
493
  if ( handle != NULL ) {
488
- /* Disconnect from DB. If stmt is allocated, it is freed automatically*/
494
+ //Disconnect from DB. If stmt is allocated, it is freed automatically
489
495
  if ( handle->handle_active ) {
490
496
  if( handle->transaction_active == 1 && handle->auto_commit == 0 ) {
491
497
  handle->transaction_active = 0;
@@ -494,14 +500,14 @@ static void _ruby_ibm_db_free_conn_struct(conn_handle *handle)
494
500
 
495
501
  end_X_args->hdbc = &(handle->hdbc);
496
502
  end_X_args->handleType = SQL_HANDLE_DBC;
497
- end_X_args->completionType = SQL_ROLLBACK; /*Note we are rolling back the transaction*/
503
+ end_X_args->completionType = SQL_ROLLBACK; //Note we are rolling back the transaction
498
504
 
499
505
  _ruby_ibm_db_SQLEndTran( end_X_args );
500
506
 
501
507
  ruby_xfree( end_X_args );
502
508
 
503
509
  }
504
- rc = _ruby_ibm_db_SQLDisconnect_helper( &(handle->hdbc) );
510
+ rc = _ruby_ibm_db_SQLDisconnect_helper( &(handle->hdbc) );
505
511
  rc = SQLFreeHandle(SQL_HANDLE_DBC, handle->hdbc );
506
512
  rc = SQLFreeHandle(SQL_HANDLE_ENV, handle->henv );
507
513
  }
@@ -516,14 +522,15 @@ static void _ruby_ibm_db_free_conn_struct(conn_handle *handle)
516
522
  handle->ruby_error_state = NULL;
517
523
  }
518
524
 
519
- /*if ( handle->flag_pconnect ) {
520
- ruby_xfree( handle );
521
- } else {
522
- ruby_xfree( handle );
523
- }*/
525
+ //if ( handle->flag_pconnect ) {
526
+ // ruby_xfree( handle );
527
+ //} else {
528
+ // ruby_xfree( handle );
529
+ //}
524
530
  ruby_xfree( handle );
525
531
  handle = NULL;
526
532
  }
533
+
527
534
  }
528
535
  /* */
529
536
 
@@ -563,20 +570,18 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
563
570
  {
564
571
  int i;
565
572
  param_node *curr_ptr = NULL, *prev_ptr = NULL;
573
+
566
574
 
567
575
  if ( handle != NULL ) {
568
576
  /* Free param cache list */
569
577
  curr_ptr = handle->head_cache_list;
570
578
  prev_ptr = handle->head_cache_list;
571
-
572
579
  while ( curr_ptr != NULL ) {
573
580
  curr_ptr = curr_ptr->next;
574
-
575
581
  if ( prev_ptr->varname != NULL ) {
576
582
  ruby_xfree( prev_ptr->varname );
577
583
  prev_ptr->varname = NULL;
578
584
  }
579
-
580
585
  if ( prev_ptr->svalue != NULL ) {
581
586
  ruby_xfree( prev_ptr->svalue );
582
587
  prev_ptr->svalue = NULL;
@@ -588,7 +593,6 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
588
593
  handle->head_cache_list = NULL;
589
594
  handle->num_params = 0;
590
595
  handle->current_node = NULL;
591
-
592
596
  /* free row data cache */
593
597
  if ( handle->row_data ) {
594
598
  for (i=0; i<handle->num_columns;i++) {
@@ -620,7 +624,6 @@ static void _ruby_ibm_db_free_result_struct(stmt_handle* handle)
620
624
  ruby_xfree( handle->row_data );
621
625
  handle->row_data = NULL;
622
626
  }
623
-
624
627
  /* free column info cache */
625
628
  if ( handle->column_info ) {
626
629
  for (i=0; i<handle->num_columns; i++) {
@@ -682,26 +685,28 @@ static void _ruby_ibm_db_mark_stmt_struct(stmt_handle *handle)
682
685
  }
683
686
 
684
687
 
685
- //VALUE ibm_Ruby_Thread_Call(void *(*func)(void *), void *data1, rb_unblock_function_t *ubf, void *data2)
686
688
  VALUE ibm_Ruby_Thread_Call(rb_blocking_function_t *func, void *data1, rb_unblock_function_t *ubf, void *data2)
687
- {
688
- #ifdef RUBY_API_VERSION_MAJOR
689
- if( RUBY_API_VERSION_MAJOR >=2 && RUBY_API_VERSION_MINOR >=2)
690
- {
691
- #ifdef _WIN32
692
- void *(*f)(void*) = (void *(*)(void*))func;
693
- return (VALUE)rb_thread_call_without_gvl(f, data1, ubf, data2);
694
- #else
689
+ {
690
+ #ifdef RUBY_API_VERSION_MAJOR
691
+ if( RUBY_API_VERSION_MAJOR >=2 && RUBY_API_VERSION_MINOR >=2)
692
+ {
693
+
694
+ #ifdef _WIN32
695
+ void *(*f)(void*) = (void *(*)(void*))func;
696
+ return (VALUE)rb_thread_call_without_gvl(f, data1, ubf, data2);
697
+ #elif __APPLE__
698
+ return rb_thread_call_without_gvl(func, data1, ubf, data2);
699
+ #else
700
+ rb_thread_call_without_gvl(func, data1, ubf, data2);
701
+ #endif
702
+ }
703
+ else
704
+ {
705
+ rb_thread_call_without_gvl(func, data1, ubf, data2);
706
+ }
707
+ #else
695
708
  rb_thread_call_without_gvl(func, data1, ubf, data2);
696
- #endif
697
- }
698
- else
699
- {
700
- return rb_thread_blocking_region(func, data1, ubf, data2);
701
- }
702
- #else
703
- return rb_thread_blocking_region(func, data1, ubf, data2);
704
- #endif
709
+ #endif
705
710
  }
706
711
 
707
712
 
@@ -712,7 +717,6 @@ static void _ruby_ibm_db_free_stmt_handle_and_resources(stmt_handle *handle)
712
717
  {
713
718
  int rc;
714
719
  if ( handle != NULL ) {
715
-
716
720
  if( !handle->is_freed ) {
717
721
  rc = SQLFreeHandle( SQL_HANDLE_STMT, handle->hstmt );
718
722
 
@@ -722,7 +726,6 @@ static void _ruby_ibm_db_free_stmt_handle_and_resources(stmt_handle *handle)
722
726
  ruby_xfree( handle->ruby_stmt_err_msg );
723
727
  handle->ruby_stmt_err_msg = NULL;
724
728
  }
725
-
726
729
  if( handle->ruby_stmt_err_state != NULL ) {
727
730
  ruby_xfree( handle->ruby_stmt_err_state );
728
731
  handle->ruby_stmt_err_state = NULL;
@@ -736,12 +739,12 @@ static void _ruby_ibm_db_free_stmt_handle_and_resources(stmt_handle *handle)
736
739
 
737
740
  /* static _ruby_ibm_db_free_stmt_struct */
738
741
  static void _ruby_ibm_db_free_stmt_struct(stmt_handle *handle)
739
- {
742
+ {
740
743
  if ( handle != NULL ) {
741
744
  _ruby_ibm_db_free_stmt_handle_and_resources( handle );
742
745
  ruby_xfree( handle );
743
- handle = NULL;
744
- }
746
+ handle = NULL;
747
+ }
745
748
  }
746
749
 
747
750
  /* */
@@ -770,6 +773,7 @@ VALUE ibm_db_row_object(int argc, VALUE *argv, VALUE self)
770
773
  */
771
774
  void ruby_init_ibm_db()
772
775
  {
776
+
773
777
  #ifndef _WIN32
774
778
  /* Declare variables for DB2 instance settings */
775
779
  char * tmp_name = NULL;
@@ -778,9 +782,9 @@ void ruby_init_ibm_db()
778
782
 
779
783
  ibm_db_globals = ALLOC(struct _ibm_db_globals);
780
784
  memset(ibm_db_globals, '\0', sizeof(struct _ibm_db_globals));
781
-
785
+
782
786
  ruby_ibm_db_init_globals(ibm_db_globals);
783
-
787
+
784
788
  /* Specifies that binary data shall be converted to a hexadecimal encoding and returned as an ASCII string */
785
789
  rb_define_const(mDB, "BINARY", INT2NUM(1));
786
790
  /* Specifies that binary data shall be converted to a hexadecimal encoding and returned as an ASCII string */
@@ -891,7 +895,7 @@ void ruby_init_ibm_db()
891
895
  #endif
892
896
 
893
897
  persistent_list = rb_hash_new();
894
-
898
+
895
899
  le_conn_struct = rb_define_class_under(mDB, "Connection", rb_cObject);
896
900
  le_pconn_struct = rb_define_class_under(mDB, "PConnection", rb_cObject);
897
901
  le_stmt_struct = rb_define_class_under(mDB, "Statement", rb_cObject);
@@ -936,6 +940,7 @@ void ruby_init_ibm_db()
936
940
  ruby_ibm_db_load_necessary_libs();
937
941
 
938
942
  ruby_ibm_db_check_if_cli_func_supported();
943
+
939
944
  }
940
945
  /* */
941
946
 
@@ -1020,10 +1025,10 @@ static void _ruby_ibm_db_check_sql_errors( void *conn_or_stmt, int resourceType,
1020
1025
 
1021
1026
  if( release_gil == 1 ){
1022
1027
 
1023
- #ifdef UNICODE_SUPPORT_VERSION
1024
- //return_code = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLGetDiagRec_helper, get_DiagRec_args,
1025
- return_code = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLGetDiagRec_helper, get_DiagRec_args,
1028
+ #ifdef UNICODE_SUPPORT_VERSION
1029
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLGetDiagRec_helper, get_DiagRec_args,
1026
1030
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
1031
+ return_code =get_DiagRec_args->return_code;
1027
1032
  #else
1028
1033
  return_code = _ruby_ibm_db_SQLGetDiagRec_helper( get_DiagRec_args );
1029
1034
  #endif
@@ -1291,6 +1296,7 @@ static void _ruby_ibm_db_check_sql_errors( void *conn_or_stmt, int resourceType,
1291
1296
  if( sqlstate != NULL ) {
1292
1297
  ruby_xfree( sqlstate );
1293
1298
  }
1299
+
1294
1300
  }
1295
1301
  /* */
1296
1302
 
@@ -1594,6 +1600,7 @@ static int _ruby_ibm_db_parse_options ( VALUE options, int type, void *handle, V
1594
1600
  if( ret_val == Qfalse ){
1595
1601
  return SQL_ERROR;
1596
1602
  }
1603
+
1597
1604
  return SQL_SUCCESS;
1598
1605
  }
1599
1606
  /* */
@@ -1626,6 +1633,7 @@ static int _ruby_ibm_db_get_result_set_info(stmt_handle *stmt_res)
1626
1633
  _ruby_ibm_db_check_sql_errors( stmt_res, DB_STMT, (SQLHSTMT)stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, NULL, -1, 1, 0 );
1627
1634
  ruby_xfree( result_cols_args );
1628
1635
  result_cols_args = NULL;
1636
+ stmt_res->rc = -1;
1629
1637
  return -1;
1630
1638
  }
1631
1639
  stmt_res->num_columns = result_cols_args->count;
@@ -1666,6 +1674,7 @@ static int _ruby_ibm_db_get_result_set_info(stmt_handle *stmt_res)
1666
1674
  result_cols_args = NULL;
1667
1675
  describecolargs = NULL;
1668
1676
  stmt_res->column_info = NULL;
1677
+ stmt_res->rc = -1;
1669
1678
  return -1;
1670
1679
  }
1671
1680
  if ( describecolargs->name_length <= 0 ) {
@@ -1698,6 +1707,7 @@ static int _ruby_ibm_db_get_result_set_info(stmt_handle *stmt_res)
1698
1707
  result_cols_args = NULL;
1699
1708
  describecolargs = NULL;
1700
1709
  stmt_res->column_info = NULL;
1710
+ stmt_res->rc = -1;
1701
1711
  return -1;
1702
1712
  }
1703
1713
  } else {
@@ -1720,6 +1730,7 @@ static int _ruby_ibm_db_get_result_set_info(stmt_handle *stmt_res)
1720
1730
  ruby_xfree( result_cols_args );
1721
1731
  result_cols_args = NULL;
1722
1732
  }
1733
+ stmt_res->rc = 0;
1723
1734
  return 0;
1724
1735
  }
1725
1736
  /* */
@@ -1742,7 +1753,7 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1742
1753
  memset(bindCol_args,'\0',sizeof(struct _ibm_db_bind_col_struct));
1743
1754
 
1744
1755
  bindCol_args->stmt_res = stmt_res;
1745
-
1756
+
1746
1757
  for (i=0; i<stmt_res->num_columns; i++) {
1747
1758
  column_type = stmt_res->column_info[i].type;
1748
1759
  row_data = &stmt_res->row_data[i].data;
@@ -1788,7 +1799,6 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1788
1799
  bindCol_args->out_length = (SQLLEN *) (&stmt_res->row_data[i].out_length);
1789
1800
 
1790
1801
  rc = _ruby_ibm_db_SQLBindCol_helper( bindCol_args );
1791
-
1792
1802
  if ( rc == SQL_ERROR ) {
1793
1803
  _ruby_ibm_db_check_sql_errors( stmt_res, DB_STMT, (SQLHSTMT)stmt_res->hstmt, SQL_HANDLE_STMT,
1794
1804
  rc, 1, NULL, NULL, -1, 1, 0 );
@@ -1949,7 +1959,7 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1949
1959
  bindCol_args->buff_length = 4;
1950
1960
  bindCol_args->TargetValuePtr = &stmt_res->column_info[i].lob_loc;
1951
1961
  bindCol_args->out_length = &stmt_res->column_info[i].loc_ind;
1952
-
1962
+
1953
1963
  rc = _ruby_ibm_db_SQLBindCol_helper( bindCol_args );
1954
1964
 
1955
1965
  if ( rc == SQL_ERROR ) {
@@ -1971,12 +1981,12 @@ static int _ruby_ibm_db_bind_column_helper(stmt_handle *stmt_res)
1971
1981
  bindCol_args->TargetValuePtr = NULL;
1972
1982
  bindCol_args->out_length = NULL;
1973
1983
  }
1974
-
1975
1984
  /*Free Any Memory Allocated*/
1976
1985
  if ( bindCol_args != NULL ) {
1977
1986
  ruby_xfree( bindCol_args );
1978
1987
  bindCol_args = NULL;
1979
1988
  }
1989
+
1980
1990
  return rc;
1981
1991
  }
1982
1992
  /* */
@@ -2021,6 +2031,7 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2021
2031
  get_handle_attr_args *get_handleAttr_args = NULL;
2022
2032
 
2023
2033
  conn_alive = 1;
2034
+
2024
2035
 
2025
2036
  handleAttr_args = ALLOC( set_handle_attr_args );
2026
2037
  memset(handleAttr_args,'\0',sizeof(struct _ibm_db_set_handle_attr_struct));
@@ -2028,8 +2039,7 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2028
2039
  do {
2029
2040
  /* Check if we already have a connection for this userID & database combination */
2030
2041
  if ( isPersistent ) {
2031
-
2032
- if ( !NIL_P(entry = rb_hash_aref(persistent_list, data->hKey)) ) {
2042
+ if ( !NIL_P(entry = rb_hash_aref(persistent_list, data->hKey)) ) {
2033
2043
  Data_Get_Struct(entry, conn_handle, conn_res);
2034
2044
  #ifndef PASE /* i5/OS server mode is persistant */
2035
2045
  /* Need to reinitialize connection? */
@@ -2041,9 +2051,9 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2041
2051
  get_handleAttr_args->valuePtr = (SQLPOINTER)&conn_alive;
2042
2052
  get_handleAttr_args->buff_length = 0;
2043
2053
  get_handleAttr_args->out_length = NULL;
2044
-
2054
+
2045
2055
  rc = _ruby_ibm_db_SQLGetConnectAttr_helper( get_handleAttr_args );
2046
-
2056
+
2047
2057
  ruby_xfree( get_handleAttr_args );
2048
2058
  get_handleAttr_args = NULL;
2049
2059
 
@@ -2057,12 +2067,10 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2057
2067
  } else {
2058
2068
  /* Need to check for max pconnections? */
2059
2069
  }
2060
-
2061
2070
  if ( conn_res == NULL ) {
2062
2071
  conn_res = ALLOC(conn_handle);
2063
2072
  memset(conn_res, '\0', sizeof(conn_handle));
2064
2073
  }
2065
-
2066
2074
  /* handle not active as of yet */
2067
2075
  conn_res->handle_active = 0;
2068
2076
 
@@ -2098,10 +2106,8 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2098
2106
  return Qnil;
2099
2107
  break;
2100
2108
  }
2101
-
2102
2109
  handleAttr_args->handle = &( conn_res->henv );
2103
2110
  handleAttr_args->strLength = 0;
2104
-
2105
2111
  #ifndef PASE /* i5/OS server mode */
2106
2112
  handleAttr_args->attribute = SQL_ATTR_ODBC_VERSION;
2107
2113
  handleAttr_args->valuePtr = (void *) SQL_OV_ODBC3;
@@ -2110,7 +2116,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2110
2116
  handleAttr_args->attribute = SQL_ATTR_SERVER_MODE;
2111
2117
  handleAttr_args->valuePtr = &attr;
2112
2118
  #endif /* PASE */
2113
-
2114
2119
  rc = _ruby_ibm_db_SQLSetEnvAttr_helper( handleAttr_args );
2115
2120
 
2116
2121
  if (rc != SQL_SUCCESS) {
@@ -2138,7 +2143,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2138
2143
  break;
2139
2144
  }
2140
2145
  }
2141
-
2142
2146
  if (! reused) {
2143
2147
  /* Alloc CONNECT Handle */
2144
2148
  rc = SQLAllocHandle( SQL_HANDLE_DBC, conn_res->henv, &(conn_res->hdbc) );
@@ -2166,7 +2170,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2166
2170
  break;
2167
2171
  }
2168
2172
  }
2169
-
2170
2173
  handleAttr_args->handle = &(conn_res->hdbc);
2171
2174
  handleAttr_args->strLength = SQL_NTS;
2172
2175
  handleAttr_args->attribute = SQL_ATTR_AUTOCOMMIT;
@@ -2178,13 +2181,11 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2178
2181
  handleAttr_args->valuePtr = (SQLPOINTER)(conn_res->auto_commit);
2179
2182
 
2180
2183
  rc = _ruby_ibm_db_SQLSetConnectAttr_helper( handleAttr_args );
2181
-
2182
2184
  #else
2183
2185
  conn_res->auto_commit = SQL_AUTOCOMMIT_ON;
2184
2186
  handleAttr_args->valuePtr = (SQLPOINTER)(&conn_res->auto_commit);
2185
2187
 
2186
2188
  rc = _ruby_ibm_db_SQLSetConnectAttr_helper( handleAttr_args );
2187
-
2188
2189
  if (!IBM_DB_G(i5_allow_commit)) {
2189
2190
  if (!rc) {
2190
2191
  SQLINTEGER nocommitpase = SQL_TXN_NO_COMMIT;
@@ -2197,7 +2198,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2197
2198
  }
2198
2199
  }
2199
2200
  #endif
2200
-
2201
2201
  conn_res->c_bin_mode = IBM_DB_G(bin_mode);
2202
2202
  conn_res->c_case_mode = CASE_NATURAL;
2203
2203
  conn_res->c_cursor_type = SQL_SCROLL_FORWARD_ONLY;
@@ -2211,7 +2211,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2211
2211
  conn_res->errorType = 1;
2212
2212
 
2213
2213
  conn_res->transaction_active = 0; /*No transaction is active*/
2214
-
2215
2214
  /* Set Options */
2216
2215
  if ( !NIL_P(*options) ) {
2217
2216
  rc = _ruby_ibm_db_parse_options( *options, SQL_HANDLE_DBC, conn_res, error );
@@ -2224,12 +2223,10 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2224
2223
  return Qnil;
2225
2224
  }
2226
2225
  }
2227
-
2228
2226
  if (! reused) {
2229
2227
  conn_args->hdbc = &(conn_res->hdbc);
2230
2228
 
2231
2229
  rc = _ruby_ibm_db_SQLConnect_helper( conn_args );
2232
-
2233
2230
  if ( rc == SQL_ERROR ) {
2234
2231
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
2235
2232
  SQLFreeHandle( SQL_HANDLE_DBC, conn_res->hdbc );
@@ -2244,38 +2241,33 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2244
2241
  } else {
2245
2242
  #ifdef UNICODE_SUPPORT_VERSION
2246
2243
  *error = _ruby_ibm_db_export_char_to_utf8_rstr("Connection failed: <error message could not be retrieved>");
2247
- #else
2244
+ #else
2248
2245
  *error = rb_str_new2("Connection failed: <error message could not be retrieved>");
2249
2246
  #endif
2250
2247
  }
2251
2248
  ruby_xfree( handleAttr_args );
2252
- handleAttr_args = NULL;
2253
- _ruby_ibm_db_free_conn_struct( conn_res );
2249
+ handleAttr_args = NULL;
2250
+ _ruby_ibm_db_free_conn_struct( conn_res );
2254
2251
  return Qnil;
2255
- }
2256
-
2252
+ }
2257
2253
  /* Get the AUTOCOMMIT state from the CLI driver as cli driver could have changed autocommit status based on it's precedence */
2258
2254
  get_handleAttr_args = ALLOC( get_handle_attr_args );
2259
2255
  memset(get_handleAttr_args,'\0',sizeof(struct _ibm_db_get_handle_attr_struct));
2260
-
2256
+
2261
2257
  get_handleAttr_args->handle = &( conn_res->hdbc );
2262
2258
  get_handleAttr_args->attribute = SQL_ATTR_AUTOCOMMIT;
2263
- get_handleAttr_args->valuePtr = (SQLPOINTER)(&conn_res->auto_commit);
2259
+ get_handleAttr_args->valuePtr = (SQLPOINTER)(&conn_res->auto_commit);
2264
2260
  get_handleAttr_args->buff_length = 0;
2265
- get_handleAttr_args->out_length = NULL;
2266
-
2267
- rc = _ruby_ibm_db_SQLGetConnectAttr_helper( get_handleAttr_args );
2268
-
2261
+ get_handleAttr_args->out_length = NULL;
2262
+ rc = _ruby_ibm_db_SQLGetConnectAttr_helper( get_handleAttr_args );
2269
2263
  ruby_xfree( get_handleAttr_args );
2270
2264
  get_handleAttr_args = NULL;
2271
-
2272
2265
  if ( rc == SQL_ERROR ) {
2273
2266
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
2274
- rc = _ruby_ibm_db_SQLDisconnect_helper( &(conn_res->hdbc) );
2267
+ rc = _ruby_ibm_db_SQLDisconnect_helper( &(conn_res->hdbc) );
2275
2268
  SQLFreeHandle( SQL_HANDLE_DBC, conn_res->hdbc );
2276
- SQLFreeHandle( SQL_HANDLE_ENV, conn_res->henv );
2277
- if( conn_res != NULL && conn_res->ruby_error_msg != NULL ) {
2278
-
2269
+ SQLFreeHandle( SQL_HANDLE_ENV, conn_res->henv );
2270
+ if( conn_res != NULL && conn_res->ruby_error_msg != NULL ) {
2279
2271
  #ifdef UNICODE_SUPPORT_VERSION
2280
2272
  *error = rb_str_concat( _ruby_ibm_db_export_char_to_utf8_rstr("Failed to retrieve autocommit status during connection: "),
2281
2273
  _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(conn_res->ruby_error_msg, conn_res->ruby_error_msg_len));
@@ -2295,7 +2287,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2295
2287
  return Qnil;
2296
2288
 
2297
2289
  }
2298
-
2299
2290
  #ifdef CLI_DBC_SERVER_TYPE_DB2LUW
2300
2291
  #ifdef SQL_ATTR_DECFLOAT_ROUNDING_MODE
2301
2292
 
@@ -2307,7 +2298,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2307
2298
 
2308
2299
  #endif
2309
2300
  #endif
2310
-
2311
2301
  /* Get the server name */
2312
2302
  #ifdef UNICODE_SUPPORT_VERSION
2313
2303
  server = ALLOC_N(SQLWCHAR, 2048);
@@ -2318,20 +2308,18 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2318
2308
  server = ALLOC_N(SQLCHAR, 2048);
2319
2309
  memset(server, 0, sizeof(server));
2320
2310
  #endif
2321
-
2322
2311
  getInfo_args = ALLOC( get_info_args );
2323
2312
  memset(getInfo_args,'\0',sizeof(struct _ibm_db_get_info_struct));
2324
-
2325
2313
  getInfo_args->conn_res = conn_res;
2326
2314
  getInfo_args->out_length = &out_length;
2327
2315
  getInfo_args->infoType = SQL_DBMS_NAME;
2328
2316
  getInfo_args->infoValue = (SQLPOINTER)server;
2317
+
2329
2318
  #ifdef UNICODE_SUPPORT_VERSION
2330
2319
  getInfo_args->buff_length = 2048 * sizeof(SQLWCHAR);
2331
2320
  #else
2332
2321
  getInfo_args->buff_length = 2048;
2333
2322
  #endif
2334
-
2335
2323
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
2336
2324
 
2337
2325
  #ifndef UNICODE_SUPPORT_VERSION
@@ -2350,12 +2338,10 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2350
2338
  is_informix = 1;
2351
2339
  }
2352
2340
  #endif
2353
-
2354
2341
  ruby_xfree( getInfo_args );
2355
2342
  ruby_xfree( server );
2356
2343
  getInfo_args = NULL;
2357
2344
  server = NULL;
2358
-
2359
2345
  rc = SQL_SUCCESS; /*Setting rc to SQL_SUCCESS, because the below block may or may not be executed*/
2360
2346
 
2361
2347
  /* Set SQL_ATTR_REPLACE_QUOTED_LITERALS connection attribute to
@@ -2372,7 +2358,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2372
2358
  handleAttr_args->strLength = SQL_IS_INTEGER;
2373
2359
  handleAttr_args->attribute = SQL_ATTR_REPLACE_QUOTED_LITERALS;
2374
2360
  handleAttr_args->valuePtr = (SQLPOINTER)(enable_numeric_literals);
2375
-
2376
2361
  rc = _ruby_ibm_db_SQLSetConnectAttr_helper( handleAttr_args );
2377
2362
  if (rc != SQL_SUCCESS) {
2378
2363
  handleAttr_args->attribute = SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE;
@@ -2386,7 +2371,6 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2386
2371
  handleAttr_args->strLength = SQL_IS_INTEGER;
2387
2372
  handleAttr_args->attribute = SQL_ATTR_REPLACE_QUOTED_LITERALS;
2388
2373
  handleAttr_args->valuePtr = (SQLPOINTER)(&enable_numeric_literals);
2389
-
2390
2374
  rc = _ruby_ibm_db_SQLSetConnectAttr_helper( handleAttr_args );
2391
2375
  if (rc != SQL_SUCCESS) {
2392
2376
  handleAttr_args->attribute = SQL_ATTR_REPLACE_QUOTED_LITERALS_OLDVALUE;
@@ -2400,46 +2384,52 @@ static VALUE _ruby_ibm_db_connect_helper2( connect_helper_args *data ) {
2400
2384
  }
2401
2385
  conn_res->handle_active = 1;
2402
2386
  } while (0);
2403
-
2404
2387
  if( handleAttr_args != NULL ) {
2405
2388
  ruby_xfree( handleAttr_args );
2406
2389
  handleAttr_args = NULL;
2407
2390
  }
2408
-
2409
- if (data->hKey != Qnil) {
2410
- if (! reused && rc == SQL_SUCCESS) {
2391
+ if (data->hKey != Qnil)
2392
+ {
2393
+ //data->conn_res = conn_res;
2394
+ if (! reused && rc == SQL_SUCCESS)
2395
+ {
2411
2396
  /* If we created a new persistent connection, add it to the persistent_list */
2412
2397
  entry = Data_Wrap_Struct(le_pconn_struct,
2413
- _ruby_ibm_db_mark_pconn_struct, _ruby_ibm_db_free_pconn_struct,
2398
+ _ruby_ibm_db_mark_pconn_struct, _ruby_ibm_db_free_pconn_struct,
2414
2399
  conn_res);
2400
+ //data->entry = entry;
2415
2401
  rb_hash_aset(persistent_list, data->hKey, entry);
2416
2402
  }
2403
+ data->entry = entry;
2417
2404
  }
2418
-
2419
2405
  if ( rc < SQL_SUCCESS ) {
2420
2406
  if (conn_res != NULL && conn_res->handle_active) {
2421
2407
  rc = SQLFreeHandle( SQL_HANDLE_DBC, conn_res->hdbc);
2422
2408
  rc = SQLFreeHandle(SQL_HANDLE_ENV, conn_res->henv );
2423
2409
  }
2424
-
2425
2410
  /* free memory */
2426
2411
  if (conn_res != NULL) {
2427
2412
  conn_res->handle_active = 0;
2428
2413
  _ruby_ibm_db_free_conn_struct(conn_res);
2429
2414
  }
2430
-
2431
2415
  return Qfalse;
2432
2416
  } else if (!NIL_P(entry)) {
2433
- return entry;
2417
+ //data->conn_res = conn_res;
2418
+ return entry;
2434
2419
  } else if (isPersistent) {
2435
- return Data_Wrap_Struct(le_pconn_struct,
2420
+ //data->conn_res = conn_res;
2421
+ entry = Data_Wrap_Struct(le_pconn_struct,
2436
2422
  _ruby_ibm_db_mark_pconn_struct, _ruby_ibm_db_free_pconn_struct,
2437
2423
  conn_res);
2424
+ data->entry = entry;
2438
2425
  } else {
2439
- return Data_Wrap_Struct(le_conn_struct,
2440
- _ruby_ibm_db_mark_conn_struct, _ruby_ibm_db_free_conn_struct,
2441
- conn_res);
2426
+ data->conn_res = conn_res;
2427
+ /* return Data_Wrap_Struct(le_conn_struct,
2428
+ _ruby_ibm_db_mark_conn_struct, _ruby_ibm_db_free_conn_struct,
2429
+ conn_res);
2430
+ */
2442
2431
  }
2432
+
2443
2433
  }
2444
2434
 
2445
2435
  /* */
@@ -2450,7 +2440,8 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
2450
2440
  {
2451
2441
  connect_args *conn_args = NULL;
2452
2442
  connect_helper_args *helper_args = NULL;
2453
-
2443
+ conn_handle *conn_res = NULL;
2444
+
2454
2445
  VALUE r_db, r_uid, r_passwd, options,return_value;
2455
2446
  VALUE r_literal_replacement = Qnil;
2456
2447
 
@@ -2459,36 +2450,37 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
2459
2450
  #endif
2460
2451
 
2461
2452
  VALUE error = Qnil;
2462
-
2453
+
2454
+
2463
2455
  rb_scan_args(argc, argv, "32", &r_db, &r_uid, &r_passwd, &options, &r_literal_replacement );
2464
2456
 
2465
2457
  /* Allocate the mwmory for necessary components */
2466
2458
 
2467
2459
  conn_args = ALLOC( connect_args );
2468
2460
  memset(conn_args,'\0',sizeof(struct _ibm_db_connect_args_struct));
2469
-
2461
+
2470
2462
  #ifndef UNICODE_SUPPORT_VERSION
2471
2463
  conn_args->database = (SQLCHAR *) RSTRING_PTR( r_db );
2472
2464
  conn_args->database_len = (SQLSMALLINT) RSTRING_LEN( r_db );
2473
2465
 
2474
2466
  conn_args->uid = (SQLCHAR *) RSTRING_PTR( r_uid );
2475
2467
  conn_args->uid_len = (SQLSMALLINT) RSTRING_LEN( r_uid );
2476
-
2468
+
2477
2469
  conn_args->password = (SQLCHAR *) RSTRING_PTR( r_passwd );
2478
2470
  conn_args->password_len = (SQLSMALLINT) RSTRING_LEN( r_passwd );
2471
+
2479
2472
  #else
2480
2473
  r_db_utf16 = _ruby_ibm_db_export_str_to_utf16( r_db );
2481
2474
  r_db_ascii = _ruby_ibm_db_export_str_to_ascii( r_db );
2482
2475
  r_uid_utf16 = _ruby_ibm_db_export_str_to_utf16( r_uid );
2483
2476
  r_passwd_utf16 = _ruby_ibm_db_export_str_to_utf16( r_passwd );
2484
-
2477
+
2485
2478
  conn_args->database = (SQLWCHAR *) RSTRING_PTR( r_db_utf16 );
2486
2479
  conn_args->database_len = (SQLSMALLINT) RSTRING_LEN( r_db_utf16 )/sizeof(SQLWCHAR);
2487
2480
  /*RSTRING returns the number of bytes, while CLI expects number of SQLWCHAR(2 bytes) elements, hence dividing the len by 2*/
2488
2481
 
2489
2482
  conn_args->uid = (SQLWCHAR *) RSTRING_PTR( r_uid_utf16 );
2490
- conn_args->uid_len = (SQLSMALLINT) RSTRING_LEN( r_uid_utf16 )/sizeof(SQLWCHAR);
2491
-
2483
+ conn_args->uid_len = (SQLSMALLINT) RSTRING_LEN( r_uid_utf16 )/sizeof(SQLWCHAR);
2492
2484
  conn_args->password = (SQLWCHAR *) RSTRING_PTR( r_passwd_utf16 );
2493
2485
  conn_args->password_len = (SQLSMALLINT) RSTRING_LEN( r_passwd_utf16 )/sizeof(SQLWCHAR);
2494
2486
  #endif
@@ -2503,15 +2495,17 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
2503
2495
  } else {
2504
2496
  conn_args->ctlg_conn = 1;
2505
2497
  }
2498
+
2506
2499
 
2507
- helper_args = ALLOC( connect_helper_args );
2500
+ helper_args = ALLOC( connect_helper_args );
2508
2501
  memset(helper_args,'\0',sizeof(struct _ibm_db_connect_helper_args_struct));
2502
+
2509
2503
 
2510
2504
  helper_args->conn_args = conn_args;
2511
2505
  helper_args->isPersistent = isPersistent;
2512
2506
  helper_args->options = &options;
2513
2507
  helper_args->error = &error;
2514
-
2508
+
2515
2509
  if( isPersistent ) {
2516
2510
  /*If making a persistent connection calculate the hash key to cache the connection in persistence list*/
2517
2511
  #ifndef UNICODE_SUPPORT_VERSION
@@ -2526,43 +2520,67 @@ static VALUE _ruby_ibm_db_connect_helper( int argc, VALUE *argv, int isPersisten
2526
2520
  } else {
2527
2521
  helper_args->hKey = Qnil;
2528
2522
  }
2529
-
2530
2523
  if( !NIL_P(r_literal_replacement) ) {
2531
2524
  helper_args->literal_replacement = NUM2INT(r_literal_replacement);
2532
2525
  } else {
2533
2526
  helper_args->literal_replacement = SET_QUOTED_LITERAL_REPLACEMENT_ON; /*QUOTED LITERAL replacemnt is ON by default*/
2534
2527
  }
2535
-
2536
2528
  /* Call the function where the actual logic is being run*/
2537
2529
  #ifdef UNICODE_SUPPORT_VERSION
2538
- //return_value = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_connect_helper2, helper_args,
2539
- return_value = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_connect_helper2, helper_args,
2540
- (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
2530
+
2531
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_connect_helper2, helper_args, (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
2532
+
2533
+
2534
+ conn_res = helper_args->conn_res;
2535
+
2536
+ if(helper_args->isPersistent)
2537
+ {
2538
+ if(helper_args-> entry == NULL)
2539
+ {
2540
+ return_value = Qnil;
2541
+ }
2542
+ else
2543
+ {
2544
+ return_value = helper_args->entry;
2545
+ }
2546
+ }
2547
+ else
2548
+ {
2549
+ if( conn_res == NULL )
2550
+ {
2551
+ return_value = Qnil;
2552
+ }
2553
+ else
2554
+ {
2555
+ return_value = Data_Wrap_Struct(le_conn_struct, _ruby_ibm_db_mark_conn_struct, _ruby_ibm_db_free_conn_struct, conn_res);
2556
+ }
2557
+ }
2541
2558
  #else
2542
2559
  return_value = _ruby_ibm_db_connect_helper2( helper_args );
2543
2560
  #endif
2544
-
2545
2561
  /* Free the memory allocated */
2546
2562
  if(conn_args != NULL) {
2547
2563
  /* Memory to structure elements of helper_args is not allocated explicitly hence it is automatically freed by Ruby.
2548
2564
  Dont try to explicitly free it, else a double free exception is thrown and the application will crash
2549
2565
  with memory dump.
2550
2566
  */
2551
- helper_args->conn_args = NULL;
2552
- ruby_xfree( conn_args );
2553
- conn_args = NULL;
2567
+ helper_args->conn_args = NULL;
2568
+ ruby_xfree( conn_args );
2569
+ conn_args = NULL;
2554
2570
  }
2555
-
2556
2571
  if ( helper_args != NULL ) {
2557
- ruby_xfree( helper_args );
2558
- helper_args = NULL;
2572
+ ruby_xfree( helper_args );
2573
+ helper_args = NULL;
2559
2574
  }
2560
-
2561
2575
  if( return_value == Qnil ){
2562
- rb_throw( RSTRING_PTR(error), Qnil );
2563
- }
2576
+ rb_throw( RSTRING_PTR(error), Qnil );
2577
+ }
2564
2578
  return return_value;
2565
2579
  }
2580
+
2581
+
2582
+
2583
+
2566
2584
  /*Check for feasibility of moving to other file*/
2567
2585
  typedef struct _rounding_mode_struct {
2568
2586
  stmt_handle *stmt_res;
@@ -2714,7 +2732,7 @@ static int _ruby_ibm_db_set_decfloat_rounding_mode_client( set_handle_attr_args
2714
2732
  rnd_mode->stmt_res = stmt_res;
2715
2733
 
2716
2734
  _ruby_ibm_db_set_decfloat_rounding_mode_client_helper(rnd_mode, conn_res);
2717
-
2735
+
2718
2736
  _ruby_ibm_db_free_stmt_struct( rnd_mode->stmt_res );
2719
2737
  rnd_mode->stmt_res = NULL;
2720
2738
  stmt_res = NULL;
@@ -2809,6 +2827,7 @@ static void _ruby_ibm_db_clear_conn_err_cache()
2809
2827
  */
2810
2828
  VALUE ibm_db_connect(int argc, VALUE *argv, VALUE self)
2811
2829
  {
2830
+
2812
2831
  _ruby_ibm_db_clear_conn_err_cache();
2813
2832
 
2814
2833
  return _ruby_ibm_db_connect_helper( argc, argv, 0 );
@@ -2873,13 +2892,14 @@ VALUE ibm_db_connect(int argc, VALUE *argv, VALUE self)
2873
2892
  VALUE ibm_db_pconnect(int argc, VALUE *argv, VALUE self)
2874
2893
  {
2875
2894
  _ruby_ibm_db_clear_conn_err_cache();
2876
-
2877
2895
  return _ruby_ibm_db_connect_helper( argc, argv, 1);
2896
+
2878
2897
  }
2879
2898
  /*
2880
2899
  * CreateDB helper
2881
2900
  */
2882
2901
  VALUE ruby_ibm_db_createDb_helper(VALUE connection, VALUE dbName, VALUE codeSet, VALUE mode, int createNX) {
2902
+
2883
2903
 
2884
2904
  VALUE return_value = Qfalse;
2885
2905
  #ifdef UNICODE_SUPPORT_VERSION
@@ -2895,13 +2915,13 @@ VALUE ruby_ibm_db_createDb_helper(VALUE connection, VALUE dbName, VALUE codeSet,
2895
2915
 
2896
2916
  if (!NIL_P(connection)) {
2897
2917
  Data_Get_Struct(connection, conn_handle, conn_res);
2898
-
2918
+
2899
2919
  if( 0 == createDbSupported ) {
2900
2920
  rb_warn("Create Database not supported: This function is only supported from DB2 Client v97fp4 version and onwards");
2901
2921
  return Qfalse;
2902
2922
  }
2903
-
2904
- if (!conn_res->handle_active) {
2923
+
2924
+ if (!conn_res || !conn_res->handle_active) {
2905
2925
  rb_warn("Connection is not active");
2906
2926
  return Qfalse;
2907
2927
  }
@@ -2953,10 +2973,10 @@ VALUE ruby_ibm_db_createDb_helper(VALUE connection, VALUE dbName, VALUE codeSet,
2953
2973
 
2954
2974
  _ruby_ibm_db_clear_conn_err_cache();
2955
2975
 
2956
- #ifdef UNICODE_SUPPORT_VERSION
2957
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLCreateDB_helper, create_db_args,
2958
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLCreateDB_helper, create_db_args,
2976
+ #ifdef UNICODE_SUPPORT_VERSION
2977
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLCreateDB_helper, create_db_args,
2959
2978
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL );
2979
+ rc = create_db_args->rc;
2960
2980
  #else
2961
2981
  rc = _ruby_ibm_db_SQLCreateDB_helper( create_db_args );
2962
2982
  #endif
@@ -3056,8 +3076,8 @@ VALUE ruby_ibm_db_dropDb_helper(VALUE connection, VALUE dbName) {
3056
3076
  rb_warn("Drop Database not supported: This function is only supported from DB2 Client v97fp4 version and onwards");
3057
3077
  return Qfalse;
3058
3078
  }
3059
-
3060
- if (!conn_res->handle_active) {
3079
+
3080
+ if (!conn_res || !conn_res->handle_active) {
3061
3081
  rb_warn("Connection is not active");
3062
3082
  return Qfalse;
3063
3083
  }
@@ -3083,10 +3103,10 @@ VALUE ruby_ibm_db_dropDb_helper(VALUE connection, VALUE dbName) {
3083
3103
 
3084
3104
  _ruby_ibm_db_clear_conn_err_cache();
3085
3105
 
3086
- #ifdef UNICODE_SUPPORT_VERSION
3087
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDropDB_helper, drop_db_args,
3088
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDropDB_helper, drop_db_args,
3106
+ #ifdef UNICODE_SUPPORT_VERSION
3107
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDropDB_helper, drop_db_args,
3089
3108
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL );
3109
+ rc = drop_db_args->rc;
3090
3110
  #else
3091
3111
  rc = _ruby_ibm_db_SQLDropDB_helper( drop_db_args );
3092
3112
  #endif
@@ -3288,12 +3308,11 @@ VALUE ibm_db_autocommit(int argc, VALUE *argv, VALUE self)
3288
3308
 
3289
3309
  if (!NIL_P(connection)) {
3290
3310
  Data_Get_Struct(connection, conn_handle, conn_res);
3291
-
3292
- if (!conn_res->handle_active) {
3311
+
3312
+ if (!conn_res || !conn_res->handle_active) {
3293
3313
  rb_warn("Connection is not active");
3294
3314
  return Qfalse;
3295
3315
  }
3296
-
3297
3316
  /* If value in handle is different from value passed in */
3298
3317
  if (argc == 2) {
3299
3318
  autocommit = FIX2INT(value);
@@ -3304,16 +3323,13 @@ VALUE ibm_db_autocommit(int argc, VALUE *argv, VALUE self)
3304
3323
  handleAttr_args->handle = &( conn_res->hdbc );
3305
3324
  handleAttr_args->strLength = SQL_IS_INTEGER;
3306
3325
  handleAttr_args->attribute = SQL_ATTR_AUTOCOMMIT;
3307
-
3308
3326
 
3309
3327
  #ifndef PASE
3310
3328
  handleAttr_args->valuePtr = (SQLPOINTER)autocommit;
3311
3329
  #else
3312
3330
  handleAttr_args->valuePtr = (SQLPOINTER)&autocommit;
3313
3331
  #endif
3314
-
3315
3332
  rc = _ruby_ibm_db_SQLSetConnectAttr_helper( handleAttr_args );
3316
-
3317
3333
  if ( rc == SQL_ERROR ) {
3318
3334
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 1 );
3319
3335
  } else {
@@ -3323,7 +3339,7 @@ VALUE ibm_db_autocommit(int argc, VALUE *argv, VALUE self)
3323
3339
  * Hence set flag_transaction to 0 indicating no transaction is in progress */
3324
3340
  if( autocommit == SQL_AUTOCOMMIT_ON ) {
3325
3341
  conn_res->transaction_active = 0;
3326
- }
3342
+ }
3327
3343
  }
3328
3344
  }
3329
3345
  ruby_xfree( handleAttr_args );
@@ -3333,12 +3349,10 @@ VALUE ibm_db_autocommit(int argc, VALUE *argv, VALUE self)
3333
3349
  ret_val = INT2NUM(conn_res->auto_commit);
3334
3350
  }
3335
3351
  }
3336
-
3337
3352
  if ( handleAttr_args != NULL ) {
3338
3353
  ruby_xfree( handleAttr_args );
3339
3354
  handleAttr_args = NULL;
3340
3355
  }
3341
-
3342
3356
  return ret_val;
3343
3357
  }
3344
3358
  /* */
@@ -3434,6 +3448,7 @@ static void _ruby_ibm_db_add_param_cache( stmt_handle *stmt_res, int param_no, c
3434
3448
  */
3435
3449
  VALUE ibm_db_bind_param_helper(int argc, char * varname, long varname_len ,long param_type, long data_type,
3436
3450
  long precision, long scale, long size, stmt_handle *stmt_res, describeparam_args *data) {
3451
+
3437
3452
  int rc = 0;
3438
3453
  VALUE return_value = Qtrue;
3439
3454
  #ifdef UNICODE_SUPPORT_VERSION
@@ -3446,10 +3461,11 @@ VALUE ibm_db_bind_param_helper(int argc, char * varname, long varname_len ,long
3446
3461
  case 3:
3447
3462
  param_type = SQL_PARAM_INPUT;
3448
3463
 
3449
- #ifdef UNICODE_SUPPORT_VERSION
3450
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3451
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3464
+ #ifdef UNICODE_SUPPORT_VERSION
3465
+
3466
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3452
3467
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res);
3468
+ rc = data->rc;
3453
3469
  #else
3454
3470
  rc = _ruby_ibm_db_SQLDescribeParam_helper( data );
3455
3471
  #endif
@@ -3467,10 +3483,10 @@ VALUE ibm_db_bind_param_helper(int argc, char * varname, long varname_len ,long
3467
3483
 
3468
3484
  case 4:
3469
3485
 
3470
- #ifdef UNICODE_SUPPORT_VERSION
3471
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3472
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3486
+ #ifdef UNICODE_SUPPORT_VERSION
3487
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3473
3488
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res);
3489
+ rc = data->rc;
3474
3490
  #else
3475
3491
  rc = _ruby_ibm_db_SQLDescribeParam_helper( data );
3476
3492
  #endif
@@ -3488,10 +3504,10 @@ VALUE ibm_db_bind_param_helper(int argc, char * varname, long varname_len ,long
3488
3504
 
3489
3505
  case 5:
3490
3506
 
3491
- #ifdef UNICODE_SUPPORT_VERSION
3492
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3493
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3507
+ #ifdef UNICODE_SUPPORT_VERSION
3508
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3494
3509
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
3510
+ rc = data->rc;
3495
3511
  #else
3496
3512
  rc = _ruby_ibm_db_SQLDescribeParam_helper( data );
3497
3513
  #endif
@@ -3510,10 +3526,10 @@ VALUE ibm_db_bind_param_helper(int argc, char * varname, long varname_len ,long
3510
3526
 
3511
3527
  case 6:
3512
3528
 
3513
- #ifdef UNICODE_SUPPORT_VERSION
3514
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3515
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3529
+ #ifdef UNICODE_SUPPORT_VERSION
3530
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDescribeParam_helper, data,
3516
3531
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
3532
+ rc = data->rc;
3517
3533
  #else
3518
3534
  rc = _ruby_ibm_db_SQLDescribeParam_helper( data );
3519
3535
  #endif
@@ -3689,6 +3705,7 @@ VALUE ibm_db_bind_param(int argc, VALUE *argv, VALUE self)
3689
3705
  ruby_xfree( desc_param_args );
3690
3706
  desc_param_args = NULL;
3691
3707
  }
3708
+
3692
3709
  return return_value;
3693
3710
  }
3694
3711
  /* */
@@ -3728,7 +3745,8 @@ VALUE ibm_db_close(int argc, VALUE *argv, VALUE self)
3728
3745
  /* Check to see if it's a persistent connection; if so, just return true */
3729
3746
  Data_Get_Struct(connection, conn_handle, conn_res);
3730
3747
 
3731
- if (!conn_res->handle_active) {
3748
+
3749
+ if (!conn_res || !conn_res->handle_active) {
3732
3750
  rb_warn("Connection is not active");
3733
3751
  return Qfalse;
3734
3752
  }
@@ -3743,10 +3761,10 @@ VALUE ibm_db_close(int argc, VALUE *argv, VALUE self)
3743
3761
  end_X_args->handleType = SQL_HANDLE_DBC;
3744
3762
  end_X_args->completionType = SQL_ROLLBACK; /*Remeber you are rolling back the transaction*/
3745
3763
 
3746
- #ifdef UNICODE_SUPPORT_VERSION
3747
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
3748
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
3764
+ #ifdef UNICODE_SUPPORT_VERSION
3765
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
3749
3766
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
3767
+ rc = end_X_args->rc;
3750
3768
  #else
3751
3769
  rc = _ruby_ibm_db_SQLEndTran( end_X_args );
3752
3770
  #endif
@@ -3763,18 +3781,16 @@ VALUE ibm_db_close(int argc, VALUE *argv, VALUE self)
3763
3781
  }
3764
3782
 
3765
3783
  #ifdef UNICODE_SUPPORT_VERSION
3766
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLDisconnect_helper, &(conn_res->hdbc),
3767
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDisconnect_helper, &(conn_res->hdbc),
3768
- (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
3784
+ rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLDisconnect_helper, &(conn_res->hdbc),
3785
+ (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
3769
3786
  #else
3770
- rc = _ruby_ibm_db_SQLDisconnect_helper( &(conn_res->hdbc) );
3787
+ rc = _ruby_ibm_db_SQLDisconnect_helper( &(conn_res->hdbc) );
3771
3788
  #endif
3772
3789
 
3773
3790
  if ( rc == SQL_ERROR ) {
3774
3791
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 1 );
3775
3792
  return_value = Qfalse;
3776
3793
  } else {
3777
-
3778
3794
  rc = SQLFreeHandle( SQL_HANDLE_DBC, conn_res->hdbc);
3779
3795
  if ( rc == SQL_ERROR ) {
3780
3796
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 1 );
@@ -3798,6 +3814,7 @@ VALUE ibm_db_close(int argc, VALUE *argv, VALUE self)
3798
3814
  } else {
3799
3815
  return_value = Qfalse;
3800
3816
  }
3817
+
3801
3818
  return return_value;
3802
3819
  }
3803
3820
  /* */
@@ -3940,10 +3957,10 @@ VALUE ibm_db_column_privileges(int argc, VALUE *argv, VALUE self)
3940
3957
  }
3941
3958
  col_privileges_args->stmt_res = stmt_res;
3942
3959
 
3943
- #ifdef UNICODE_SUPPORT_VERSION
3944
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLColumnPrivileges_helper, col_privileges_args,
3945
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColumnPrivileges_helper, col_privileges_args,
3960
+ #ifdef UNICODE_SUPPORT_VERSION
3961
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColumnPrivileges_helper, col_privileges_args,
3946
3962
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
3963
+ rc = col_privileges_args->rc;
3947
3964
  #else
3948
3965
  rc = _ruby_ibm_db_SQLColumnPrivileges_helper( col_privileges_args );
3949
3966
  #endif
@@ -3952,7 +3969,6 @@ VALUE ibm_db_column_privileges(int argc, VALUE *argv, VALUE self)
3952
3969
 
3953
3970
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, (SQLHSTMT)stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
3954
3971
  NULL, NULL, -1, 1, 1 );
3955
-
3956
3972
  _ruby_ibm_db_free_stmt_struct( stmt_res );
3957
3973
  stmt_res = NULL;
3958
3974
 
@@ -4066,7 +4082,7 @@ VALUE ibm_db_columns(int argc, VALUE *argv, VALUE self)
4066
4082
  if (!NIL_P(connection)) {
4067
4083
  Data_Get_Struct(connection, conn_handle, conn_res);
4068
4084
 
4069
- if ( !conn_res->handle_active ) {
4085
+ if ( !conn_res || !conn_res->handle_active ) {
4070
4086
  rb_warn("Connection is not active");
4071
4087
  return_value = Qfalse;
4072
4088
  } else {
@@ -4121,10 +4137,10 @@ VALUE ibm_db_columns(int argc, VALUE *argv, VALUE self)
4121
4137
  }
4122
4138
  col_metadata_args->stmt_res = stmt_res;
4123
4139
 
4124
- #ifdef UNICODE_SUPPORT_VERSION
4125
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLColumns_helper, col_metadata_args,
4126
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColumns_helper, col_metadata_args,
4140
+ #ifdef UNICODE_SUPPORT_VERSION
4141
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColumns_helper, col_metadata_args,
4127
4142
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
4143
+ rc = col_metadata_args->rc;
4128
4144
  #else
4129
4145
  rc = _ruby_ibm_db_SQLColumns_helper( col_metadata_args );
4130
4146
  #endif
@@ -4133,7 +4149,6 @@ VALUE ibm_db_columns(int argc, VALUE *argv, VALUE self)
4133
4149
 
4134
4150
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, (SQLHSTMT)stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4135
4151
  NULL, NULL, -1, 1, 1 );
4136
-
4137
4152
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4138
4153
  stmt_res = NULL;
4139
4154
 
@@ -4207,6 +4222,7 @@ VALUE ibm_db_columns(int argc, VALUE *argv, VALUE self)
4207
4222
  */
4208
4223
  VALUE ibm_db_foreign_keys(int argc, VALUE *argv, VALUE self)
4209
4224
  {
4225
+
4210
4226
  VALUE r_qualifier = Qnil;
4211
4227
  VALUE r_owner = Qnil;
4212
4228
  VALUE r_table_name = Qnil;
@@ -4288,10 +4304,10 @@ VALUE ibm_db_foreign_keys(int argc, VALUE *argv, VALUE self)
4288
4304
 
4289
4305
  col_metadata_args->stmt_res = stmt_res;
4290
4306
 
4291
- #ifdef UNICODE_SUPPORT_VERSION
4292
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLForeignKeys_helper, col_metadata_args,
4293
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLForeignKeys_helper, col_metadata_args,
4307
+ #ifdef UNICODE_SUPPORT_VERSION
4308
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLForeignKeys_helper, col_metadata_args,
4294
4309
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
4310
+ rc = col_metadata_args->rc;
4295
4311
  #else
4296
4312
  rc = _ruby_ibm_db_SQLForeignKeys_helper( col_metadata_args );
4297
4313
  #endif
@@ -4300,7 +4316,6 @@ VALUE ibm_db_foreign_keys(int argc, VALUE *argv, VALUE self)
4300
4316
 
4301
4317
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4302
4318
  NULL, NULL, -1, 1, 1 );
4303
-
4304
4319
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4305
4320
  stmt_res = NULL;
4306
4321
 
@@ -4445,10 +4460,10 @@ VALUE ibm_db_primary_keys(int argc, VALUE *argv, VALUE self)
4445
4460
  }
4446
4461
  col_metadata_args->stmt_res = stmt_res;
4447
4462
 
4448
- #ifdef UNICODE_SUPPORT_VERSION
4449
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLPrimaryKeys_helper, col_metadata_args,
4450
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLPrimaryKeys_helper, col_metadata_args,
4463
+ #ifdef UNICODE_SUPPORT_VERSION
4464
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLPrimaryKeys_helper, col_metadata_args,
4451
4465
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
4466
+ rc = col_metadata_args->rc;
4452
4467
  #else
4453
4468
  rc = _ruby_ibm_db_SQLPrimaryKeys_helper( col_metadata_args );
4454
4469
  #endif
@@ -4457,7 +4472,6 @@ VALUE ibm_db_primary_keys(int argc, VALUE *argv, VALUE self)
4457
4472
 
4458
4473
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4459
4474
  NULL, NULL, -1, 1, 1 );
4460
-
4461
4475
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4462
4476
  stmt_res = NULL;
4463
4477
 
@@ -4582,7 +4596,7 @@ VALUE ibm_db_procedure_columns(int argc, VALUE *argv, VALUE self)
4582
4596
  if (!NIL_P(connection)) {
4583
4597
  Data_Get_Struct(connection, conn_handle, conn_res);
4584
4598
 
4585
- if (!conn_res->handle_active) {
4599
+ if (!conn_res || !conn_res->handle_active) {
4586
4600
  rb_warn("Connection is not active");
4587
4601
  return_value = Qfalse;
4588
4602
  } else {
@@ -4637,10 +4651,10 @@ VALUE ibm_db_procedure_columns(int argc, VALUE *argv, VALUE self)
4637
4651
  }
4638
4652
  col_metadata_args->stmt_res = stmt_res;
4639
4653
 
4640
- #ifdef UNICODE_SUPPORT_VERSION
4641
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLProcedureColumns_helper, col_metadata_args,
4642
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLProcedureColumns_helper, col_metadata_args,
4654
+ #ifdef UNICODE_SUPPORT_VERSION
4655
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLProcedureColumns_helper, col_metadata_args,
4643
4656
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res);
4657
+ rc = col_metadata_args->rc;
4644
4658
  #else
4645
4659
  rc = _ruby_ibm_db_SQLProcedureColumns_helper( col_metadata_args );
4646
4660
  #endif
@@ -4649,7 +4663,6 @@ VALUE ibm_db_procedure_columns(int argc, VALUE *argv, VALUE self)
4649
4663
 
4650
4664
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4651
4665
  NULL, NULL, -1, 1, 1 );
4652
-
4653
4666
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4654
4667
  stmt_res = NULL;
4655
4668
 
@@ -4750,7 +4763,7 @@ VALUE ibm_db_procedures(int argc, VALUE *argv, VALUE self)
4750
4763
  if (!NIL_P(connection)) {
4751
4764
  Data_Get_Struct(connection, conn_handle, conn_res);
4752
4765
 
4753
- if (!conn_res->handle_active) {
4766
+ if (!conn_res || !conn_res->handle_active) {
4754
4767
  rb_warn("Connection is not active");
4755
4768
  return_value = Qfalse;
4756
4769
  } else {
@@ -4795,10 +4808,10 @@ VALUE ibm_db_procedures(int argc, VALUE *argv, VALUE self)
4795
4808
  }
4796
4809
  proc_metadata_args->stmt_res = stmt_res;
4797
4810
 
4798
- #ifdef UNICODE_SUPPORT_VERSION
4799
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLProcedures_helper, proc_metadata_args,
4800
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLProcedures_helper, proc_metadata_args,
4811
+ #ifdef UNICODE_SUPPORT_VERSION
4812
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLProcedures_helper, proc_metadata_args,
4801
4813
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res);
4814
+ rc = proc_metadata_args->rc;
4802
4815
  #else
4803
4816
  rc = _ruby_ibm_db_SQLProcedures_helper( proc_metadata_args );
4804
4817
  #endif
@@ -4807,7 +4820,6 @@ VALUE ibm_db_procedures(int argc, VALUE *argv, VALUE self)
4807
4820
 
4808
4821
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4809
4822
  NULL, NULL, -1, 1, 1 );
4810
-
4811
4823
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4812
4824
  stmt_res = NULL;
4813
4825
 
@@ -4925,7 +4937,7 @@ VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self)
4925
4937
  if (!NIL_P(connection)) {
4926
4938
  Data_Get_Struct(connection, conn_handle, conn_res);
4927
4939
 
4928
- if (!conn_res->handle_active) {
4940
+ if (!conn_res || !conn_res->handle_active) {
4929
4941
  rb_warn("Connection is not active");
4930
4942
  return_value = Qfalse;
4931
4943
  } else {
@@ -4973,10 +4985,10 @@ VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self)
4973
4985
  }
4974
4986
  col_metadata_args->stmt_res = stmt_res;
4975
4987
 
4976
- #ifdef UNICODE_SUPPORT_VERSION
4977
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLSpecialColumns_helper, col_metadata_args,
4978
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLSpecialColumns_helper, col_metadata_args,
4988
+ #ifdef UNICODE_SUPPORT_VERSION
4989
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLSpecialColumns_helper, col_metadata_args,
4979
4990
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res);
4991
+ rc = col_metadata_args->rc;
4980
4992
  #else
4981
4993
  rc = _ruby_ibm_db_SQLSpecialColumns_helper( col_metadata_args );
4982
4994
  #endif
@@ -4985,7 +4997,6 @@ VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self)
4985
4997
 
4986
4998
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
4987
4999
  NULL, NULL, -1, 1, 1 );
4988
-
4989
5000
  _ruby_ibm_db_free_stmt_struct( stmt_res );
4990
5001
  stmt_res = NULL;
4991
5002
 
@@ -5085,6 +5096,7 @@ VALUE ibm_db_special_columns(int argc, VALUE *argv, VALUE self)
5085
5096
  */
5086
5097
  VALUE ibm_db_statistics(int argc, VALUE *argv, VALUE self)
5087
5098
  {
5099
+
5088
5100
  VALUE r_qualifier = Qnil;
5089
5101
  VALUE r_owner = Qnil;
5090
5102
  VALUE r_table_name = Qnil;
@@ -5121,7 +5133,7 @@ VALUE ibm_db_statistics(int argc, VALUE *argv, VALUE self)
5121
5133
  if (!NIL_P(connection)) {
5122
5134
  Data_Get_Struct(connection, conn_handle, conn_res);
5123
5135
 
5124
- if (!conn_res->handle_active) {
5136
+ if (!conn_res || !conn_res->handle_active) {
5125
5137
  rb_warn("Connection is not active");
5126
5138
  return_value = Qfalse;
5127
5139
  } else {
@@ -5169,10 +5181,10 @@ VALUE ibm_db_statistics(int argc, VALUE *argv, VALUE self)
5169
5181
  }
5170
5182
  col_metadata_args->stmt_res = stmt_res;
5171
5183
 
5172
- #ifdef UNICODE_SUPPORT_VERSION
5173
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLStatistics_helper, col_metadata_args,
5174
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLStatistics_helper, col_metadata_args,
5184
+ #ifdef UNICODE_SUPPORT_VERSION
5185
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLStatistics_helper, col_metadata_args,
5175
5186
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5187
+ rc = col_metadata_args->rc;
5176
5188
  #else
5177
5189
  rc = _ruby_ibm_db_SQLStatistics_helper( col_metadata_args );
5178
5190
  #endif
@@ -5181,7 +5193,6 @@ VALUE ibm_db_statistics(int argc, VALUE *argv, VALUE self)
5181
5193
 
5182
5194
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
5183
5195
  NULL, NULL, -1, 1, 1 );
5184
-
5185
5196
  _ruby_ibm_db_free_stmt_struct( stmt_res );
5186
5197
  stmt_res = NULL;
5187
5198
 
@@ -5329,10 +5340,10 @@ VALUE ibm_db_table_privileges(int argc, VALUE *argv, VALUE self)
5329
5340
 
5330
5341
  table_privileges_args->stmt_res = stmt_res;
5331
5342
 
5332
- #ifdef UNICODE_SUPPORT_VERSION
5333
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLTablePrivileges_helper, table_privileges_args,
5334
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLTablePrivileges_helper, table_privileges_args,
5343
+ #ifdef UNICODE_SUPPORT_VERSION
5344
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLTablePrivileges_helper, table_privileges_args,
5335
5345
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5346
+ rc = table_privileges_args->rc;
5336
5347
  #else
5337
5348
  rc = _ruby_ibm_db_SQLTablePrivileges_helper( table_privileges_args );
5338
5349
  #endif
@@ -5341,7 +5352,6 @@ VALUE ibm_db_table_privileges(int argc, VALUE *argv, VALUE self)
5341
5352
 
5342
5353
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
5343
5354
  NULL, NULL, -1, 1, 1 );
5344
-
5345
5355
  _ruby_ibm_db_free_stmt_struct( stmt_res );
5346
5356
  stmt_res = NULL;
5347
5357
 
@@ -5447,7 +5457,7 @@ VALUE ibm_db_tables(int argc, VALUE *argv, VALUE self)
5447
5457
  if (!NIL_P(connection)) {
5448
5458
  Data_Get_Struct(connection, conn_handle, conn_res);
5449
5459
 
5450
- if (!conn_res->handle_active) {
5460
+ if (!conn_res || !conn_res->handle_active) {
5451
5461
  rb_warn("Connection is not active");
5452
5462
  return_value = Qfalse;
5453
5463
  } else {
@@ -5504,10 +5514,10 @@ VALUE ibm_db_tables(int argc, VALUE *argv, VALUE self)
5504
5514
 
5505
5515
  table_metadata_args->stmt_res = stmt_res;
5506
5516
 
5507
- #ifdef UNICODE_SUPPORT_VERSION
5508
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLTables_helper, table_metadata_args,
5509
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLTables_helper, table_metadata_args,
5517
+ #ifdef UNICODE_SUPPORT_VERSION
5518
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLTables_helper, table_metadata_args,
5510
5519
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5520
+ rc = table_metadata_args->rc;
5511
5521
  #else
5512
5522
  rc = _ruby_ibm_db_SQLTables_helper( table_metadata_args );
5513
5523
  #endif
@@ -5516,7 +5526,6 @@ VALUE ibm_db_tables(int argc, VALUE *argv, VALUE self)
5516
5526
 
5517
5527
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1,
5518
5528
  NULL, NULL, -1, 1, 1 );
5519
-
5520
5529
  _ruby_ibm_db_free_stmt_struct( stmt_res );
5521
5530
  stmt_res = NULL;
5522
5531
 
@@ -5575,7 +5584,7 @@ VALUE ibm_db_commit(int argc, VALUE *argv, VALUE self)
5575
5584
  if (!NIL_P(connection)) {
5576
5585
  Data_Get_Struct(connection, conn_handle, conn_res);
5577
5586
 
5578
- if (!conn_res->handle_active) {
5587
+ if (!conn_res || !conn_res->handle_active) {
5579
5588
  rb_warn("Connection is not active");
5580
5589
  return Qfalse;
5581
5590
  }
@@ -5587,10 +5596,10 @@ VALUE ibm_db_commit(int argc, VALUE *argv, VALUE self)
5587
5596
  end_X_args->handleType = SQL_HANDLE_DBC;
5588
5597
  end_X_args->completionType = SQL_COMMIT; /*Remeber you are Commiting the transaction*/
5589
5598
 
5590
- #ifdef UNICODE_SUPPORT_VERSION
5591
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
5592
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
5599
+ #ifdef UNICODE_SUPPORT_VERSION
5600
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
5593
5601
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
5602
+ rc = end_X_args->rc;
5594
5603
  #else
5595
5604
  rc = _ruby_ibm_db_SQLEndTran( end_X_args );
5596
5605
  #endif
@@ -5609,7 +5618,6 @@ VALUE ibm_db_commit(int argc, VALUE *argv, VALUE self)
5609
5618
  return Qtrue;
5610
5619
  }
5611
5620
  }
5612
-
5613
5621
  return Qfalse;
5614
5622
  }
5615
5623
  /* */
@@ -5668,10 +5676,10 @@ static int _ruby_ibm_db_do_prepare(conn_handle *conn_res, VALUE stmt, stmt_handl
5668
5676
  prepare_args->stmt_res = stmt_res;
5669
5677
 
5670
5678
  /* Prepare the stmt. The cursor type requested has already been set in _ruby_ibm_db_assign_options */
5671
- #ifdef UNICODE_SUPPORT_VERSION
5672
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLPrepare_helper, prepare_args,
5673
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLPrepare_helper, prepare_args,
5679
+ #ifdef UNICODE_SUPPORT_VERSION
5680
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLPrepare_helper, prepare_args,
5674
5681
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5682
+ rc = prepare_args->rc;
5675
5683
  #else
5676
5684
  rc = _ruby_ibm_db_SQLPrepare_helper( prepare_args );
5677
5685
  #endif
@@ -5751,15 +5759,17 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
5751
5759
  /* This function basically is a wrap of the _ruby_ibm_db_do_prepare and _ruby_ibm_db_execute_stmt */
5752
5760
  /* After completing statement execution, it returns the statement resource */
5753
5761
  rb_scan_args(argc, argv, "21", &connection, &stmt, &options);
5762
+
5754
5763
 
5755
5764
  if (!NIL_P(connection)) {
5756
5765
  Data_Get_Struct(connection, conn_handle, conn_res);
5757
-
5758
- if (!conn_res->handle_active) {
5766
+
5767
+ if (!conn_res || !conn_res->handle_active) {
5759
5768
  rb_warn("Connection is not active");
5760
5769
  return Qfalse;
5761
5770
  }
5762
-
5771
+
5772
+
5763
5773
  if (!NIL_P(stmt)) {
5764
5774
  exec_direct_args = ALLOC( exec_cum_prepare_args );
5765
5775
  memset(exec_direct_args,'\0',sizeof(struct _ibm_db_exec_direct_args_struct));
@@ -5776,11 +5786,11 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
5776
5786
  rb_warn("Supplied parameter is invalid");
5777
5787
  return Qfalse;
5778
5788
  }
5779
-
5789
+
5780
5790
  _ruby_ibm_db_clear_stmt_err_cache();
5781
5791
 
5782
5792
  stmt_res = _ibm_db_new_stmt_struct(conn_res);
5783
-
5793
+
5784
5794
  /* Allocates the stmt handle */
5785
5795
  /* returns the stat_handle back to the calling function */
5786
5796
  rc = SQLAllocHandle(SQL_HANDLE_STMT, conn_res->hdbc, &(stmt_res->hstmt));
@@ -5807,19 +5817,19 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
5807
5817
 
5808
5818
  exec_direct_args->stmt_res = stmt_res;
5809
5819
 
5810
- #ifdef UNICODE_SUPPORT_VERSION
5811
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLExecDirect_helper, exec_direct_args,
5812
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLExecDirect_helper, exec_direct_args,
5820
+
5821
+ #ifdef UNICODE_SUPPORT_VERSION
5822
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLExecDirect_helper, exec_direct_args,
5813
5823
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5824
+ rc = exec_direct_args->rc;
5814
5825
  #else
5815
5826
  rc = _ruby_ibm_db_SQLExecDirect_helper( exec_direct_args );
5816
5827
  #endif
5817
-
5828
+
5818
5829
  if ( rc == SQL_ERROR ) {
5819
5830
 
5820
5831
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, stmt_res->hstmt,
5821
5832
  SQL_HANDLE_STMT, rc, 1, NULL, NULL, -1, 1, 1 );
5822
-
5823
5833
  _ruby_ibm_db_free_stmt_struct( stmt_res );
5824
5834
  stmt_res = NULL;
5825
5835
 
@@ -5836,7 +5846,6 @@ VALUE ibm_db_exec(int argc, VALUE *argv, VALUE self)
5836
5846
  ruby_xfree( exec_direct_args );
5837
5847
  exec_direct_args = NULL;
5838
5848
  }
5839
-
5840
5849
  return return_value;
5841
5850
  }
5842
5851
  /* */
@@ -5883,10 +5892,10 @@ VALUE ibm_db_free_result(int argc, VALUE *argv, VALUE self)
5883
5892
  freeStmt_args->stmt_res = stmt_res;
5884
5893
  freeStmt_args->option = SQL_CLOSE;
5885
5894
 
5886
- #ifdef UNICODE_SUPPORT_VERSION
5887
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLFreeStmt_helper, freeStmt_args,
5888
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLFreeStmt_helper, freeStmt_args,
5895
+ #ifdef UNICODE_SUPPORT_VERSION
5896
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLFreeStmt_helper, freeStmt_args,
5889
5897
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
5898
+ rc = freeStmt_args->rc;
5890
5899
  #else
5891
5900
  rc = _ruby_ibm_db_SQLFreeStmt_helper( freeStmt_args );
5892
5901
  #endif
@@ -5985,7 +5994,7 @@ VALUE ibm_db_prepare(int argc, VALUE *argv, VALUE self)
5985
5994
  if (!NIL_P(connection)) {
5986
5995
  Data_Get_Struct(connection, conn_handle, conn_res);
5987
5996
 
5988
- if (!conn_res->handle_active) {
5997
+ if (!conn_res || !conn_res->handle_active) {
5989
5998
  rb_warn("Connection is not active");
5990
5999
  return Qfalse;
5991
6000
  }
@@ -6487,6 +6496,7 @@ static int _ruby_ibm_db_bind_param_list(stmt_handle *stmt_res, VALUE *error ) {
6487
6496
  static int _ruby_ibm_db_execute_helper2(stmt_handle *stmt_res, VALUE *data, int bind_cmp_list,
6488
6497
  int bind_params, VALUE *error )
6489
6498
  {
6499
+
6490
6500
  int rc = SQL_SUCCESS;
6491
6501
  param_node *curr = NULL; /* To traverse the list */
6492
6502
 
@@ -6649,6 +6659,7 @@ void var_assign(char *name, VALUE value) {
6649
6659
  ruby_xfree( statement );
6650
6660
  statement = NULL;
6651
6661
  #endif
6662
+
6652
6663
  }
6653
6664
 
6654
6665
  /*
@@ -6756,6 +6767,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6756
6767
  *error = rb_str_new2("Execute Failed due to: <error message could not be retrieved>");
6757
6768
  #endif
6758
6769
  }
6770
+ bind_array->return_value = Qnil;
6759
6771
  return Qnil;
6760
6772
  }
6761
6773
 
@@ -6778,15 +6790,18 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6778
6790
  #else
6779
6791
  *error = rb_str_new2("Param is not an array");
6780
6792
  #endif
6793
+ bind_array->return_value = Qnil;
6781
6794
  return Qnil;
6782
6795
  }
6783
6796
 
6784
6797
  ret_value = _ruby_ibm_db_desc_and_bind_param_list(bind_array, error );
6785
6798
 
6786
6799
  if(ret_value == Qnil ) {
6800
+ bind_array->return_value = Qnil;
6787
6801
  return Qnil;
6788
6802
  }
6789
6803
  if(ret_value == Qfalse) {
6804
+ bind_array->return_value = Qfalse;
6790
6805
  return Qfalse;
6791
6806
  }
6792
6807
 
@@ -6800,6 +6815,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6800
6815
  #else
6801
6816
  *error = rb_str_new2("Number of params passed are more than bound parameters");
6802
6817
  #endif
6818
+ bind_array->return_value = Qnil;
6803
6819
  return Qnil;
6804
6820
  } else if ( num < stmt_res->num_params ) {
6805
6821
  /* Fewer parameters than we expected */
@@ -6808,6 +6824,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6808
6824
  #else
6809
6825
  *error = rb_str_new2("Number of params passed are less than bound parameters");
6810
6826
  #endif
6827
+ bind_array->return_value = Qnil;
6811
6828
  return Qnil;
6812
6829
  }
6813
6830
 
@@ -6818,6 +6835,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6818
6835
  #else
6819
6836
  *error = rb_str_new2("Parameters not bound");
6820
6837
  #endif
6838
+ bind_array->return_value = Qnil;
6821
6839
  return Qnil;
6822
6840
  } else {
6823
6841
  /* The 1 denotes that you work with the whole list */
@@ -6826,6 +6844,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6826
6844
  rc = _ruby_ibm_db_execute_helper2(stmt_res, NULL, 1, 0, error );
6827
6845
 
6828
6846
  if ( rc == SQL_ERROR ) {
6847
+ bind_array->return_value = Qnil;
6829
6848
  return Qnil;
6830
6849
  }
6831
6850
  }
@@ -6853,6 +6872,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6853
6872
  *error = rb_str_new2("Statement Execute Failed: <error message could not be retrieved>");
6854
6873
  #endif
6855
6874
  }
6875
+ bind_array->return_value = Qnil;
6856
6876
  return Qnil;
6857
6877
  }
6858
6878
 
@@ -6892,7 +6912,7 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6892
6912
  ruby_xfree( put_param_data_args );
6893
6913
  put_param_data_args = NULL;
6894
6914
  }
6895
-
6915
+ bind_array->return_value = Qnil;
6896
6916
  return Qnil;
6897
6917
  }
6898
6918
  rc = _ruby_ibm_db_SQLParamData_helper( put_param_data_args );
@@ -6921,11 +6941,12 @@ static VALUE _ruby_ibm_db_execute_helper(stmt_bind_array *bind_array) {
6921
6941
  *error = rb_str_new2("Sending data failed: <error message could not be retrieved>");
6922
6942
  #endif
6923
6943
  }
6924
-
6944
+ bind_array->return_value = Qnil;
6925
6945
  return Qnil;
6926
6946
  }
6927
6947
  }
6928
6948
 
6949
+ bind_array->return_value = Qtrue;
6929
6950
  return Qtrue;
6930
6951
  }
6931
6952
  /*
@@ -6989,10 +7010,10 @@ VALUE ibm_db_execute(int argc, VALUE *argv, VALUE self)
6989
7010
  bind_array->num = 0;
6990
7011
  bind_array->error = &error;
6991
7012
 
6992
- #ifdef UNICODE_SUPPORT_VERSION
6993
- //ret_value = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_execute_helper, bind_array,
6994
- ret_value = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_execute_helper, bind_array,
7013
+ #ifdef UNICODE_SUPPORT_VERSION
7014
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_execute_helper, bind_array,
6995
7015
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
7016
+ ret_value = bind_array->return_value;
6996
7017
  #else
6997
7018
  ret_value = _ruby_ibm_db_execute_helper( bind_array );
6998
7019
  #endif
@@ -7155,7 +7176,7 @@ VALUE ibm_db_conn_errormsg(int argc, VALUE *argv, VALUE self)
7155
7176
  if (!NIL_P(connection)) {
7156
7177
  Data_Get_Struct(connection, conn_handle, conn_res);
7157
7178
 
7158
- if (!conn_res->handle_active) {
7179
+ if (!conn_res || !conn_res->handle_active) {
7159
7180
  rb_warn("Connection is not active");
7160
7181
  return Qnil;
7161
7182
  }
@@ -7309,7 +7330,7 @@ VALUE ibm_db_conn_error(int argc, VALUE *argv, VALUE self)
7309
7330
  if (!NIL_P(connection)) {
7310
7331
  Data_Get_Struct(connection, conn_handle, conn_res);
7311
7332
 
7312
- if (!conn_res->handle_active) {
7333
+ if (!conn_res || !conn_res->handle_active) {
7313
7334
  rb_warn("Connection is not active");
7314
7335
  return Qnil;
7315
7336
  }
@@ -7475,7 +7496,7 @@ VALUE ibm_db_getErrormsg(int argc, VALUE *argv, VALUE self)
7475
7496
  if( resType == DB_CONN ) { /*Resource Type is connection*/
7476
7497
  Data_Get_Struct(conn_or_stmt, conn_handle, conn_res);
7477
7498
 
7478
- if ( !conn_res->handle_active ) {
7499
+ if (!conn_res || !conn_res->handle_active ) {
7479
7500
  rb_warn("Connection is not active");
7480
7501
  return Qnil;
7481
7502
  }
@@ -7775,10 +7796,10 @@ VALUE ibm_db_next_result(int argc, VALUE *argv, VALUE self)
7775
7796
  nextresultparams->stmt_res = stmt_res;
7776
7797
  nextresultparams->new_hstmt = &new_hstmt;
7777
7798
 
7778
- #ifdef UNICODE_SUPPORT_VERSION
7779
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLNextResult_helper, nextresultparams,
7780
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLNextResult_helper, nextresultparams,
7799
+ #ifdef UNICODE_SUPPORT_VERSION
7800
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLNextResult_helper, nextresultparams,
7781
7801
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
7802
+ rc = nextresultparams->rc;
7782
7803
  #else
7783
7804
  rc = _ruby_ibm_db_SQLNextResult_helper( nextresultparams );
7784
7805
  #endif
@@ -7811,7 +7832,7 @@ VALUE ibm_db_next_result(int argc, VALUE *argv, VALUE self)
7811
7832
  new_stmt_res->hstmt = new_hstmt;
7812
7833
  new_stmt_res->hdbc = stmt_res->hdbc;
7813
7834
  new_stmt_res->is_freed = 0;
7814
-
7835
+
7815
7836
  ret_value = Data_Wrap_Struct(le_stmt_struct,
7816
7837
  _ruby_ibm_db_mark_stmt_struct, _ruby_ibm_db_free_stmt_struct,
7817
7838
  new_stmt_res);
@@ -7827,6 +7848,7 @@ VALUE ibm_db_next_result(int argc, VALUE *argv, VALUE self)
7827
7848
  ruby_xfree( nextresultparams );
7828
7849
  nextresultparams = NULL;
7829
7850
  }
7851
+
7830
7852
  return ret_value;
7831
7853
  }
7832
7854
  /* */
@@ -7875,10 +7897,10 @@ VALUE ibm_db_num_fields(int argc, VALUE *argv, VALUE self)
7875
7897
  result_cols_args->stmt_res = stmt_res;
7876
7898
  result_cols_args->count = 0;
7877
7899
 
7878
- #ifdef UNICODE_SUPPORT_VERSION
7879
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLNumResultCols_helper, result_cols_args,
7880
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLNumResultCols_helper, result_cols_args,
7900
+ #ifdef UNICODE_SUPPORT_VERSION
7901
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLNumResultCols_helper, result_cols_args,
7881
7902
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
7903
+ rc = result_cols_args->rc;
7882
7904
  #else
7883
7905
  rc = _ruby_ibm_db_SQLNumResultCols_helper( result_cols_args );
7884
7906
  #endif
@@ -7907,7 +7929,6 @@ VALUE ibm_db_num_fields(int argc, VALUE *argv, VALUE self)
7907
7929
  ruby_xfree( result_cols_args );
7908
7930
  result_cols_args = NULL;
7909
7931
  }
7910
-
7911
7932
  return ret_val;
7912
7933
  }
7913
7934
  /* */
@@ -7969,10 +7990,10 @@ VALUE ibm_db_num_rows(int argc, VALUE *argv, VALUE self)
7969
7990
  row_count_args->stmt_res = stmt_res;
7970
7991
  row_count_args->count = 0;
7971
7992
 
7972
- #ifdef UNICODE_SUPPORT_VERSION
7973
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLRowCount_helper, row_count_args,
7974
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLRowCount_helper, row_count_args,
7993
+ #ifdef UNICODE_SUPPORT_VERSION
7994
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLRowCount_helper, row_count_args,
7975
7995
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
7996
+ rc = row_count_args->rc;
7976
7997
  #else
7977
7998
  rc = _ruby_ibm_db_SQLRowCount_helper( row_count_args );
7978
7999
  #endif
@@ -8026,10 +8047,10 @@ static int _ruby_ibm_db_get_column_by_name(stmt_handle *stmt_res, VALUE column,
8026
8047
  if ( stmt_res->column_info == NULL ) {
8027
8048
  if ( release_gil == 1 ) {
8028
8049
 
8029
- #ifdef UNICODE_SUPPORT_VERSION
8030
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_get_result_set_info, stmt_res,
8031
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_get_result_set_info, stmt_res,
8050
+ #ifdef UNICODE_SUPPORT_VERSION
8051
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_get_result_set_info, stmt_res,
8032
8052
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
8053
+ rc = stmt_res->rc;
8033
8054
  #else
8034
8055
  rc = _ruby_ibm_db_get_result_set_info( stmt_res );
8035
8056
  #endif
@@ -8190,10 +8211,10 @@ VALUE ibm_db_field_display_size(int argc, VALUE *argv, VALUE self)
8190
8211
  colattr_args->col_num = col+1;
8191
8212
  colattr_args->FieldIdentifier = SQL_DESC_DISPLAY_SIZE;
8192
8213
 
8193
- #ifdef UNICODE_SUPPORT_VERSION
8194
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8195
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8214
+ #ifdef UNICODE_SUPPORT_VERSION
8215
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8196
8216
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
8217
+ rc = colattr_args->rc;
8197
8218
  #else
8198
8219
  rc = _ruby_ibm_db_SQLColAttributes_helper( colattr_args );
8199
8220
  #endif
@@ -8511,10 +8532,10 @@ VALUE ibm_db_field_width(int argc, VALUE *argv, VALUE self)
8511
8532
  colattr_args->col_num = col+1;
8512
8533
  colattr_args->FieldIdentifier = SQL_DESC_LENGTH;
8513
8534
 
8514
- #ifdef UNICODE_SUPPORT_VERSION
8515
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8516
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8535
+ #ifdef UNICODE_SUPPORT_VERSION
8536
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLColAttributes_helper, colattr_args,
8517
8537
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
8538
+ rc = colattr_args->rc;
8518
8539
  #else
8519
8540
  rc = _ruby_ibm_db_SQLColAttributes_helper( colattr_args );
8520
8541
  #endif
@@ -8532,7 +8553,6 @@ VALUE ibm_db_field_width(int argc, VALUE *argv, VALUE self)
8532
8553
  ruby_xfree( colattr_args );
8533
8554
  colattr_args = NULL;
8534
8555
  }
8535
-
8536
8556
  return ret_val;
8537
8557
  }
8538
8558
  /* */
@@ -8602,36 +8622,30 @@ VALUE ibm_db_rollback(int argc, VALUE *argv, VALUE self)
8602
8622
  end_tran_args *end_X_args = NULL;
8603
8623
 
8604
8624
  rb_scan_args(argc, argv, "1", &connection);
8605
-
8606
8625
  if (!NIL_P(connection)) {
8607
8626
  Data_Get_Struct(connection, conn_handle, conn_res);
8608
-
8609
- if (!conn_res->handle_active) {
8627
+ if (!conn_res || !conn_res->handle_active) {
8610
8628
  rb_warn("Connection is not active");
8611
8629
  return Qfalse;
8612
8630
  }
8613
-
8614
8631
  end_X_args = ALLOC( end_tran_args );
8615
8632
  memset(end_X_args,'\0',sizeof(struct _ibm_db_end_tran_args_struct));
8616
8633
 
8617
8634
  end_X_args->hdbc = &(conn_res->hdbc);
8618
8635
  end_X_args->handleType = SQL_HANDLE_DBC;
8619
8636
  end_X_args->completionType = SQL_ROLLBACK; /*Remeber you are Rollingback the transaction*/
8620
-
8621
8637
  #ifdef UNICODE_SUPPORT_VERSION
8622
- //rc = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
8623
- rc = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
8638
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_SQLEndTran, end_X_args,
8624
8639
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
8640
+ rc = end_X_args->rc;
8625
8641
  #else
8626
8642
  rc = _ruby_ibm_db_SQLEndTran( end_X_args );
8627
8643
  #endif
8628
-
8629
8644
  /*Free the memory allocated*/
8630
8645
  if(end_X_args != NULL) {
8631
8646
  ruby_xfree( end_X_args );
8632
8647
  end_X_args = NULL;
8633
8648
  }
8634
-
8635
8649
  if ( rc == SQL_ERROR ) {
8636
8650
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 1 );
8637
8651
  return Qfalse;
@@ -8640,7 +8654,6 @@ VALUE ibm_db_rollback(int argc, VALUE *argv, VALUE self)
8640
8654
  return Qtrue;
8641
8655
  }
8642
8656
  }
8643
-
8644
8657
  return Qfalse;
8645
8658
  }
8646
8659
  /* */
@@ -8710,7 +8723,6 @@ static RETCODE _ruby_ibm_db_get_data(stmt_handle *stmt_res, int col_num, short c
8710
8723
  ruby_xfree( getData_args );
8711
8724
  getData_args = NULL;
8712
8725
  }
8713
-
8714
8726
  return rc;
8715
8727
  }
8716
8728
  /* */
@@ -8842,6 +8854,8 @@ int isNullLOB(VALUE *return_value,int i,stmt_handle *stmt_res,int op)
8842
8854
  In all other cases the value returned will be either Qfalse (meaning SQL_NO_DATA), VALUE or Qnil (meaning the value is nil)
8843
8855
  */
8844
8856
  static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8857
+
8858
+
8845
8859
  long col_num;
8846
8860
  RETCODE rc;
8847
8861
  SQLPOINTER out_ptr;
@@ -8854,6 +8868,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8854
8868
  VALUE return_value = Qnil;
8855
8869
  stmt_handle *stmt_res = data->stmt_res;
8856
8870
  VALUE column = data->column;
8871
+ VALUE ret_value;
8857
8872
 
8858
8873
  if(TYPE(column) == T_STRING) {
8859
8874
  col_num = _ruby_ibm_db_get_column_by_name(stmt_res, column, 0);
@@ -8880,6 +8895,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8880
8895
  *(data->error) = rb_str_new2("Column information cannot be retrieved: <error message could not be retrieved>");
8881
8896
  #endif
8882
8897
  }
8898
+ data->return_value = Qnil;
8883
8899
  return Qnil;
8884
8900
  }
8885
8901
  }
@@ -8890,6 +8906,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8890
8906
  #else
8891
8907
  *(data->error) = rb_str_new2("Column ordinal out of range" );
8892
8908
  #endif
8909
+ data->return_value = Qnil;
8893
8910
  return Qnil;
8894
8911
  }
8895
8912
 
@@ -8933,6 +8950,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8933
8950
 
8934
8951
  if ( out_ptr == NULL ) {
8935
8952
  rb_warn( "Failed to Allocate Memory while trying to retrieve the result" );
8953
+ data->return_value = Qnil;
8936
8954
  return Qnil;
8937
8955
  }
8938
8956
 
@@ -8943,10 +8961,12 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8943
8961
  #endif
8944
8962
 
8945
8963
  if ( rc == SQL_ERROR ) {
8964
+ data->return_value = Qfalse;
8946
8965
  return Qfalse;
8947
8966
  }
8948
8967
  if (out_length == SQL_NULL_DATA) {
8949
8968
  ruby_xfree( out_ptr );
8969
+ data->return_value = Qnil;
8950
8970
  return Qnil;
8951
8971
  } else {
8952
8972
  #ifdef UNICODE_SUPPORT_VERSION
@@ -8956,6 +8976,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8956
8976
  #endif
8957
8977
  ruby_xfree( out_ptr );
8958
8978
  out_ptr = NULL;
8979
+ data->return_value = return_value;
8959
8980
  return return_value;
8960
8981
  }
8961
8982
  break;
@@ -8978,22 +8999,26 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
8978
8999
 
8979
9000
  if ( out_ptr == NULL ) {
8980
9001
  rb_warn( "Failed to Allocate Memory while trying to retrieve the result" );
9002
+ data->return_value = Qnil;
8981
9003
  return Qnil;
8982
9004
  }
8983
9005
 
8984
9006
  rc = _ruby_ibm_db_get_data(stmt_res, col_num+1, SQL_C_CHAR, out_ptr, in_length, &out_length);
8985
9007
 
8986
9008
  if ( rc == SQL_ERROR ) {
9009
+ data->return_value = Qfalse;
8987
9010
  return Qfalse;
8988
9011
  }
8989
9012
 
8990
9013
  if (out_length == SQL_NULL_DATA) {
8991
9014
  ruby_xfree( out_ptr );
9015
+ data->return_value = Qnil;
8992
9016
  return Qnil;
8993
9017
  } else {
8994
9018
  return_value = rb_str_new2((char*)out_ptr);
8995
9019
  ruby_xfree( out_ptr );
8996
9020
  out_ptr = NULL;
9021
+ data->return_value = return_value;
8997
9022
  return return_value;
8998
9023
  }
8999
9024
  break;
@@ -9001,12 +9026,16 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9001
9026
  case SQL_INTEGER:
9002
9027
  rc = _ruby_ibm_db_get_data(stmt_res, col_num+1, SQL_C_LONG, &long_val, sizeof(long_val), &out_length);
9003
9028
  if ( rc == SQL_ERROR ) {
9029
+ data->return_value = Qfalse;
9004
9030
  return Qfalse;
9005
9031
  }
9006
9032
  if (out_length == SQL_NULL_DATA) {
9033
+ data->return_value = Qnil;
9007
9034
  return Qnil;
9008
9035
  } else {
9009
- return INT2NUM(long_val);
9036
+ VALUE ret_value = INT2NUM(long_val);
9037
+ data->return_value = ret_value;
9038
+ return ret_value;
9010
9039
  }
9011
9040
  break;
9012
9041
 
@@ -9015,12 +9044,16 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9015
9044
  case SQL_DOUBLE:
9016
9045
  rc = _ruby_ibm_db_get_data(stmt_res, col_num+1, SQL_C_DOUBLE, &double_val, sizeof(double_val), &out_length);
9017
9046
  if ( rc == SQL_ERROR ) {
9047
+ data->return_value = Qfalse;
9018
9048
  return Qfalse;
9019
9049
  }
9020
9050
  if (out_length == SQL_NULL_DATA) {
9051
+ data->return_value = Qnil;
9021
9052
  return Qnil;
9022
9053
  } else {
9023
- return rb_float_new(double_val);
9054
+ VALUE ret_value = rb_float_new(double_val);
9055
+ data->return_value = ret_value;
9056
+ return ret_value;
9024
9057
  }
9025
9058
  break;
9026
9059
 
@@ -9029,10 +9062,12 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9029
9062
  rc = _ruby_ibm_db_get_length(stmt_res, col_num+1, &in_length);
9030
9063
 
9031
9064
  if ( rc == SQL_ERROR ) {
9065
+ data->return_value = Qfalse;
9032
9066
  return Qfalse;
9033
9067
  }
9034
9068
 
9035
9069
  if (in_length == SQL_NULL_DATA) {
9070
+ data->return_value = Qnil;
9036
9071
  return Qnil;
9037
9072
  }
9038
9073
 
@@ -9046,6 +9081,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9046
9081
 
9047
9082
  if ( out_ptr == NULL ) {
9048
9083
  rb_warn( "Failed to Allocate Memory for LOB Data" );
9084
+ data->return_value = Qnil;
9049
9085
  return Qnil;
9050
9086
  }
9051
9087
 
@@ -9056,6 +9092,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9056
9092
  #endif
9057
9093
 
9058
9094
  if (rc == SQL_ERROR) {
9095
+ data->return_value = Qfalse;
9059
9096
  return Qfalse;
9060
9097
  }
9061
9098
 
@@ -9067,7 +9104,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9067
9104
 
9068
9105
  ruby_xfree( out_ptr );
9069
9106
  out_ptr = NULL;
9070
-
9107
+ data->return_value = return_value;
9071
9108
  return return_value;
9072
9109
  break;
9073
9110
 
@@ -9081,16 +9118,20 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9081
9118
  rc = _ruby_ibm_db_get_length( stmt_res, col_num+1, &in_length );
9082
9119
 
9083
9120
  if ( rc == SQL_ERROR ) {
9121
+ data->return_value = Qfalse;
9084
9122
  return Qfalse;
9085
9123
  }
9086
9124
 
9087
9125
  if (in_length == SQL_NULL_DATA) {
9126
+ data->return_value = Qnil;
9088
9127
  return Qnil;
9089
9128
  }
9090
9129
 
9091
9130
  switch (stmt_res->s_bin_mode) {
9092
- case PASSTHRU:
9093
- return rb_str_new("",0);
9131
+ case PASSTHRU:
9132
+ ret_value = rb_str_new("",0);
9133
+ data->return_value = ret_value;
9134
+ return ret_value;
9094
9135
  break;
9095
9136
  /* returns here */
9096
9137
  case CONVERT:
@@ -9104,18 +9145,20 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9104
9145
 
9105
9146
  if ( out_ptr == NULL ) {
9106
9147
  rb_warn( "Failed to Allocate Memory for LOB Data" );
9148
+ data->return_value = Qnil;
9107
9149
  return Qnil;
9108
9150
  }
9109
9151
 
9110
9152
  rc = _ruby_ibm_db_get_data2(stmt_res, col_num+1, lob_bind_type, out_ptr, in_length, in_length, &out_length);
9111
9153
 
9112
9154
  if (rc == SQL_ERROR) {
9155
+ data->return_value = Qfalse;
9113
9156
  return Qfalse;
9114
9157
  }
9115
9158
  return_value = rb_str_new((char*)out_ptr,out_length);
9116
9159
  ruby_xfree( out_ptr );
9117
9160
  out_ptr = NULL;
9118
-
9161
+ data->return_value = return_value;
9119
9162
  return return_value;
9120
9163
  default:
9121
9164
  break;
@@ -9126,10 +9169,12 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9126
9169
  rc = _ruby_ibm_db_get_data(stmt_res, col_num+1, SQL_C_BINARY, NULL, 0, (SQLINTEGER *)&in_length);
9127
9170
 
9128
9171
  if ( rc == SQL_ERROR ) {
9172
+ data->return_value = Qfalse;
9129
9173
  return Qfalse;
9130
9174
  }
9131
9175
 
9132
9176
  if (in_length == SQL_NULL_DATA) {
9177
+ data->return_value = Qnil;
9133
9178
  return Qnil;
9134
9179
  }
9135
9180
 
@@ -9138,6 +9183,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9138
9183
 
9139
9184
  if ( out_ptr == NULL ) {
9140
9185
  rb_warn( "Failed to Allocate Memory for LOB Data" );
9186
+ data->return_value = Qnil;
9141
9187
  return Qnil;
9142
9188
  }
9143
9189
 
@@ -9146,6 +9192,7 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9146
9192
  if (rc == SQL_ERROR) {
9147
9193
  ruby_xfree( out_ptr );
9148
9194
  out_ptr = NULL;
9195
+ data->return_value = Qfalse;
9149
9196
  return Qfalse;
9150
9197
  }
9151
9198
 
@@ -9157,13 +9204,14 @@ static VALUE _ruby_ibm_db_result_helper(ibm_db_result_args *data) {
9157
9204
 
9158
9205
  ruby_xfree( out_ptr );
9159
9206
  out_ptr = NULL;
9160
-
9207
+ data->return_value = return_value;
9161
9208
  return return_value;
9162
9209
 
9163
9210
  default:
9164
9211
  break;
9165
9212
  }
9166
9213
 
9214
+ data->return_value = Qfalse;
9167
9215
  return Qfalse;
9168
9216
  }
9169
9217
  /* }}} */
@@ -9208,10 +9256,10 @@ VALUE ibm_db_result(int argc, VALUE *argv, VALUE self)
9208
9256
  if ( !NIL_P( stmt ) ) {
9209
9257
  Data_Get_Struct(stmt, stmt_handle, result_args->stmt_res);
9210
9258
 
9211
- #ifdef UNICODE_SUPPORT_VERSION
9212
- //ret_val = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_result_helper, result_args,
9213
- ret_val = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_result_helper, result_args,
9259
+ #ifdef UNICODE_SUPPORT_VERSION
9260
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_result_helper, result_args,
9214
9261
  (void *)_ruby_ibm_db_Statement_level_UBF, result_args->stmt_res );
9262
+ ret_val = result_args->return_value;
9215
9263
  #else
9216
9264
  ret_val = _ruby_ibm_db_result_helper( result_args );
9217
9265
  #endif
@@ -9287,6 +9335,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9287
9335
  *(data->error) = rb_str_new2("Column information cannot be retrieved: <error message could not be retrieved>");
9288
9336
  #endif
9289
9337
  }
9338
+ data->return_value = Qnil;
9290
9339
  return Qnil;
9291
9340
  }
9292
9341
  }
@@ -9311,6 +9360,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9311
9360
  *(data->error) = rb_str_new2("Column binding cannot be done: <error message could not be retrieved>");
9312
9361
  #endif
9313
9362
  }
9363
+ data->return_value = Qnil;
9314
9364
  return Qnil;
9315
9365
  }
9316
9366
  }
@@ -9360,6 +9410,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9360
9410
  #else
9361
9411
  *(data->error) = rb_str_new2("Requested row number must be a positive value");
9362
9412
  #endif
9413
+ data->return_value = Qnil;
9363
9414
  return Qnil;
9364
9415
  } else {
9365
9416
  /*row_number is NULL or 0; just fetch next row*/
@@ -9378,6 +9429,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9378
9429
  }
9379
9430
 
9380
9431
  if (rc == SQL_NO_DATA_FOUND) {
9432
+ data->return_value = Qfalse;
9381
9433
  return Qfalse;
9382
9434
  } else if ( rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO) {
9383
9435
  _ruby_ibm_db_check_sql_errors( stmt_res, DB_STMT, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, NULL, -1, 1, 0 );
@@ -9397,6 +9449,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9397
9449
  *(data->error) = rb_str_new2("Fetch Failure: <error message could not be retrieved>");
9398
9450
  #endif
9399
9451
  }
9452
+ data->return_value = Qnil;
9400
9453
  return Qnil;
9401
9454
  }
9402
9455
  /* copy the data over return_value */
@@ -9484,6 +9537,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9484
9537
  out_ptr = (SQLPOINTER)ALLOC_N(char, tmp_length+1);
9485
9538
  if ( out_ptr == NULL ) {
9486
9539
  rb_warn( "Failed to allocate Memory");
9540
+ data->return_value = Qnil;
9487
9541
  return Qnil;
9488
9542
  }
9489
9543
  memset(out_ptr,'\0',tmp_length+1);
@@ -9492,6 +9546,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9492
9546
  if ( rc == SQL_ERROR ) {
9493
9547
  ruby_xfree( out_ptr );
9494
9548
  out_ptr = NULL;
9549
+ data->return_value = Qfalse;
9495
9550
  return Qfalse;
9496
9551
  }
9497
9552
  if (out_length == SQL_NULL_DATA) {
@@ -9536,6 +9591,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9536
9591
 
9537
9592
  if(tmpStr == NULL ){
9538
9593
  rb_warn( "Failed to Allocate Memory for Decimal Data" );
9594
+ data->return_value = Qnil;
9539
9595
  return Qnil;
9540
9596
  }
9541
9597
 
@@ -9674,6 +9730,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9674
9730
  ruby_xfree( out_ptr );
9675
9731
  out_ptr = NULL;
9676
9732
  out_length = 0;
9733
+ data->return_value = Qfalse;
9677
9734
  return Qfalse;
9678
9735
  }
9679
9736
 
@@ -9725,6 +9782,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9725
9782
  *(data->error) = rb_str_new2("Failed to Determine XML Size: <error message could not be retrieved>");
9726
9783
  #endif
9727
9784
  }
9785
+ data->return_value = Qnil;
9728
9786
  return Qnil;
9729
9787
  }
9730
9788
 
@@ -9744,6 +9802,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9744
9802
 
9745
9803
  if ( out_ptr == NULL ) {
9746
9804
  rb_warn( "Failed to Allocate Memory for XML Data" );
9805
+ data->return_value = Qnil;
9747
9806
  return Qnil;
9748
9807
  }
9749
9808
 
@@ -9751,6 +9810,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9751
9810
  if (rc == SQL_ERROR) {
9752
9811
  ruby_xfree( out_ptr );
9753
9812
  out_ptr = NULL;
9813
+ data->return_value = Qfalse;
9754
9814
  return Qfalse;
9755
9815
  }
9756
9816
 
@@ -9812,6 +9872,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9812
9872
 
9813
9873
  if ( out_ptr == NULL ) {
9814
9874
  rb_warn( "Failed to Allocate Memory for LOB Data" );
9875
+ data->return_value = Qnil;
9815
9876
  return Qnil;
9816
9877
  }
9817
9878
 
@@ -9824,6 +9885,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9824
9885
  ruby_xfree( out_ptr );
9825
9886
  out_ptr = NULL;
9826
9887
  out_length = 0;
9888
+ data->return_value = Qfalse;
9827
9889
  return Qfalse;
9828
9890
  }
9829
9891
 
@@ -9858,6 +9920,7 @@ static VALUE _ruby_ibm_db_bind_fetch_helper(ibm_db_fetch_helper_args *data)
9858
9920
  }
9859
9921
  }
9860
9922
 
9923
+ data->return_value = return_value;
9861
9924
  return return_value;
9862
9925
  }
9863
9926
  /*
@@ -9896,6 +9959,7 @@ static int _ruby_ibm_db_fetch_row_helper( ibm_db_fetch_helper_args *data) {
9896
9959
  *(data->error) = rb_str_new2("Column information cannot be retrieved: <error message could not be retrieved>");
9897
9960
  #endif
9898
9961
  }
9962
+ data->return_value = Qnil;
9899
9963
  return Qnil;
9900
9964
  }
9901
9965
  }
@@ -9932,6 +9996,7 @@ static int _ruby_ibm_db_fetch_row_helper( ibm_db_fetch_helper_args *data) {
9932
9996
  #else
9933
9997
  *(data->error) = rb_str_new2("Requested row number must be a positive value");
9934
9998
  #endif
9999
+ data->return_value = Qnil;
9935
10000
  return Qnil;
9936
10001
  } else {
9937
10002
  /*row_number is NULL or 0; just fetch next row*/
@@ -9952,7 +10017,7 @@ static int _ruby_ibm_db_fetch_row_helper( ibm_db_fetch_helper_args *data) {
9952
10017
  ret_val = Qfalse;
9953
10018
  }
9954
10019
  }
9955
-
10020
+ data->return_value = ret_val;
9956
10021
  return ret_val;
9957
10022
  }
9958
10023
  /* */
@@ -10012,10 +10077,10 @@ VALUE ibm_db_fetch_row(int argc, VALUE *argv, VALUE self)
10012
10077
  helper_args->arg_count = argc;
10013
10078
  helper_args->error = &error;
10014
10079
 
10015
- #ifdef UNICODE_SUPPORT_VERSION
10016
- //ret_val = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_fetch_row_helper, helper_args,
10017
- ret_val = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_fetch_row_helper, helper_args,
10080
+ #ifdef UNICODE_SUPPORT_VERSION
10081
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_fetch_row_helper, helper_args,
10018
10082
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
10083
+ ret_val = helper_args->return_value;
10019
10084
  #else
10020
10085
  ret_val = _ruby_ibm_db_fetch_row_helper( helper_args );
10021
10086
  #endif
@@ -10181,14 +10246,15 @@ VALUE ibm_db_fetch_assoc(int argc, VALUE *argv, VALUE self) {
10181
10246
  helper_args->error = &error;
10182
10247
  helper_args->funcType = FETCH_ASSOC;
10183
10248
 
10184
- #ifdef UNICODE_SUPPORT_VERSION
10185
- //ret_val = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10186
- ret_val = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10249
+ #ifdef UNICODE_SUPPORT_VERSION
10250
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10187
10251
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
10252
+ ret_val = helper_args->return_value;
10253
+
10188
10254
  #else
10189
10255
  ret_val = _ruby_ibm_db_bind_fetch_helper( helper_args );
10190
10256
  #endif
10191
-
10257
+
10192
10258
  /*Free Memory Allocated*/
10193
10259
  if ( helper_args != NULL) {
10194
10260
  ruby_xfree( helper_args );
@@ -10269,10 +10335,10 @@ VALUE ibm_db_fetch_object(int argc, VALUE *argv, VALUE self)
10269
10335
  helper_args->error = &error;
10270
10336
  helper_args->funcType = FETCH_ASSOC;
10271
10337
 
10272
- #ifdef UNICODE_SUPPORT_VERSION
10273
- //row_res->hash = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10274
- row_res->hash = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10338
+ #ifdef UNICODE_SUPPORT_VERSION
10339
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10275
10340
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
10341
+ row_res->hash = helper_args->return_value;
10276
10342
  #else
10277
10343
  row_res->hash = _ruby_ibm_db_bind_fetch_helper( helper_args );
10278
10344
  #endif
@@ -10295,7 +10361,7 @@ VALUE ibm_db_fetch_object(int argc, VALUE *argv, VALUE self)
10295
10361
  ruby_xfree( row_res );
10296
10362
  row_res = NULL;
10297
10363
  return Qfalse;
10298
- }
10364
+ }
10299
10365
  }
10300
10366
  /* */
10301
10367
 
@@ -10352,10 +10418,11 @@ VALUE ibm_db_fetch_array(int argc, VALUE *argv, VALUE self)
10352
10418
  helper_args->error = &error;
10353
10419
  helper_args->funcType = FETCH_INDEX;
10354
10420
 
10355
- #ifdef UNICODE_SUPPORT_VERSION
10356
- //ret_val = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10357
- ret_val = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10421
+ #ifdef UNICODE_SUPPORT_VERSION
10422
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10358
10423
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
10424
+ ret_val = helper_args->return_value;
10425
+
10359
10426
  #else
10360
10427
  ret_val = _ruby_ibm_db_bind_fetch_helper( helper_args );
10361
10428
  #endif
@@ -10429,10 +10496,10 @@ VALUE ibm_db_fetch_both(int argc, VALUE *argv, VALUE self)
10429
10496
  helper_args->error = &error;
10430
10497
  helper_args->funcType = FETCH_BOTH;
10431
10498
 
10432
- #ifdef UNICODE_SUPPORT_VERSION
10433
- //ret_val = rb_thread_call_without_gvl ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10434
- ret_val = ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10499
+ #ifdef UNICODE_SUPPORT_VERSION
10500
+ ibm_Ruby_Thread_Call ( (void *)_ruby_ibm_db_bind_fetch_helper, helper_args,
10435
10501
  (void *)_ruby_ibm_db_Statement_level_UBF, stmt_res );
10502
+ ret_val = helper_args->return_value;
10436
10503
  #else
10437
10504
  ret_val = _ruby_ibm_db_bind_fetch_helper( helper_args );
10438
10505
  #endif
@@ -10523,7 +10590,7 @@ VALUE ibm_db_set_option(int argc, VALUE *argv, VALUE self)
10523
10590
  /*
10524
10591
  Retrieves the server information by calling the SQLGetInfo_helper function and wraps it up into server_info object
10525
10592
  */
10526
- static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10593
+ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10527
10594
  conn_handle *conn_res = NULL;
10528
10595
 
10529
10596
  int rc = 0;
@@ -10558,6 +10625,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10558
10625
 
10559
10626
  if ( rc == SQL_ERROR ) {
10560
10627
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10628
+ getInfo_args->return_value = Qfalse;
10561
10629
  return Qfalse;
10562
10630
  } else {
10563
10631
 
@@ -10576,9 +10644,9 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10576
10644
 
10577
10645
  memset(buffer11, '\0', sizeof(buffer11));
10578
10646
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
10579
-
10580
10647
  if ( rc == SQL_ERROR ) {
10581
10648
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10649
+ getInfo_args->return_value = Qfalse;
10582
10650
  return Qfalse;
10583
10651
  } else {
10584
10652
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10587,7 +10655,6 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10587
10655
  rb_iv_set(return_value, "@DBMS_VER", rb_str_new2(buffer11));
10588
10656
  #endif
10589
10657
  }
10590
-
10591
10658
  #ifndef PASE /* i5/OS DB_CODEPAGE handled natively */
10592
10659
  /* DB_CODEPAGE */
10593
10660
  bufferint32 = 0;
@@ -10601,6 +10668,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10601
10668
 
10602
10669
  if ( rc == SQL_ERROR ) {
10603
10670
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10671
+ getInfo_args->return_value = Qfalse;
10604
10672
  return Qfalse;
10605
10673
  } else {
10606
10674
  rb_iv_set(return_value, "@DB_CODEPAGE", INT2NUM(bufferint32));
@@ -10618,6 +10686,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10618
10686
 
10619
10687
  if ( rc == SQL_ERROR ) {
10620
10688
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10689
+ getInfo_args->return_value = Qfalse;
10621
10690
  return Qfalse;
10622
10691
  } else {
10623
10692
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10639,6 +10708,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10639
10708
 
10640
10709
  if ( rc == SQL_ERROR ) {
10641
10710
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10711
+ getInfo_args->return_value = Qfalse;
10642
10712
  return Qfalse;
10643
10713
  } else {
10644
10714
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10659,6 +10729,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10659
10729
 
10660
10730
  if ( rc == SQL_ERROR ) {
10661
10731
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10732
+ getInfo_args->return_value = Qfalse;
10662
10733
  return Qfalse;
10663
10734
  } else {
10664
10735
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10680,10 +10751,10 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10680
10751
 
10681
10752
  if ( rc == SQL_ERROR ) {
10682
10753
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10754
+ getInfo_args->return_value = Qfalse;
10683
10755
  return Qfalse;
10684
10756
  } else {
10685
10757
  VALUE keywordsStr, keywordsArray;
10686
-
10687
10758
  #ifdef UNICODE_SUPPORT_VERSION
10688
10759
  keywordsStr = _ruby_ibm_db_export_sqlwchar_to_utf8_rstr(buffer3k, out_length);
10689
10760
  keywordsArray = rb_str_split(keywordsStr, RSTRING_PTR(_ruby_ibm_db_export_char_to_utf8_rstr(",")) );
@@ -10691,7 +10762,6 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10691
10762
  keywordsStr = rb_str_new2( buffer3k );
10692
10763
  keywordsArray = rb_str_split(keywordsStr, ",");
10693
10764
  #endif
10694
-
10695
10765
  rb_iv_set(return_value, "@KEYWORDS", keywordsArray);
10696
10766
  }
10697
10767
 
@@ -10706,6 +10776,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10706
10776
 
10707
10777
  if ( rc == SQL_ERROR ) {
10708
10778
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10779
+ getInfo_args->return_value = Qfalse;
10709
10780
  return Qfalse;
10710
10781
  } else {
10711
10782
  VALUE dft_isolation = Qnil;
@@ -10744,10 +10815,8 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10744
10815
  dft_isolation = rb_str_new2("NC");
10745
10816
  #endif
10746
10817
  }
10747
-
10748
10818
  rb_iv_set(return_value, "@DFT_ISOLATION", dft_isolation);
10749
10819
  }
10750
-
10751
10820
  #ifndef PASE /* i5/OS ISOLATION_OPTION handled natively */
10752
10821
  /* ISOLATION_OPTION */
10753
10822
  getInfo_args->infoType = SQL_TXN_ISOLATION_OPTION;
@@ -10757,15 +10826,14 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10757
10826
 
10758
10827
  bitmask = 0;
10759
10828
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
10760
-
10761
10829
  if ( rc == SQL_ERROR ) {
10762
10830
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10831
+ getInfo_args->return_value = Qfalse;
10763
10832
  return Qfalse;
10764
10833
  } else {
10765
10834
  VALUE array;
10766
10835
 
10767
10836
  array = rb_ary_new();
10768
-
10769
10837
  if( bitmask & SQL_TXN_READ_UNCOMMITTED ) {
10770
10838
  #ifdef UNICODE_SUPPORT_VERSION
10771
10839
  rb_ary_push(array, _ruby_ibm_db_export_char_to_utf8_rstr("UR"));
@@ -10801,7 +10869,6 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10801
10869
  rb_ary_push(array, rb_str_new2("NC"));
10802
10870
  #endif
10803
10871
  }
10804
-
10805
10872
  rb_iv_set(return_value, "@ISOLATION_OPTION", array);
10806
10873
  }
10807
10874
  #endif /* PASE */
@@ -10814,9 +10881,9 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10814
10881
 
10815
10882
  bufferint32 = 0;
10816
10883
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
10817
-
10818
10884
  if ( rc == SQL_ERROR ) {
10819
10885
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10886
+ getInfo_args->return_value = Qfalse;
10820
10887
  return Qfalse;
10821
10888
  } else {
10822
10889
  VALUE conformance = Qnil;
@@ -10863,9 +10930,9 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10863
10930
 
10864
10931
  memset(buffer11, '\0', sizeof(buffer11));
10865
10932
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
10866
-
10867
10933
  if ( rc == SQL_ERROR ) {
10868
10934
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10935
+ getInfo_args->return_value = Qfalse;
10869
10936
  return Qfalse;
10870
10937
  } else {
10871
10938
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10878,7 +10945,6 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10878
10945
  rb_iv_set(return_value, "@PROCEDURES", Qfalse);
10879
10946
  }
10880
10947
  }
10881
-
10882
10948
  /* IDENTIFIER_QUOTE_CHAR */
10883
10949
  getInfo_args->infoType = SQL_IDENTIFIER_QUOTE_CHAR;
10884
10950
  getInfo_args->infoValue = (SQLPOINTER)buffer11;
@@ -10890,6 +10956,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10890
10956
 
10891
10957
  if ( rc == SQL_ERROR ) {
10892
10958
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10959
+ getInfo_args->return_value = Qfalse;
10893
10960
  return Qfalse;
10894
10961
  } else {
10895
10962
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10910,6 +10977,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10910
10977
 
10911
10978
  if ( rc == SQL_ERROR ) {
10912
10979
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
10980
+ getInfo_args->return_value = Qfalse;
10913
10981
  return Qfalse;
10914
10982
  } else {
10915
10983
  #ifdef UNICODE_SUPPORT_VERSION
@@ -10929,11 +10997,10 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10929
10997
  getInfo_args->buff_length = sizeof( bufferint16 );
10930
10998
  out_length = 0;
10931
10999
  bufferint16 = 0;
10932
-
10933
11000
  rc = _ruby_ibm_db_SQLGetInfo_helper( getInfo_args );
10934
-
10935
11001
  if ( rc == SQL_ERROR ) {
10936
11002
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11003
+ getInfo_args->return_value = Qfalse;
10937
11004
  return Qfalse;
10938
11005
  } else {
10939
11006
  rb_iv_set(return_value, "@MAX_COL_NAME_LEN", INT2NUM(bufferint16));
@@ -10950,11 +11017,11 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10950
11017
 
10951
11018
  if ( rc == SQL_ERROR ) {
10952
11019
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11020
+ getInfo_args->return_value = Qfalse;
10953
11021
  return Qfalse;
10954
11022
  } else {
10955
11023
  rb_iv_set(return_value, "@MAX_ROW_SIZE", INT2NUM(bufferint32));
10956
11024
  }
10957
-
10958
11025
  #ifndef PASE /* i5/OS MAX_IDENTIFIER_LEN handled natively */
10959
11026
  /* MAX_IDENTIFIER_LEN */
10960
11027
  getInfo_args->infoType = SQL_MAX_IDENTIFIER_LEN;
@@ -10967,6 +11034,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10967
11034
 
10968
11035
  if ( rc == SQL_ERROR ) {
10969
11036
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11037
+ getInfo_args->return_value = Qfalse;
10970
11038
  return Qfalse;
10971
11039
  } else {
10972
11040
  rb_iv_set(return_value, "@MAX_IDENTIFIER_LEN", INT2NUM(bufferint16));
@@ -10983,6 +11051,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10983
11051
 
10984
11052
  if ( rc == SQL_ERROR ) {
10985
11053
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11054
+ getInfo_args->return_value = Qfalse;
10986
11055
  return Qfalse;
10987
11056
  } else {
10988
11057
  rb_iv_set(return_value, "@MAX_INDEX_SIZE", INT2NUM(bufferint32));
@@ -10999,6 +11068,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
10999
11068
 
11000
11069
  if ( rc == SQL_ERROR ) {
11001
11070
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11071
+ getInfo_args->return_value = Qfalse;
11002
11072
  return Qfalse;
11003
11073
  } else {
11004
11074
  rb_iv_set(return_value, "@MAX_PROC_NAME_LEN", INT2NUM(bufferint16));
@@ -11016,6 +11086,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
11016
11086
 
11017
11087
  if ( rc == SQL_ERROR ) {
11018
11088
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11089
+ getInfo_args->return_value = Qfalse;
11019
11090
  return Qfalse;
11020
11091
  } else {
11021
11092
  rb_iv_set(return_value, "@MAX_SCHEMA_NAME_LEN", INT2NUM(bufferint16));
@@ -11032,6 +11103,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
11032
11103
 
11033
11104
  if ( rc == SQL_ERROR ) {
11034
11105
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11106
+ getInfo_args->return_value = Qfalse;
11035
11107
  return Qfalse;
11036
11108
  } else {
11037
11109
  rb_iv_set(return_value, "@MAX_STATEMENT_LEN", INT2NUM(bufferint32));
@@ -11048,6 +11120,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
11048
11120
 
11049
11121
  if ( rc == SQL_ERROR ) {
11050
11122
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11123
+ getInfo_args->return_value = Qfalse;
11051
11124
  return Qfalse;
11052
11125
  } else {
11053
11126
  rb_iv_set(return_value, "@MAX_TABLE_NAME_LEN", INT2NUM(bufferint16));
@@ -11064,6 +11137,7 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
11064
11137
 
11065
11138
  if ( rc == SQL_ERROR ) {
11066
11139
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11140
+ getInfo_args->return_value = Qfalse;
11067
11141
  return Qfalse;
11068
11142
  } else {
11069
11143
  VALUE rv = Qnil;
@@ -11080,6 +11154,8 @@ static VALUE ibm_db_server_info_helper( get_info_args *getInfo_args ) {
11080
11154
  rb_iv_set(return_value, "@NON_NULLABLE_COLUMNS", rv);
11081
11155
  }
11082
11156
 
11157
+ getInfo_args->return_value=return_value;
11158
+
11083
11159
  return return_value;
11084
11160
  }
11085
11161
  /* */
@@ -11163,28 +11239,34 @@ VALUE ibm_db_server_info(int argc, VALUE *argv, VALUE self)
11163
11239
  get_info_args *getInfo_args = NULL;
11164
11240
 
11165
11241
  rb_scan_args(argc, argv, "1", &connection);
11242
+
11243
+
11244
+ if(NIL_P(&connection))
11245
+ {
11246
+ }
11247
+ if(&connection == NULL)
11248
+ {
11249
+ }
11166
11250
 
11167
11251
  if (!NIL_P(connection)) {
11168
11252
  Data_Get_Struct(connection, conn_handle, conn_res);
11169
-
11170
- if (!conn_res->handle_active) {
11253
+
11254
+ if (!conn_res || !conn_res->handle_active) {
11171
11255
  rb_warn("Connection is not active");
11172
11256
  return Qfalse;
11173
11257
  }
11174
-
11175
11258
  getInfo_args = ALLOC( get_info_args );
11176
11259
  memset(getInfo_args,'\0',sizeof(struct _ibm_db_get_info_struct));
11177
-
11260
+
11178
11261
  getInfo_args->conn_res = conn_res;
11179
11262
  getInfo_args->out_length = NULL;
11180
11263
  getInfo_args->infoType = 0;
11181
11264
  getInfo_args->infoValue = NULL;
11182
11265
  getInfo_args->buff_length = 0;
11183
-
11184
11266
  #ifdef UNICODE_SUPPORT_VERSION
11185
- //return_value = rb_thread_call_without_gvl ( (void *)ibm_db_server_info_helper, getInfo_args,
11186
- return_value = ibm_Ruby_Thread_Call ( (void *)ibm_db_server_info_helper, getInfo_args,
11267
+ ibm_Ruby_Thread_Call ( (void *)ibm_db_server_info_helper, getInfo_args,
11187
11268
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
11269
+ return_value = getInfo_args->return_value;
11188
11270
  #else
11189
11271
  return_value = ibm_db_server_info_helper( getInfo_args );
11190
11272
  #endif
@@ -11232,6 +11314,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11232
11314
 
11233
11315
  if ( rc == SQL_ERROR ) {
11234
11316
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11317
+ getInfo_args->return_value = Qfalse;
11235
11318
  return Qfalse;
11236
11319
  } else {
11237
11320
  #ifdef UNICODE_SUPPORT_VERSION
@@ -11252,6 +11335,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11252
11335
 
11253
11336
  if ( rc == SQL_ERROR ) {
11254
11337
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11338
+ getInfo_args->return_value = Qfalse;
11255
11339
  return Qfalse;
11256
11340
  } else {
11257
11341
  #ifdef UNICODE_SUPPORT_VERSION
@@ -11272,6 +11356,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11272
11356
 
11273
11357
  if ( rc == SQL_ERROR ) {
11274
11358
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11359
+ getInfo_args->return_value = Qfalse;
11275
11360
  return Qfalse;
11276
11361
  } else {
11277
11362
  #ifdef UNICODE_SUPPORT_VERSION
@@ -11292,6 +11377,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11292
11377
 
11293
11378
  if ( rc == SQL_ERROR ) {
11294
11379
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11380
+ getInfo_args->return_value = Qfalse;
11295
11381
  return Qfalse;
11296
11382
  } else {
11297
11383
  #ifdef UNICODE_SUPPORT_VERSION
@@ -11313,6 +11399,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11313
11399
 
11314
11400
  if ( rc == SQL_ERROR ) {
11315
11401
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11402
+ getInfo_args->return_value = Qfalse;
11316
11403
  return Qfalse;
11317
11404
  } else {
11318
11405
  #ifdef UNICODE_SUPPORT_VERSION
@@ -11334,6 +11421,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11334
11421
 
11335
11422
  if ( rc == SQL_ERROR ) {
11336
11423
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11424
+ getInfo_args->return_value = Qfalse;
11337
11425
  return Qfalse;
11338
11426
  } else {
11339
11427
  VALUE conformance = Qnil;
@@ -11377,6 +11465,7 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11377
11465
 
11378
11466
  if ( rc == SQL_ERROR ) {
11379
11467
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11468
+ getInfo_args->return_value = Qfalse;
11380
11469
  return Qfalse;
11381
11470
  } else {
11382
11471
  rb_iv_set(return_value, "@APPL_CODEPAGE", INT2NUM(bufferint32));
@@ -11393,12 +11482,14 @@ static VALUE ibm_db_client_info_helper( get_info_args *getInfo_args) {
11393
11482
 
11394
11483
  if ( rc == SQL_ERROR ) {
11395
11484
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 0 );
11485
+ getInfo_args->return_value = Qfalse;
11396
11486
  return Qfalse;
11397
11487
  } else {
11398
11488
  rb_iv_set(return_value, "@CONN_CODEPAGE", INT2NUM(bufferint32));
11399
11489
  }
11400
11490
  #endif /* PASE */
11401
11491
 
11492
+ getInfo_args->return_value = return_value;
11402
11493
  return return_value;
11403
11494
  }
11404
11495
  /* */
@@ -11455,7 +11546,7 @@ VALUE ibm_db_client_info(int argc, VALUE *argv, VALUE self)
11455
11546
  if (!NIL_P(connection)) {
11456
11547
  Data_Get_Struct(connection, conn_handle, conn_res);
11457
11548
 
11458
- if (!conn_res->handle_active) {
11549
+ if (!conn_res || !conn_res->handle_active) {
11459
11550
  rb_warn("Connection is not active");
11460
11551
  return Qfalse;
11461
11552
  }
@@ -11469,10 +11560,11 @@ VALUE ibm_db_client_info(int argc, VALUE *argv, VALUE self)
11469
11560
  getInfo_args->infoValue = NULL;
11470
11561
  getInfo_args->buff_length = 0;
11471
11562
 
11472
- #ifdef UNICODE_SUPPORT_VERSION
11473
- //return_value = rb_thread_call_without_gvl ( (void *)ibm_db_client_info_helper, getInfo_args,
11474
- return_value = ibm_Ruby_Thread_Call ( (void *)ibm_db_client_info_helper, getInfo_args,
11563
+ #ifdef UNICODE_SUPPORT_VERSION
11564
+ ibm_Ruby_Thread_Call ( (void *)ibm_db_client_info_helper, getInfo_args,
11475
11565
  (void *)_ruby_ibm_db_Connection_level_UBF, NULL);
11566
+ return_value = getInfo_args->return_value;
11567
+
11476
11568
  #else
11477
11569
  return_value = ibm_db_client_info_helper( getInfo_args );
11478
11570
  #endif
@@ -11605,15 +11697,16 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11605
11697
 
11606
11698
  rb_scan_args(argc, argv, "3", &conn_or_stmt, &option, &r_type);
11607
11699
 
11700
+
11608
11701
  if (!NIL_P(r_type)) type = NUM2LONG(r_type);
11702
+
11609
11703
 
11610
11704
  if (!NIL_P(conn_or_stmt)) {
11611
11705
  /* Checking to see if we are getting a connection option (1) or a statement option (non - 1) */
11612
11706
  if (type == 1) {
11613
11707
  Data_Get_Struct(conn_or_stmt, conn_handle, conn_res);
11614
-
11615
11708
  /* Check to ensure the connection resource given is active */
11616
- if (!conn_res->handle_active) {
11709
+ if (!conn_res || !conn_res->handle_active) {
11617
11710
  rb_warn("Connection is not active");
11618
11711
  return Qfalse;
11619
11712
  }
@@ -11628,7 +11721,6 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11628
11721
  value = (SQLCHAR *)ALLOC_N(SQLCHAR, ACCTSTR_LEN + 1);
11629
11722
  memset(value,'\0', ACCTSTR_LEN + 1);
11630
11723
  #endif
11631
-
11632
11724
  get_handleAttr_args = ALLOC( get_handle_attr_args );
11633
11725
  memset(get_handleAttr_args,'\0',sizeof(struct _ibm_db_get_handle_attr_struct));
11634
11726
 
@@ -11641,12 +11733,10 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11641
11733
  get_handleAttr_args->buff_length = (ACCTSTR_LEN+1);
11642
11734
  #endif
11643
11735
  get_handleAttr_args->out_length = &out_length;
11644
-
11645
11736
  rc = _ruby_ibm_db_SQLGetConnectAttr_helper( get_handleAttr_args );
11646
11737
 
11647
11738
  ruby_xfree( get_handleAttr_args );
11648
11739
  get_handleAttr_args = NULL;
11649
-
11650
11740
  if (rc == SQL_ERROR) {
11651
11741
  _ruby_ibm_db_check_sql_errors( conn_res, DB_CONN, conn_res->hdbc, SQL_HANDLE_DBC, rc, 1, NULL, NULL, -1, 1, 1 );
11652
11742
  ret_val = Qfalse;
@@ -11667,7 +11757,6 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11667
11757
  /* At this point we know we are to retreive a statement option */
11668
11758
  } else {
11669
11759
  Data_Get_Struct(conn_or_stmt, stmt_handle, stmt_res);
11670
-
11671
11760
  /* Check that the option given is not null */
11672
11761
  if (!NIL_P(option)) {
11673
11762
  op_integer=(SQLINTEGER)FIX2INT(option);
@@ -11681,17 +11770,14 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11681
11770
  get_handleAttr_args->valuePtr = &value_int;
11682
11771
  get_handleAttr_args->buff_length = SQL_IS_INTEGER;
11683
11772
  get_handleAttr_args->out_length = NULL;
11684
-
11685
11773
  rc = _ruby_ibm_db_SQLGetStmtAttr_helper( get_handleAttr_args );
11686
11774
 
11687
11775
  ruby_xfree( get_handleAttr_args );
11688
11776
  get_handleAttr_args = NULL;
11689
-
11690
11777
  if (rc == SQL_ERROR) {
11691
11778
  _ruby_ibm_db_check_sql_errors( stmt_res, DB_STMT, stmt_res->hstmt, SQL_HANDLE_STMT, rc, 1, NULL, NULL, -1, 1, 1 );
11692
11779
  return Qfalse;
11693
11780
  }
11694
-
11695
11781
  return INT2NUM(value_int);
11696
11782
  } else {
11697
11783
  rb_warn("Invalid option specified");
@@ -11706,7 +11792,7 @@ VALUE ibm_db_get_option(int argc, VALUE *argv, VALUE self)
11706
11792
  } else {
11707
11793
  rb_warn("Supplied resource handle is invalid");
11708
11794
  return Qfalse;
11709
- }
11795
+ }
11710
11796
  }
11711
11797
 
11712
11798