ruby-odbc 0.999991 → 0.999993
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog +9 -0
- data/README +2 -2
- data/doc/odbc.html +2 -1
- data/ext/odbc.c +112 -35
- data/ruby-odbc.gemspec +4 -3
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc3a923dbadaf4719ab76e208639b888414d3928fdc912e33fcaa6d592d27463
|
|
4
|
+
data.tar.gz: 0a0140fe279b62a1c3b6c515ed5f5da1505adf1e4b51cf5fb989664613fe574d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 32ec3624b090ad1d7283963fb8fc0699602059ce5cb6979032f0f9b3373c251930f7a7135e688381f05451b0bddf94bb27f6c1a102d4c857a23ed1679c95eaa6
|
|
7
|
+
data.tar.gz: 07c92137865054c0373e9aa8652b6c0f37f06cf0d034b11599edf73126fef59b2753d245646c45c17552227b799bf31931e285847acc05188288a4d0f2ed6d54
|
data/ChangeLog
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
ODBC binding for Ruby
|
|
2
2
|
---------------------
|
|
3
3
|
|
|
4
|
+
Sun Apr 12 2026 version 0.999993 released
|
|
5
|
+
|
|
6
|
+
* update to compile/bundle with newer Ruby releases
|
|
7
|
+
|
|
8
|
+
Mon Sep 04 2023 version 0.999992 released
|
|
9
|
+
|
|
10
|
+
* update to compile with newer Ruby releases
|
|
11
|
+
* allow tuning GC threshold
|
|
12
|
+
|
|
4
13
|
Sat Dec 26 2020 version 0.999991 released
|
|
5
14
|
|
|
6
15
|
* update to compile with newer Ruby releases
|
data/README
CHANGED
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:
|
|
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-
|
|
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.
|
|
11
|
+
* $Id: odbc.c,v 1.82 2026/04/12 07:58:38 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 =
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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",
|
|
2393
|
-
rb_iv_set(odsn, "@descr",
|
|
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",
|
|
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,
|
|
2463
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
3239
|
+
#ifndef SQL_DTC_ENLIST_EXPENDSIZE
|
|
3211
3240
|
#define SQL_DTC_ENLIST_EXPENDSIZE 1
|
|
3212
3241
|
#endif
|
|
3213
|
-
#ifndef
|
|
3242
|
+
#ifndef SQL_DTC_UNENLIST_EXPENDSIZE
|
|
3214
3243
|
#define SQL_DTC_UNENLIST_EXPENDSIZE 2
|
|
3215
3244
|
#endif
|
|
3216
3245
|
|
|
@@ -3992,7 +4021,14 @@ 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
|
|
4024
|
+
char *string = NULL;
|
|
4025
|
+
#ifdef UNICODE
|
|
4026
|
+
SQLWCHAR buffer[513];
|
|
4027
|
+
char *errbuf = (char *) buffer;
|
|
4028
|
+
#else
|
|
4029
|
+
char buffer[513];
|
|
4030
|
+
char *errbuf = buffer;
|
|
4031
|
+
#endif
|
|
3996
4032
|
|
|
3997
4033
|
rb_scan_args(argc, argv, "11", &which, &vtype);
|
|
3998
4034
|
switch (TYPE(which)) {
|
|
@@ -4038,9 +4074,9 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
|
|
|
4038
4074
|
0));
|
|
4039
4075
|
return Qnil;
|
|
4040
4076
|
case 1:
|
|
4041
|
-
sprintf(
|
|
4077
|
+
sprintf(errbuf, "Unknown info type %d for ODBC::Connection.get_info",
|
|
4042
4078
|
info);
|
|
4043
|
-
set_err(
|
|
4079
|
+
set_err(errbuf, 1);
|
|
4044
4080
|
break;
|
|
4045
4081
|
}
|
|
4046
4082
|
if (vtype != Qnil) {
|
|
@@ -4098,7 +4134,11 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
|
|
|
4098
4134
|
break;
|
|
4099
4135
|
default:
|
|
4100
4136
|
case SQL_C_CHAR:
|
|
4137
|
+
#ifdef UNICODE
|
|
4138
|
+
len_in = sizeof (buffer) - sizeof (SQLWCHAR);
|
|
4139
|
+
#else
|
|
4101
4140
|
len_in = sizeof (buffer) - 1;
|
|
4141
|
+
#endif
|
|
4102
4142
|
memset(buffer, 0, sizeof (buffer));
|
|
4103
4143
|
ret = SQLGetInfo(p->hdbc, (SQLUSMALLINT) info,
|
|
4104
4144
|
(SQLPOINTER) buffer, len_in, &len_out);
|
|
@@ -4115,7 +4155,11 @@ dbc_getinfo(int argc, VALUE *argv, VALUE self)
|
|
|
4115
4155
|
return INT2NUM(lbuffer);
|
|
4116
4156
|
default:
|
|
4117
4157
|
case SQL_C_CHAR:
|
|
4158
|
+
#ifdef UNICODE
|
|
4159
|
+
return uc_str_new(buffer, len_out / sizeof (SQLWCHAR));
|
|
4160
|
+
#else
|
|
4118
4161
|
return rb_str_new(buffer, len_out);
|
|
4162
|
+
#endif
|
|
4119
4163
|
}
|
|
4120
4164
|
return Qnil;
|
|
4121
4165
|
}
|
|
@@ -4574,7 +4618,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
|
4574
4618
|
len = 0;
|
|
4575
4619
|
}
|
|
4576
4620
|
mkutf(tmp, name, len);
|
|
4577
|
-
v =
|
|
4621
|
+
v = RB_TAINTED_STR_NEW2(upcase_if(tmp, 1));
|
|
4578
4622
|
#ifdef USE_RB_ENC
|
|
4579
4623
|
rb_enc_associate(v, rb_enc);
|
|
4580
4624
|
#endif
|
|
@@ -4586,7 +4630,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
|
4586
4630
|
rb_iv_set(obj, "@name", uc_tainted_str_new2(name));
|
|
4587
4631
|
}
|
|
4588
4632
|
#else
|
|
4589
|
-
rb_iv_set(obj, "@name",
|
|
4633
|
+
rb_iv_set(obj, "@name", RB_TAINTED_STR_NEW2(upcase_if(name, upc)));
|
|
4590
4634
|
#endif
|
|
4591
4635
|
v = Qnil;
|
|
4592
4636
|
name[0] = 0;
|
|
@@ -4604,7 +4648,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
|
4604
4648
|
#ifdef UNICODE
|
|
4605
4649
|
v = uc_tainted_str_new2(name);
|
|
4606
4650
|
#else
|
|
4607
|
-
v =
|
|
4651
|
+
v = RB_TAINTED_STR_NEW2(name);
|
|
4608
4652
|
#endif
|
|
4609
4653
|
}
|
|
4610
4654
|
rb_iv_set(obj, "@table", v);
|
|
@@ -5224,9 +5268,9 @@ env_odbcver(int argc, VALUE *argv, VALUE self)
|
|
|
5224
5268
|
*----------------------------------------------------------------------
|
|
5225
5269
|
*/
|
|
5226
5270
|
|
|
5227
|
-
#define OPT_LEVEL_STMT
|
|
5228
|
-
#define OPT_LEVEL_DBC
|
|
5229
|
-
#define OPT_LEVEL_BOTH
|
|
5271
|
+
#define OPT_LEVEL_STMT 1
|
|
5272
|
+
#define OPT_LEVEL_DBC 2
|
|
5273
|
+
#define OPT_LEVEL_BOTH (OPT_LEVEL_STMT | OPT_LEVEL_DBC)
|
|
5230
5274
|
|
|
5231
5275
|
#define OPT_CONST_INT(x, level) { #x, x, level }
|
|
5232
5276
|
#define OPT_CONST_END { NULL, -1 }
|
|
@@ -6704,7 +6748,7 @@ stmt_param_output_value(int argc, VALUE *argv, VALUE self)
|
|
|
6704
6748
|
break;
|
|
6705
6749
|
#endif
|
|
6706
6750
|
case SQL_C_CHAR:
|
|
6707
|
-
v =
|
|
6751
|
+
v = RB_TAINTED_STR_NEW(q->paraminfo[vnum].outbuf,
|
|
6708
6752
|
q->paraminfo[vnum].rlen);
|
|
6709
6753
|
break;
|
|
6710
6754
|
}
|
|
@@ -6780,7 +6824,7 @@ stmt_cursorname(int argc, VALUE *argv, VALUE self)
|
|
|
6780
6824
|
return uc_tainted_str_new(cname, cnLen);
|
|
6781
6825
|
#else
|
|
6782
6826
|
cnLen = (cnLen == 0) ? (SQLSMALLINT) strlen((char *) cname) : cnLen;
|
|
6783
|
-
return
|
|
6827
|
+
return RB_TAINTED_STR_NEW((char *) cname, cnLen);
|
|
6784
6828
|
#endif
|
|
6785
6829
|
}
|
|
6786
6830
|
if (TYPE(cn) != T_STRING) {
|
|
@@ -6866,7 +6910,7 @@ stmt_columns(int argc, VALUE *argv, VALUE self)
|
|
|
6866
6910
|
|
|
6867
6911
|
sprintf(buf, "#%d", i);
|
|
6868
6912
|
name = rb_str_dup(name);
|
|
6869
|
-
name =
|
|
6913
|
+
name = RB_OBJ_TAINT(rb_str_cat2(name, buf));
|
|
6870
6914
|
}
|
|
6871
6915
|
rb_hash_aset(res, name, obj);
|
|
6872
6916
|
}
|
|
@@ -6925,7 +6969,7 @@ do_fetch(STMT *q, int mode)
|
|
|
6925
6969
|
if (q->ncols <= 0) {
|
|
6926
6970
|
rb_raise(Cerror, "%s", set_err("No columns in result set", 0));
|
|
6927
6971
|
}
|
|
6928
|
-
if (++q->fetchc >=
|
|
6972
|
+
if (gc_threshold > 0 && ++q->fetchc >= gc_threshold) {
|
|
6929
6973
|
q->fetchc = 0;
|
|
6930
6974
|
start_gc();
|
|
6931
6975
|
}
|
|
@@ -7115,7 +7159,7 @@ do_fetch(STMT *q, int mode)
|
|
|
7115
7159
|
}
|
|
7116
7160
|
for (i = 0; i < 4 * q->ncols; i++) {
|
|
7117
7161
|
res = colbuf[i / q->ncols];
|
|
7118
|
-
cname =
|
|
7162
|
+
cname = RB_TAINTED_STR_NEW2(q->colnames[i]);
|
|
7119
7163
|
#ifdef USE_RB_ENC
|
|
7120
7164
|
rb_enc_associate(cname, rb_enc);
|
|
7121
7165
|
#endif
|
|
@@ -7123,7 +7167,7 @@ do_fetch(STMT *q, int mode)
|
|
|
7123
7167
|
if (rb_funcall(res, IDkeyp, 1, cname) == Qtrue) {
|
|
7124
7168
|
char *p;
|
|
7125
7169
|
|
|
7126
|
-
cname =
|
|
7170
|
+
cname = RB_TAINTED_STR_NEW2(q->colnames[i]);
|
|
7127
7171
|
#ifdef USE_RB_ENC
|
|
7128
7172
|
rb_enc_associate(cname, rb_enc);
|
|
7129
7173
|
#endif
|
|
@@ -7364,7 +7408,7 @@ do_fetch(STMT *q, int mode)
|
|
|
7364
7408
|
break;
|
|
7365
7409
|
#endif
|
|
7366
7410
|
default:
|
|
7367
|
-
v =
|
|
7411
|
+
v = RB_TAINTED_STR_NEW(valp, curlen);
|
|
7368
7412
|
break;
|
|
7369
7413
|
}
|
|
7370
7414
|
}
|
|
@@ -7377,14 +7421,14 @@ do_fetch(STMT *q, int mode)
|
|
|
7377
7421
|
valp = q->colnames[i + offc];
|
|
7378
7422
|
name = (q->colvals == NULL) ? Qnil : q->colvals[i + offc];
|
|
7379
7423
|
if (name == Qnil) {
|
|
7380
|
-
name =
|
|
7424
|
+
name = RB_TAINTED_STR_NEW2(valp);
|
|
7381
7425
|
#ifdef USE_RB_ENC
|
|
7382
7426
|
rb_enc_associate(name, rb_enc);
|
|
7383
7427
|
#endif
|
|
7384
7428
|
if (rb_funcall(res, IDkeyp, 1, name) == Qtrue) {
|
|
7385
7429
|
char *p;
|
|
7386
7430
|
|
|
7387
|
-
name =
|
|
7431
|
+
name = RB_TAINTED_STR_NEW2(valp);
|
|
7388
7432
|
#ifdef USE_RB_ENC
|
|
7389
7433
|
rb_enc_associate(name, rb_enc);
|
|
7390
7434
|
#endif
|
|
@@ -8598,14 +8642,28 @@ stmt_proc(int argc, VALUE *argv, VALUE self)
|
|
|
8598
8642
|
{
|
|
8599
8643
|
VALUE sql, ptype, psize, pnum = Qnil, stmt, args[2];
|
|
8600
8644
|
int parnum = 0;
|
|
8645
|
+
#if (RUBY_API_VERSION_CODE >= 30000)
|
|
8646
|
+
VALUE block, proc_new_args[2];
|
|
8647
|
+
#endif
|
|
8601
8648
|
|
|
8649
|
+
#if (RUBY_API_VERSION_CODE >= 30000)
|
|
8650
|
+
rb_scan_args(argc, argv, "13&", &sql, &ptype, &psize, &pnum, &block);
|
|
8651
|
+
#else
|
|
8602
8652
|
rb_scan_args(argc, argv, "13", &sql, &ptype, &psize, &pnum);
|
|
8653
|
+
#endif
|
|
8603
8654
|
if (!rb_block_given_p()) {
|
|
8604
8655
|
rb_raise(rb_eArgError, "block required");
|
|
8605
8656
|
}
|
|
8606
8657
|
stmt = stmt_prep_int(1, &sql, self, 0);
|
|
8658
|
+
#if (RUBY_API_VERSION_CODE >= 30000)
|
|
8659
|
+
proc_new_args[0] = stmt;
|
|
8660
|
+
#endif
|
|
8607
8661
|
if (argc == 1) {
|
|
8662
|
+
#if (RUBY_API_VERSION_CODE >= 30000)
|
|
8663
|
+
return rb_funcall_with_block(Cproc, IDnew, 1, proc_new_args, block);
|
|
8664
|
+
#else
|
|
8608
8665
|
return rb_funcall(Cproc, IDnew, 1, stmt);
|
|
8666
|
+
#endif
|
|
8609
8667
|
}
|
|
8610
8668
|
if ((argc < 4) || (pnum == Qnil)) {
|
|
8611
8669
|
pnum = INT2NUM(parnum);
|
|
@@ -8623,7 +8681,12 @@ stmt_proc(int argc, VALUE *argv, VALUE self)
|
|
|
8623
8681
|
args[1] = INT2NUM(256);
|
|
8624
8682
|
}
|
|
8625
8683
|
stmt_param_output_size(2, args, stmt);
|
|
8684
|
+
#if (RUBY_API_VERSION_CODE >= 30000)
|
|
8685
|
+
proc_new_args[1] = pnum;
|
|
8686
|
+
return rb_funcall_with_block(Cproc, IDnew, 2, proc_new_args, block);
|
|
8687
|
+
#else
|
|
8626
8688
|
return rb_funcall(Cproc, IDnew, 2, stmt, pnum);
|
|
8689
|
+
#endif
|
|
8627
8690
|
}
|
|
8628
8691
|
|
|
8629
8692
|
static VALUE
|
|
@@ -8826,6 +8889,18 @@ mod_trace(int argc, VALUE *argv, VALUE self)
|
|
|
8826
8889
|
return INT2NUM(0);
|
|
8827
8890
|
#endif
|
|
8828
8891
|
}
|
|
8892
|
+
|
|
8893
|
+
static VALUE
|
|
8894
|
+
mod_gc_threshold(int argc, VALUE *argv, VALUE self)
|
|
8895
|
+
{
|
|
8896
|
+
VALUE v = Qnil;
|
|
8897
|
+
|
|
8898
|
+
rb_scan_args(argc, argv, "01", &v);
|
|
8899
|
+
if (argc > 0) {
|
|
8900
|
+
gc_threshold = NUM2INT(v);
|
|
8901
|
+
}
|
|
8902
|
+
return INT2NUM(gc_threshold);
|
|
8903
|
+
}
|
|
8829
8904
|
|
|
8830
8905
|
/*
|
|
8831
8906
|
*----------------------------------------------------------------------
|
|
@@ -9201,6 +9276,8 @@ Init_odbc()
|
|
|
9201
9276
|
rb_define_module_function(Modbc, "connection_pooling", env_cpooling, -1);
|
|
9202
9277
|
rb_define_module_function(Modbc, "connection_pooling=", env_cpooling, -1);
|
|
9203
9278
|
rb_define_module_function(Modbc, "raise", dbc_raise, 1);
|
|
9279
|
+
rb_define_module_function(Modbc, "gc_threshold", mod_gc_threshold, -1);
|
|
9280
|
+
rb_define_module_function(Modbc, "gc_threshold=", mod_gc_threshold, -1);
|
|
9204
9281
|
|
|
9205
9282
|
/* singleton methods and constructors */
|
|
9206
9283
|
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.
|
|
4
|
+
s.version = "0.999993"
|
|
5
5
|
s.date = Date.today.to_s
|
|
6
6
|
s.author = "Christian Werner"
|
|
7
7
|
s.email = "chw @nospam@ ch-werner.de"
|
|
@@ -9,8 +9,9 @@ spec = Gem::Specification.new do |s|
|
|
|
9
9
|
s.homepage = "http://www.ch-werner.de/rubyodbc"
|
|
10
10
|
s.files = Dir.glob("**/*")
|
|
11
11
|
s.require_paths << 'lib'
|
|
12
|
-
|
|
13
|
-
s.
|
|
12
|
+
# The following two items are deprecated
|
|
13
|
+
# s.test_files = Dir.glob('tests/*.rb')
|
|
14
|
+
# s.has_rdoc = false
|
|
14
15
|
s.extra_rdoc_files = ["README", "COPYING", "ChangeLog", "GPL", "doc/odbc.html"]
|
|
15
16
|
s.extensions = ["ext/extconf.rb", "ext/utf8/extconf.rb"]
|
|
16
17
|
end
|
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.
|
|
4
|
+
version: '0.999993'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Werner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-04-12 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
|
-
|
|
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
|