ruby-odbc 0.999991 → 0.999992

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
  SHA256:
3
- metadata.gz: 860fc0eb5595959ec764079118f528b5b0afa5d49e919ab0f8c46e971bd7dbc0
4
- data.tar.gz: 843b2f2427d1378489cbc6eea0cb3e3ce5daff17f42ac3a040a0a979f04dddae
3
+ metadata.gz: 315eab824f23a66db4ba85087e7d09cb2aa0e6eac3b9835fd4d39061fe204be8
4
+ data.tar.gz: b545c991a43b6445b6416dcab4f764e067aac64a1443e9418f7f1f0152e18ad2
5
5
  SHA512:
6
- metadata.gz: 600c7ef68780fa4f3eae56dddd7ca01fa1cbd425b58a0c50663688bcefddc6b2471b79e0a51e044d95c570e531a91e4b883c5aa9b813c84c1997498e93024f5e
7
- data.tar.gz: 020cd8f08ffce0d846262d839db86b8741db74eeb0ce774ce69aa99d09a56a5b9cd70abf36b06d27f9216118aff945d3ace3778c93f914794c30420c8a43dfab
6
+ metadata.gz: b88edfe5f27e603ac0b848679f97d8bc00a8a9f8f4de562d6ec334d01198a2f7ac83224a19f1bef7726533de4c8ee06090e9f379d44d28534e90b1ec9e494a86
7
+ data.tar.gz: 217d69f18699b50018a34df2cf093f523738bd86d7c9317368354aaeda509de17364f4f572f763a03d443d2026fc64b522e0398dde3bf6e07b712a0fbf15eed8
data/ChangeLog CHANGED
@@ -1,6 +1,11 @@
1
1
  ODBC binding for Ruby
2
2
  ---------------------
3
3
 
4
+ Mon Sep 04 2023 version 0.999992 released
5
+
6
+ * update to compile with newer Ruby releases
7
+ * allow tuning GC threshold
8
+
4
9
  Sat Dec 26 2020 version 0.999991 released
5
10
 
6
11
  * update to compile with newer Ruby releases
data/README CHANGED
@@ -1,6 +1,6 @@
1
- # $Id: README,v 1.47 2020/12/25 21:47:43 chw Exp chw $
1
+ # $Id: README,v 1.48 2023/09/04 09:50:46 chw Exp chw $
2
2
 
3
- ruby-odbc-0.999991
3
+ ruby-odbc-0.999992
4
4
 
5
5
  This is an ODBC binding for Ruby. So far it has been tested with
6
6
 
data/doc/odbc.html CHANGED
@@ -27,7 +27,7 @@
27
27
  <body>
28
28
  <h1><a name="reference">Ruby ODBC Reference</a></h1>
29
29
  <div class = "lastmodifed">
30
- Last update: Wed, 28 February 2018
30
+ Last update: Mon, 04 September 2023
31
31
  </div>
32
32
  <hr>
33
33
  <div>
@@ -1338,6 +1338,7 @@ INTERN (1) [RubyODBC]Programmer forgot to RTFM</pre>
1338
1338
  <code>ODBC::write_file_dsn(<var>filename</var>,<var>appname</var>,<var>key</var>[,<var>value</var>])</code><br>
1339
1339
  <code>ODBC::read_file_dsn(<var>filename</var>,<var>appname</var>,<var>key</var>)</code><br>
1340
1340
  <code>ODBC::trace([<var>mask</var>])</code><br>
1341
+ <code>ODBC::gc_threshold(<var>number</var>])</code><br>
1341
1342
  <br>
1342
1343
  <code>ODBC::Statement.fetch!</code><br>
1343
1344
  <code>ODBC::Statement.fetch_first!</code><br>
data/ext/odbc.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * ODBC-Ruby binding
3
- * Copyright (c) 2001-2020 Christian Werner <chw@ch-werner.de>
3
+ * Copyright (c) 2001-2023 Christian Werner <chw@ch-werner.de>
4
4
  * Portions copyright (c) 2004 Ryszard Niewisiewicz <micz@fibernet.pl>
5
5
  * Portions copyright (c) 2006 Carl Blakeley <cblakeley@openlinksw.co.uk>
6
6
  *
@@ -8,7 +8,7 @@
8
8
  * and redistribution of this file and for a
9
9
  * DISCLAIMER OF ALL WARRANTIES.
10
10
  *
11
- * $Id: odbc.c,v 1.80 2020/12/25 21:45:42 chw Exp chw $
11
+ * $Id: odbc.c,v 1.81 2023/09/04 09:50:17 chw Exp chw $
12
12
  */
13
13
 
14
14
  #undef ODBCVER
@@ -64,9 +64,11 @@ typedef SQLCHAR SQLTCHAR;
64
64
  #define SQLROWSETSIZE SQLULEN
65
65
  #endif
66
66
 
67
+ #ifdef RUBY_VERSION_MAJOR
67
68
  #if (RUBY_VERSION_MAJOR <= 1) && (RUBY_VERSION_MINOR < 9)
68
69
  #define TIME_USE_USEC 1
69
70
  #endif
71
+ #endif
70
72
 
71
73
  #if (RUBY_API_VERSION_CODE >= 20500)
72
74
  #define FUNCALL_NOARGS(o, m) rb_funcall((o), (m), 0)
@@ -78,6 +80,20 @@ typedef SQLCHAR SQLTCHAR;
78
80
  #include "ruby/thread.h"
79
81
  #endif
80
82
 
83
+ /*
84
+ * Tainted strings for Ruby <= 2.7, no ops otherwise.
85
+ */
86
+
87
+ #if (RUBY_API_VERSION_CODE < 20700)
88
+ #define RB_TAINTED_STR_NEW(s, l) rb_tainted_str_new(s, l)
89
+ #define RB_TAINTED_STR_NEW2(s) rb_tainted_str_new2(s)
90
+ #define RB_OBJ_TAINT(o) rb_obj_taint(o)
91
+ #else
92
+ #define RB_TAINTED_STR_NEW(s, l) rb_str_new(s, l)
93
+ #define RB_TAINTED_STR_NEW2(s) rb_str_new2(s)
94
+ #define RB_OBJ_TAINT(o) o
95
+ #endif
96
+
81
97
  /*
82
98
  * Conditionally undefine aliases of ODBC installer UNICODE functions.
83
99
  */
@@ -155,6 +171,17 @@ static SQLRETURN tracesql(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt,
155
171
  #define tracesql(a, b, c, d, e) d
156
172
  #endif
157
173
 
174
+ /*
175
+ * When to call start_gc():
176
+ *
177
+ * gc_threshold < 0: never (the default)
178
+ * gc_threshold == 0: on connection close
179
+ * gc_threshold >= 0: on connection close and after
180
+ * fetching gc_threshold rows
181
+ */
182
+
183
+ static int gc_threshold = -1;
184
+
158
185
  #ifndef SQL_SUCCEEDED
159
186
  #define SQL_SUCCEEDED(x) \
160
187
  (((x) == SQL_SUCCESS) || ((x) == SQL_SUCCESS_WITH_INFO))
@@ -1380,7 +1407,7 @@ uc_tainted_str_new(SQLWCHAR *str, int len)
1380
1407
  if ((cp != NULL) && (str != NULL)) {
1381
1408
  ulen = mkutf(cp, str, len);
1382
1409
  }
1383
- v = rb_tainted_str_new((cp != NULL) ? cp : "", ulen);
1410
+ v = RB_TAINTED_STR_NEW((cp != NULL) ? cp : "", ulen);
1384
1411
  #ifdef USE_RB_ENC
1385
1412
  rb_enc_associate(v, rb_enc);
1386
1413
  #endif
@@ -1870,7 +1897,7 @@ set_err(const char *msg, int warn)
1870
1897
  rb_enc_associate(v, rb_enc);
1871
1898
  #endif
1872
1899
  a = rb_ary_new2(1);
1873
- rb_ary_push(a, rb_obj_taint(v));
1900
+ rb_ary_push(a, RB_OBJ_TAINT(v));
1874
1901
  CVAR_SET(Cobj, warn ? IDatatinfo : IDataterror, a);
1875
1902
  return STR2CSTR(v);
1876
1903
  }
@@ -1949,7 +1976,7 @@ get_err_or_info(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, int isinfo)
1949
1976
  v0 = v;
1950
1977
  a = rb_ary_new();
1951
1978
  }
1952
- rb_ary_push(a, rb_obj_taint(v));
1979
+ rb_ary_push(a, RB_OBJ_TAINT(v));
1953
1980
  tracemsg(1, fprintf(stderr, " | %s\n", STR2CSTR(v)););
1954
1981
  }
1955
1982
  }
@@ -2045,7 +2072,7 @@ get_installer_err()
2045
2072
  v0 = v;
2046
2073
  a = rb_ary_new();
2047
2074
  }
2048
- rb_ary_push(a, rb_obj_taint(v));
2075
+ rb_ary_push(a, RB_OBJ_TAINT(v));
2049
2076
  tracemsg(1, fprintf(stderr, " | %s\n", STR2CSTR(v)););
2050
2077
  }
2051
2078
  }
@@ -2299,7 +2326,7 @@ dbc_raise(VALUE self, VALUE msg)
2299
2326
  buf[SQL_MAX_MESSAGE_LENGTH] = '\0';
2300
2327
  v = rb_str_new2(buf);
2301
2328
  a = rb_ary_new2(1);
2302
- rb_ary_push(a, rb_obj_taint(v));
2329
+ rb_ary_push(a, RB_OBJ_TAINT(v));
2303
2330
  CVAR_SET(Cobj, IDataterror, a);
2304
2331
  rb_raise(Cerror, "%s", buf);
2305
2332
  return Qnil;
@@ -2389,8 +2416,8 @@ dbc_dsns(VALUE self)
2389
2416
  #else
2390
2417
  dsnLen = (dsnLen == 0) ? (SQLSMALLINT) strlen(dsn) : dsnLen;
2391
2418
  descrLen = (descrLen == 0) ? (SQLSMALLINT) strlen(descr) : descrLen;
2392
- rb_iv_set(odsn, "@name", rb_tainted_str_new(dsn, dsnLen));
2393
- rb_iv_set(odsn, "@descr", rb_tainted_str_new(descr, descrLen));
2419
+ rb_iv_set(odsn, "@name", RB_TAINTED_STR_NEW(dsn, dsnLen));
2420
+ rb_iv_set(odsn, "@descr", RB_TAINTED_STR_NEW(descr, descrLen));
2394
2421
  #endif
2395
2422
  rb_ary_push(aret, odsn);
2396
2423
  first = dsnLen = descrLen = 0;
@@ -2454,13 +2481,13 @@ dbc_drivers(VALUE self)
2454
2481
  }
2455
2482
  #else
2456
2483
  driverLen = (driverLen == 0) ? (SQLSMALLINT) strlen(driver) : driverLen;
2457
- rb_iv_set(odrv, "@name", rb_tainted_str_new(driver, driverLen));
2484
+ rb_iv_set(odrv, "@name", RB_TAINTED_STR_NEW(driver, driverLen));
2458
2485
  for (attr = attrs; *attr; attr += strlen(attr) + 1) {
2459
2486
  char *p = strchr(attr, '=');
2460
2487
 
2461
2488
  if ((p != NULL) && (p != attr)) {
2462
- rb_hash_aset(h, rb_tainted_str_new(attr, p - attr),
2463
- rb_tainted_str_new2(p + 1));
2489
+ rb_hash_aset(h, RB_TAINTED_STR_NEW(attr, p - attr),
2490
+ RB_TAINTED_STR_NEW2(p + 1));
2464
2491
  count++;
2465
2492
  }
2466
2493
  }
@@ -2769,7 +2796,7 @@ dbc_rfdsn(int argc, VALUE *argv, VALUE self)
2769
2796
  if (SQLReadFileDSN((LPCSTR) sfname, (LPCSTR) saname,
2770
2797
  (LPCSTR) skname, (LPSTR) valbuf,
2771
2798
  sizeof (valbuf), NULL)) {
2772
- return rb_tainted_str_new2((char *) valbuf);
2799
+ return RB_TAINTED_STR_NEW2((char *) valbuf);
2773
2800
  }
2774
2801
  }
2775
2802
  #else
@@ -2779,7 +2806,7 @@ dbc_rfdsn(int argc, VALUE *argv, VALUE self)
2779
2806
  valbuf[0] = '\0';
2780
2807
  if (SQLReadFileDSN(sfname, saname, skname, valbuf,
2781
2808
  sizeof (valbuf), NULL)) {
2782
- return rb_tainted_str_new2(valbuf);
2809
+ return RB_TAINTED_STR_NEW2(valbuf);
2783
2810
  }
2784
2811
  #endif
2785
2812
  #if defined(HAVE_SQLINSTALLERERROR) || (defined(UNICODE) && defined(HAVE_SQLINSTALLERERRORW))
@@ -3190,7 +3217,9 @@ dbc_disconnect(int argc, VALUE *argv, VALUE self)
3190
3217
  }
3191
3218
  p->hdbc = SQL_NULL_HDBC;
3192
3219
  unlink_dbc(p);
3193
- start_gc();
3220
+ if (gc_threshold >= 0) {
3221
+ start_gc();
3222
+ }
3194
3223
  return Qtrue;
3195
3224
  }
3196
3225
  return Qfalse;
@@ -3207,10 +3236,10 @@ dbc_disconnect(int argc, VALUE *argv, VALUE self)
3207
3236
  #ifndef SQL_DTC_TRANSITION_COST
3208
3237
  #define SQL_DTC_TRANSITION_COST 1750
3209
3238
  #endif
3210
- #ifndef SQL_DTC_ENLIST_EXPENSIZE
3239
+ #ifndef SQL_DTC_ENLIST_EXPENDSIZE
3211
3240
  #define SQL_DTC_ENLIST_EXPENDSIZE 1
3212
3241
  #endif
3213
- #ifndef SQL_DTC_UNENLIST_EXPENSIZE
3242
+ #ifndef SQL_DTC_UNENLIST_EXPENDSIZE
3214
3243
  #define SQL_DTC_UNENLIST_EXPENDSIZE 2
3215
3244
  #endif
3216
3245
 
@@ -3992,7 +4021,12 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
3992
4021
  SQLUSMALLINT sbuffer;
3993
4022
  SQLUINTEGER lbuffer;
3994
4023
  SQLSMALLINT len_in, len_out;
3995
- char *string = NULL, buffer[513];
4024
+ char *string = NULL;
4025
+ #ifdef UNICODE
4026
+ SQLWCHAR buffer[513];
4027
+ #else
4028
+ char buffer[513];
4029
+ #endif
3996
4030
 
3997
4031
  rb_scan_args(argc, argv, "11", &which, &vtype);
3998
4032
  switch (TYPE(which)) {
@@ -4098,7 +4132,11 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
4098
4132
  break;
4099
4133
  default:
4100
4134
  case SQL_C_CHAR:
4135
+ #ifdef UNICODE
4136
+ len_in = sizeof (buffer) - sizeof (SQLWCHAR);
4137
+ #else
4101
4138
  len_in = sizeof (buffer) - 1;
4139
+ #endif
4102
4140
  memset(buffer, 0, sizeof (buffer));
4103
4141
  ret = SQLGetInfo(p->hdbc, (SQLUSMALLINT) info,
4104
4142
  (SQLPOINTER) buffer, len_in, &len_out);
@@ -4115,7 +4153,11 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
4115
4153
  return INT2NUM(lbuffer);
4116
4154
  default:
4117
4155
  case SQL_C_CHAR:
4156
+ #ifdef UNICODE
4157
+ return uc_str_new(buffer, len_out / sizeof (SQLWCHAR));
4158
+ #else
4118
4159
  return rb_str_new(buffer, len_out);
4160
+ #endif
4119
4161
  }
4120
4162
  return Qnil;
4121
4163
  }
@@ -4574,7 +4616,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4574
4616
  len = 0;
4575
4617
  }
4576
4618
  mkutf(tmp, name, len);
4577
- v = rb_tainted_str_new2(upcase_if(tmp, 1));
4619
+ v = RB_TAINTED_STR_NEW2(upcase_if(tmp, 1));
4578
4620
  #ifdef USE_RB_ENC
4579
4621
  rb_enc_associate(v, rb_enc);
4580
4622
  #endif
@@ -4586,7 +4628,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4586
4628
  rb_iv_set(obj, "@name", uc_tainted_str_new2(name));
4587
4629
  }
4588
4630
  #else
4589
- rb_iv_set(obj, "@name", rb_tainted_str_new2(upcase_if(name, upc)));
4631
+ rb_iv_set(obj, "@name", RB_TAINTED_STR_NEW2(upcase_if(name, upc)));
4590
4632
  #endif
4591
4633
  v = Qnil;
4592
4634
  name[0] = 0;
@@ -4604,7 +4646,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4604
4646
  #ifdef UNICODE
4605
4647
  v = uc_tainted_str_new2(name);
4606
4648
  #else
4607
- v = rb_tainted_str_new2(name);
4649
+ v = RB_TAINTED_STR_NEW2(name);
4608
4650
  #endif
4609
4651
  }
4610
4652
  rb_iv_set(obj, "@table", v);
@@ -5224,9 +5266,9 @@ env_odbcver(int argc, VALUE *argv, VALUE self)
5224
5266
  *----------------------------------------------------------------------
5225
5267
  */
5226
5268
 
5227
- #define OPT_LEVEL_STMT 1
5228
- #define OPT_LEVEL_DBC 2
5229
- #define OPT_LEVEL_BOTH (OPT_LEVEL_STMT | OPT_LEVEL_DBC)
5269
+ #define OPT_LEVEL_STMT 1
5270
+ #define OPT_LEVEL_DBC 2
5271
+ #define OPT_LEVEL_BOTH (OPT_LEVEL_STMT | OPT_LEVEL_DBC)
5230
5272
 
5231
5273
  #define OPT_CONST_INT(x, level) { #x, x, level }
5232
5274
  #define OPT_CONST_END { NULL, -1 }
@@ -6704,7 +6746,7 @@ stmt_param_output_value(int argc, VALUE *argv, VALUE self)
6704
6746
  break;
6705
6747
  #endif
6706
6748
  case SQL_C_CHAR:
6707
- v = rb_tainted_str_new(q->paraminfo[vnum].outbuf,
6749
+ v = RB_TAINTED_STR_NEW(q->paraminfo[vnum].outbuf,
6708
6750
  q->paraminfo[vnum].rlen);
6709
6751
  break;
6710
6752
  }
@@ -6780,7 +6822,7 @@ stmt_cursorname(int argc, VALUE *argv, VALUE self)
6780
6822
  return uc_tainted_str_new(cname, cnLen);
6781
6823
  #else
6782
6824
  cnLen = (cnLen == 0) ? (SQLSMALLINT) strlen((char *) cname) : cnLen;
6783
- return rb_tainted_str_new((char *) cname, cnLen);
6825
+ return RB_TAINTED_STR_NEW((char *) cname, cnLen);
6784
6826
  #endif
6785
6827
  }
6786
6828
  if (TYPE(cn) != T_STRING) {
@@ -6866,7 +6908,7 @@ stmt_columns(int argc, VALUE *argv, VALUE self)
6866
6908
 
6867
6909
  sprintf(buf, "#%d", i);
6868
6910
  name = rb_str_dup(name);
6869
- name = rb_obj_taint(rb_str_cat2(name, buf));
6911
+ name = RB_OBJ_TAINT(rb_str_cat2(name, buf));
6870
6912
  }
6871
6913
  rb_hash_aset(res, name, obj);
6872
6914
  }
@@ -6925,7 +6967,7 @@ do_fetch(STMT *q, int mode)
6925
6967
  if (q->ncols <= 0) {
6926
6968
  rb_raise(Cerror, "%s", set_err("No columns in result set", 0));
6927
6969
  }
6928
- if (++q->fetchc >= 500) {
6970
+ if (gc_threshold > 0 && ++q->fetchc >= gc_threshold) {
6929
6971
  q->fetchc = 0;
6930
6972
  start_gc();
6931
6973
  }
@@ -7115,7 +7157,7 @@ do_fetch(STMT *q, int mode)
7115
7157
  }
7116
7158
  for (i = 0; i < 4 * q->ncols; i++) {
7117
7159
  res = colbuf[i / q->ncols];
7118
- cname = rb_tainted_str_new2(q->colnames[i]);
7160
+ cname = RB_TAINTED_STR_NEW2(q->colnames[i]);
7119
7161
  #ifdef USE_RB_ENC
7120
7162
  rb_enc_associate(cname, rb_enc);
7121
7163
  #endif
@@ -7123,7 +7165,7 @@ do_fetch(STMT *q, int mode)
7123
7165
  if (rb_funcall(res, IDkeyp, 1, cname) == Qtrue) {
7124
7166
  char *p;
7125
7167
 
7126
- cname = rb_tainted_str_new2(q->colnames[i]);
7168
+ cname = RB_TAINTED_STR_NEW2(q->colnames[i]);
7127
7169
  #ifdef USE_RB_ENC
7128
7170
  rb_enc_associate(cname, rb_enc);
7129
7171
  #endif
@@ -7364,7 +7406,7 @@ do_fetch(STMT *q, int mode)
7364
7406
  break;
7365
7407
  #endif
7366
7408
  default:
7367
- v = rb_tainted_str_new(valp, curlen);
7409
+ v = RB_TAINTED_STR_NEW(valp, curlen);
7368
7410
  break;
7369
7411
  }
7370
7412
  }
@@ -7377,14 +7419,14 @@ do_fetch(STMT *q, int mode)
7377
7419
  valp = q->colnames[i + offc];
7378
7420
  name = (q->colvals == NULL) ? Qnil : q->colvals[i + offc];
7379
7421
  if (name == Qnil) {
7380
- name = rb_tainted_str_new2(valp);
7422
+ name = RB_TAINTED_STR_NEW2(valp);
7381
7423
  #ifdef USE_RB_ENC
7382
7424
  rb_enc_associate(name, rb_enc);
7383
7425
  #endif
7384
7426
  if (rb_funcall(res, IDkeyp, 1, name) == Qtrue) {
7385
7427
  char *p;
7386
7428
 
7387
- name = rb_tainted_str_new2(valp);
7429
+ name = RB_TAINTED_STR_NEW2(valp);
7388
7430
  #ifdef USE_RB_ENC
7389
7431
  rb_enc_associate(name, rb_enc);
7390
7432
  #endif
@@ -8598,14 +8640,28 @@ stmt_proc(int argc, VALUE *argv, VALUE self)
8598
8640
  {
8599
8641
  VALUE sql, ptype, psize, pnum = Qnil, stmt, args[2];
8600
8642
  int parnum = 0;
8643
+ #if (RUBY_API_VERSION_CODE >= 30000)
8644
+ VALUE block, proc_new_args[2];
8645
+ #endif
8601
8646
 
8647
+ #if (RUBY_API_VERSION_CODE >= 30000)
8648
+ rb_scan_args(argc, argv, "13&", &sql, &ptype, &psize, &pnum, &block);
8649
+ #else
8602
8650
  rb_scan_args(argc, argv, "13", &sql, &ptype, &psize, &pnum);
8651
+ #endif
8603
8652
  if (!rb_block_given_p()) {
8604
8653
  rb_raise(rb_eArgError, "block required");
8605
8654
  }
8606
8655
  stmt = stmt_prep_int(1, &sql, self, 0);
8656
+ #if (RUBY_API_VERSION_CODE >= 30000)
8657
+ proc_new_args[0] = stmt;
8658
+ #endif
8607
8659
  if (argc == 1) {
8660
+ #if (RUBY_API_VERSION_CODE >= 30000)
8661
+ return rb_funcall_with_block(Cproc, IDnew, 1, proc_new_args, block);
8662
+ #else
8608
8663
  return rb_funcall(Cproc, IDnew, 1, stmt);
8664
+ #endif
8609
8665
  }
8610
8666
  if ((argc < 4) || (pnum == Qnil)) {
8611
8667
  pnum = INT2NUM(parnum);
@@ -8623,7 +8679,12 @@ stmt_proc(int argc, VALUE *argv, VALUE self)
8623
8679
  args[1] = INT2NUM(256);
8624
8680
  }
8625
8681
  stmt_param_output_size(2, args, stmt);
8682
+ #if (RUBY_API_VERSION_CODE >= 30000)
8683
+ proc_new_args[1] = pnum;
8684
+ return rb_funcall_with_block(Cproc, IDnew, 2, proc_new_args, block);
8685
+ #else
8626
8686
  return rb_funcall(Cproc, IDnew, 2, stmt, pnum);
8687
+ #endif
8627
8688
  }
8628
8689
 
8629
8690
  static VALUE
@@ -8826,6 +8887,18 @@ mod_trace(int argc, VALUE *argv, VALUE self)
8826
8887
  return INT2NUM(0);
8827
8888
  #endif
8828
8889
  }
8890
+
8891
+ static VALUE
8892
+ mod_gc_threshold(int argc, VALUE *argv, VALUE self)
8893
+ {
8894
+ VALUE v = Qnil;
8895
+
8896
+ rb_scan_args(argc, argv, "01", &v);
8897
+ if (argc > 0) {
8898
+ gc_threshold = NUM2INT(v);
8899
+ }
8900
+ return INT2NUM(gc_threshold);
8901
+ }
8829
8902
 
8830
8903
  /*
8831
8904
  *----------------------------------------------------------------------
@@ -9201,6 +9274,8 @@ Init_odbc()
9201
9274
  rb_define_module_function(Modbc, "connection_pooling", env_cpooling, -1);
9202
9275
  rb_define_module_function(Modbc, "connection_pooling=", env_cpooling, -1);
9203
9276
  rb_define_module_function(Modbc, "raise", dbc_raise, 1);
9277
+ rb_define_module_function(Modbc, "gc_threshold", mod_gc_threshold, -1);
9278
+ rb_define_module_function(Modbc, "gc_threshold=", mod_gc_threshold, -1);
9204
9279
 
9205
9280
  /* singleton methods and constructors */
9206
9281
  rb_define_singleton_method(Cobj, "error", dbc_error, 0);
data/ruby-odbc.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
  spec = Gem::Specification.new do |s|
3
3
  s.name = "ruby-odbc"
4
- s.version = "0.999991"
4
+ s.version = "0.999992"
5
5
  s.date = Date.today.to_s
6
6
  s.author = "Christian Werner"
7
7
  s.email = "chw @nospam@ ch-werner.de"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-odbc
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.999991'
4
+ version: '0.999992'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-26 00:00:00.000000000 Z
11
+ date: 2023-09-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: chw @nospam@ ch-werner.de
@@ -66,7 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubygems_version: 3.1.4
69
+ rubyforge_project:
70
+ rubygems_version: 2.7.6.2
70
71
  signing_key:
71
72
  specification_version: 4
72
73
  summary: ODBC binding for Ruby