ruby-odbc 0.99997 → 0.999991
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 +5 -5
- data/COPYING +1 -1
- data/ChangeLog +17 -0
- data/README +8 -6
- data/doc/odbc.html +18 -11
- data/ext/extconf.rb +4 -3
- data/ext/odbc.c +108 -58
- data/ext/utf8/extconf.rb +5 -3
- data/ruby-odbc.gemspec +1 -1
- data/test/30select.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 860fc0eb5595959ec764079118f528b5b0afa5d49e919ab0f8c46e971bd7dbc0
|
4
|
+
data.tar.gz: 843b2f2427d1378489cbc6eea0cb3e3ce5daff17f42ac3a040a0a979f04dddae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 600c7ef68780fa4f3eae56dddd7ca01fa1cbd425b58a0c50663688bcefddc6b2471b79e0a51e044d95c570e531a91e4b883c5aa9b813c84c1997498e93024f5e
|
7
|
+
data.tar.gz: 020cd8f08ffce0d846262d839db86b8741db74eeb0ce774ce69aa99d09a56a5b9cd70abf36b06d27f9216118aff945d3ace3778c93f914794c30420c8a43dfab
|
data/COPYING
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Ruby/ODBC is copyrighted free software by Christian Werner
|
1
|
+
Ruby/ODBC is copyrighted free software by Christian Werner chw at ch-werner.de
|
2
2
|
You can redistribute it and/or modify it under either the terms of the GPL
|
3
3
|
(see the file GPL), or the conditions below:
|
4
4
|
|
data/ChangeLog
CHANGED
@@ -1,6 +1,23 @@
|
|
1
1
|
ODBC binding for Ruby
|
2
2
|
---------------------
|
3
3
|
|
4
|
+
Sat Dec 26 2020 version 0.999991 released
|
5
|
+
|
6
|
+
* update to compile with newer Ruby releases
|
7
|
+
* report larger width for SQL_(DECIMAL|NUMERIC) columns
|
8
|
+
|
9
|
+
Wed Feb 28 2018 version 0.99999 released
|
10
|
+
|
11
|
+
* update to compile with newer Ruby releases, thanks
|
12
|
+
Lars Kanis for patch
|
13
|
+
* added ODBC::Database.login_timeout to get/set the
|
14
|
+
SQL_LOGIN_TIMEOUT connection attribute
|
15
|
+
|
16
|
+
Wed Feb 15 2017 version 0.99998 released
|
17
|
+
|
18
|
+
* minor update to compile with Ruby 2.4, thangs to Kevin Deisz
|
19
|
+
* preset output vars before SQLColAttributes() call
|
20
|
+
|
4
21
|
Wed Apr 15 2015 version 0.99997 released
|
5
22
|
|
6
23
|
* fixed bug (typo) when compiling with Ruby < 2.0
|
data/README
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
# $Id: README,v 1.
|
1
|
+
# $Id: README,v 1.47 2020/12/25 21:47:43 chw Exp chw $
|
2
2
|
|
3
|
-
ruby-odbc-0.
|
3
|
+
ruby-odbc-0.999991
|
4
4
|
|
5
5
|
This is an ODBC binding for Ruby. So far it has been tested with
|
6
6
|
|
@@ -20,9 +20,11 @@ This is an ODBC binding for Ruby. So far it has been tested with
|
|
20
20
|
|
21
21
|
- Ruby 2.0.0, SQLite/ODBC >= 0.93, unixODBC 2.2.14 on Ubuntu 12.04 x86
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
- Ruby >= 2.4
|
24
|
+
|
25
|
+
Michael Neumann <neumann @nospam@ s-direktnet.de> and
|
26
|
+
Will Merrell <wmerrell @nospam@ catalystcorp.com> reported successful
|
27
|
+
compilation with Cygwin on Win32.
|
26
28
|
|
27
29
|
Requirements:
|
28
30
|
|
@@ -108,5 +110,5 @@ TODO:
|
|
108
110
|
Author:
|
109
111
|
|
110
112
|
Christian Werner
|
111
|
-
mailto:chw@ch-werner.de
|
113
|
+
mailto:chw @nospam@ ch-werner.de
|
112
114
|
http://www.ch-werner.de/rubyodbc
|
data/doc/odbc.html
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
2
2
|
"http://www.w3.org/TR/html4/strict.dtd">
|
3
3
|
<html lang="en">
|
4
|
-
<head>
|
4
|
+
<head>
|
5
5
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
6
6
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
7
7
|
<meta name="Keywords" lang="en" content="ODBC Binding for Ruby">
|
@@ -14,7 +14,7 @@
|
|
14
14
|
}
|
15
15
|
address { text-align: right }
|
16
16
|
div.lastmodifed { text-align: right }
|
17
|
-
div.language { text-align: right }
|
17
|
+
div.language { text-align: right }
|
18
18
|
pre {
|
19
19
|
white-space: pre;
|
20
20
|
background-color: antiquewhite;
|
@@ -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,
|
30
|
+
Last update: Wed, 28 February 2018
|
31
31
|
</div>
|
32
32
|
<hr>
|
33
33
|
<div>
|
@@ -73,8 +73,10 @@
|
|
73
73
|
<dd>Gets or sets the process-wide connection pooling attribute.
|
74
74
|
<dt><a name="ODBC::to_time1">
|
75
75
|
<code>to_time(<var>timestamp</var>)</code></a>
|
76
|
-
<dt><a name="ODBC::to_time2"
|
77
|
-
|
76
|
+
<dt><a name="ODBC::to_time2">
|
77
|
+
<code>to_time(<var>date</var>,[<var>time</var>])</code></a>
|
78
|
+
<dt><a name="ODBC::to_time3">
|
79
|
+
<code>to_time(<var>time</var>,[<var>date</var>])</code></a>
|
78
80
|
<dd>Creates a <code>Time</code> object from the specified arguments,
|
79
81
|
which must be <a href="#ODBC::Date">ODBC::Date</a>,
|
80
82
|
<a href="#ODBC::Time">ODBC::Time</a>, or
|
@@ -89,7 +91,7 @@
|
|
89
91
|
[{|<var>dbc</var>| <var>block</var>}]</code></a>
|
90
92
|
<dd>If no block is specified, a connection to the given data source
|
91
93
|
is established and a <a href="#ODBC::Database">ODBC::Database</a>
|
92
|
-
object is returned, identifying that connection. Otherwise,
|
94
|
+
object is returned, identifying that connection. Otherwise,
|
93
95
|
the block is executed with the database object. When the block
|
94
96
|
is finished, the connection is automatically released.
|
95
97
|
Options are:
|
@@ -383,10 +385,11 @@
|
|
383
385
|
<a href="#dbc_get_option"><code>ODBC::Database.get_option</code></a>,
|
384
386
|
<a href="#dbc_set_option"><code>ODBC::Database.set_option</code></a>,
|
385
387
|
<a href="#stmt_get_option"><code>ODBC::Statement.get_option</code></a>,
|
386
|
-
and
|
388
|
+
and
|
387
389
|
<a href="#stmt_set_option"><code>ODBC::Statement.set_option</code></a>
|
388
390
|
yielding integers:
|
389
391
|
<dd><var>SQL_AUTOCOMMIT</var>,
|
392
|
+
<var>SQL_LOGIN_TIMEOUT</var>,
|
390
393
|
<var>SQL_CONCURRENCY</var>,
|
391
394
|
<var>SQL_QUERY_TIMEOUT</var>,
|
392
395
|
<var>SQL_MAX_ROWS</var>,
|
@@ -591,7 +594,7 @@
|
|
591
594
|
of the underlying ODBC function <code>SQLGetInfo()</code> as a
|
592
595
|
specific Ruby type the optional parameter <var>sql_type</var>
|
593
596
|
can be given as e.g.
|
594
|
-
<code>ODBC::SQL_SMALLINT</code> (yielding integer),
|
597
|
+
<code>ODBC::SQL_SMALLINT</code> (yielding integer),
|
595
598
|
<code>ODBC::SQL_INTEGER</code> (yielding integer), and
|
596
599
|
<code>ODBC::SQL_CHAR</code> (yielding string).
|
597
600
|
<dt><a name="run"><code>run(<var>sql</var>[,<var>args...</var>])</code></a>
|
@@ -668,9 +671,13 @@ aproc.statement.drop</pre>
|
|
668
671
|
<dt><a name="timeout"><code>timeout[=<var>intval</var>]</code></a>
|
669
672
|
<dd>Sets or queries the number of seconds to wait for queries to
|
670
673
|
execute on the connection before returning.
|
674
|
+
<dt><a name="login_timeout">
|
675
|
+
<code>login_timeout[=<var>intval</var>]</code></a>
|
676
|
+
<dd>Sets or queries the number of seconds to wait for a login to
|
677
|
+
complete on the connection before returning.
|
671
678
|
<dt><a name="maxlength"><code>maxlength[=<var>intval</var>]</code></a>
|
672
679
|
<dd>Sets or queries the maximum amount of data that will be returned
|
673
|
-
|
680
|
+
from a character or binary column.
|
674
681
|
<dt><a name="cursortype">
|
675
682
|
<code>cursortype[=<var>intval</var>]</code></a>
|
676
683
|
<dd>Sets or queries the cursor type used for fetches.
|
@@ -1262,7 +1269,7 @@ out_value = stmt.param_output_value(2);</pre>
|
|
1262
1269
|
<dd>Queries or sets attributes in the <var>attrs</var> Hash of the
|
1263
1270
|
ODBC driver object. The <var>key</var>s and <var>value</var>s
|
1264
1271
|
should be Strings.
|
1265
|
-
</dl>
|
1272
|
+
</dl>
|
1266
1273
|
<h3>singleton methods:</h3>
|
1267
1274
|
<dl>
|
1268
1275
|
<dt><a name="ODBC::Driver.new"><code>new</code></a>
|
@@ -1291,7 +1298,7 @@ out_value = stmt.param_output_value(2);</pre>
|
|
1291
1298
|
<a href="#ODBC::Statement">ODBC::Statement</a>.
|
1292
1299
|
<dt><code>[[<var>args*</var>]]</code>
|
1293
1300
|
<dd>Synonym for <code>call</code>.
|
1294
|
-
</dl>
|
1301
|
+
</dl>
|
1295
1302
|
</div>
|
1296
1303
|
<div>
|
1297
1304
|
<hr>
|
data/ext/extconf.rb
CHANGED
@@ -20,6 +20,7 @@ end
|
|
20
20
|
|
21
21
|
dir_config("odbc")
|
22
22
|
have_header("version.h")
|
23
|
+
have_header("ruby/version.h")
|
23
24
|
have_header("sql.h") || begin
|
24
25
|
puts "ERROR: sql.h not found"
|
25
26
|
exit 1
|
@@ -124,9 +125,9 @@ if PLATFORM =~ /mswin32/ then
|
|
124
125
|
have_func("SQLInstallerError", "odbcinst.h")
|
125
126
|
# mingw untested !!!
|
126
127
|
elsif PLATFORM =~ /(mingw|cygwin)/ then
|
127
|
-
have_library("odbc32"
|
128
|
-
have_library("odbccp32"
|
129
|
-
have_library("user32"
|
128
|
+
have_library("odbc32")
|
129
|
+
have_library("odbccp32")
|
130
|
+
have_library("user32")
|
130
131
|
elsif (testdlopen && PLATFORM !~ /(macos|darwin)/ && CONFIG["CC"] =~ /gcc/ && have_func("dlopen", "dlfcn.h") && have_library("dl", "dlopen")) then
|
131
132
|
$LDFLAGS+=" -Wl,-init -Wl,ruby_odbc_init -Wl,-fini -Wl,ruby_odbc_fini"
|
132
133
|
$CPPFLAGS+=" -DHAVE_SQLCONFIGDATASOURCE"
|
data/ext/odbc.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* ODBC-Ruby binding
|
3
|
-
* Copyright (c) 2001-
|
3
|
+
* Copyright (c) 2001-2020 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.80 2020/12/25 21:45:42 chw Exp chw $
|
12
12
|
*/
|
13
13
|
|
14
14
|
#undef ODBCVER
|
@@ -22,6 +22,9 @@
|
|
22
22
|
#ifdef HAVE_VERSION_H
|
23
23
|
#include "version.h"
|
24
24
|
#endif
|
25
|
+
#ifdef HAVE_RUBY_VERSION_H
|
26
|
+
#include "ruby/version.h"
|
27
|
+
#endif
|
25
28
|
#ifdef HAVE_SQL_H
|
26
29
|
#include <sql.h>
|
27
30
|
#else
|
@@ -65,6 +68,12 @@ typedef SQLCHAR SQLTCHAR;
|
|
65
68
|
#define TIME_USE_USEC 1
|
66
69
|
#endif
|
67
70
|
|
71
|
+
#if (RUBY_API_VERSION_CODE >= 20500)
|
72
|
+
#define FUNCALL_NOARGS(o, m) rb_funcall((o), (m), 0)
|
73
|
+
#else
|
74
|
+
#define FUNCALL_NOARGS(o, m) rb_funcall((o), (m), 0, NULL)
|
75
|
+
#endif
|
76
|
+
|
68
77
|
#ifdef HAVE_RUBY_THREAD_H
|
69
78
|
#include "ruby/thread.h"
|
70
79
|
#endif
|
@@ -1824,7 +1833,7 @@ free_stmt(STMT *q)
|
|
1824
1833
|
static void
|
1825
1834
|
start_gc()
|
1826
1835
|
{
|
1827
|
-
|
1836
|
+
FUNCALL_NOARGS(rb_mGC, IDstart);
|
1828
1837
|
}
|
1829
1838
|
|
1830
1839
|
static void
|
@@ -1899,6 +1908,7 @@ get_err_or_info(SQLHENV henv, SQLHDBC hdbc, SQLHSTMT hstmt, int isinfo)
|
|
1899
1908
|
msg[SQL_MAX_MESSAGE_LENGTH - 1] = '\0';
|
1900
1909
|
switch (err) {
|
1901
1910
|
case SQL_SUCCESS:
|
1911
|
+
case SQL_SUCCESS_WITH_INFO:
|
1902
1912
|
#ifdef UNICODE
|
1903
1913
|
v = uc_str_new2(state);
|
1904
1914
|
#else
|
@@ -2513,7 +2523,7 @@ conf_dsn(int argc, VALUE *argv, VALUE self, int op)
|
|
2513
2523
|
if (rb_obj_is_kind_of(attr, rb_cHash) == Qtrue) {
|
2514
2524
|
VALUE a, x;
|
2515
2525
|
|
2516
|
-
a =
|
2526
|
+
a = FUNCALL_NOARGS(attr, IDkeys);
|
2517
2527
|
while ((x = rb_ary_shift(a)) != Qnil) {
|
2518
2528
|
VALUE v = rb_hash_aref(attr, x);
|
2519
2529
|
|
@@ -3018,7 +3028,7 @@ dbc_drvconnect(VALUE self, VALUE drv)
|
|
3018
3028
|
VALUE d, a, x;
|
3019
3029
|
|
3020
3030
|
d = rb_str_new2("");
|
3021
|
-
a =
|
3031
|
+
a = FUNCALL_NOARGS(rb_iv_get(drv, "@attrs"), IDkeys);
|
3022
3032
|
while ((x = rb_ary_shift(a)) != Qnil) {
|
3023
3033
|
VALUE v = rb_hash_aref(rb_iv_get(drv, "@attrs"), x);
|
3024
3034
|
|
@@ -4123,10 +4133,10 @@ make_coltypes(SQLHSTMT hstmt, int ncols, char **msgp)
|
|
4123
4133
|
{
|
4124
4134
|
int i;
|
4125
4135
|
COLTYPE *ret = NULL;
|
4126
|
-
SQLLEN type, size = 0;
|
4127
4136
|
|
4128
4137
|
for (i = 0; i < ncols; i++) {
|
4129
4138
|
SQLUSMALLINT ic = i + 1;
|
4139
|
+
SQLLEN type = SQL_UNKNOWN_TYPE, size = 0;
|
4130
4140
|
|
4131
4141
|
if (!succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4132
4142
|
SQLColAttributes(hstmt, ic,
|
@@ -4152,6 +4162,7 @@ make_coltypes(SQLHSTMT hstmt, int ncols, char **msgp)
|
|
4152
4162
|
}
|
4153
4163
|
for (i = 0; i < ncols; i++) {
|
4154
4164
|
SQLUSMALLINT ic = i + 1;
|
4165
|
+
SQLLEN type = SQL_UNKNOWN_TYPE, size = 0;
|
4155
4166
|
|
4156
4167
|
callsql(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4157
4168
|
SQLColAttributes(hstmt, ic,
|
@@ -4237,6 +4248,22 @@ make_coltypes(SQLHSTMT hstmt, int ncols, char **msgp)
|
|
4237
4248
|
}
|
4238
4249
|
break;
|
4239
4250
|
#endif
|
4251
|
+
case SQL_DECIMAL:
|
4252
|
+
case SQL_NUMERIC:
|
4253
|
+
if ((size == 0) || (size > SEGSIZE)) {
|
4254
|
+
size = SQL_NO_TOTAL;
|
4255
|
+
}
|
4256
|
+
if (size != SQL_NO_TOTAL) {
|
4257
|
+
size += 2; /* sign and decimal point */
|
4258
|
+
size += 1; /* NUL terminator */
|
4259
|
+
}
|
4260
|
+
#ifdef UNICODE
|
4261
|
+
type = SQL_C_WCHAR;
|
4262
|
+
size *= sizeof (SQLWCHAR);
|
4263
|
+
#else
|
4264
|
+
type = SQL_C_CHAR;
|
4265
|
+
#endif
|
4266
|
+
break;
|
4240
4267
|
default:
|
4241
4268
|
if ((size == 0) || (size > SEGSIZE)) {
|
4242
4269
|
size = SQL_NO_TOTAL;
|
@@ -4509,7 +4536,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4509
4536
|
{
|
4510
4537
|
VALUE obj, v;
|
4511
4538
|
SQLUSMALLINT ic = i + 1;
|
4512
|
-
SQLLEN iv
|
4539
|
+
SQLLEN iv;
|
4513
4540
|
#ifdef UNICODE
|
4514
4541
|
SQLWCHAR name[SQL_MAX_MESSAGE_LENGTH];
|
4515
4542
|
#else
|
@@ -4581,6 +4608,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4581
4608
|
#endif
|
4582
4609
|
}
|
4583
4610
|
rb_iv_set(obj, "@table", v);
|
4611
|
+
iv = SQL_UNKNOWN_TYPE;
|
4584
4612
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4585
4613
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_TYPE, NULL,
|
4586
4614
|
0, NULL, &iv),
|
@@ -4591,6 +4619,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4591
4619
|
}
|
4592
4620
|
rb_iv_set(obj, "@type", v);
|
4593
4621
|
v = Qnil;
|
4622
|
+
iv = 0;
|
4594
4623
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4595
4624
|
SQLColAttributes(hstmt, ic,
|
4596
4625
|
#if (ODBCVER >= 0x0300)
|
@@ -4616,6 +4645,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4616
4645
|
}
|
4617
4646
|
rb_iv_set(obj, "@length", v);
|
4618
4647
|
v = Qnil;
|
4648
|
+
iv = SQL_NO_NULLS;
|
4619
4649
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4620
4650
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_NULLABLE, NULL,
|
4621
4651
|
0, NULL, &iv),
|
@@ -4624,6 +4654,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4624
4654
|
}
|
4625
4655
|
rb_iv_set(obj, "@nullable", v);
|
4626
4656
|
v = Qnil;
|
4657
|
+
iv = 0;
|
4627
4658
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4628
4659
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_SCALE, NULL,
|
4629
4660
|
0, NULL, &iv),
|
@@ -4632,6 +4663,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4632
4663
|
}
|
4633
4664
|
rb_iv_set(obj, "@scale", v);
|
4634
4665
|
v = Qnil;
|
4666
|
+
iv = 0;
|
4635
4667
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4636
4668
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_PRECISION, NULL,
|
4637
4669
|
0, NULL, &iv),
|
@@ -4640,23 +4672,26 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
|
|
4640
4672
|
}
|
4641
4673
|
rb_iv_set(obj, "@precision", v);
|
4642
4674
|
v = Qnil;
|
4675
|
+
iv = SQL_UNSEARCHABLE;
|
4643
4676
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4644
4677
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_SEARCHABLE, NULL,
|
4645
4678
|
0, NULL, &iv),
|
4646
4679
|
NULL, "SQLColAttributes(SQL_COLUMN_SEARCHABLE)")) {
|
4647
|
-
v = (iv ==
|
4680
|
+
v = (iv == SQL_UNSEARCHABLE) ? Qfalse : Qtrue;
|
4648
4681
|
}
|
4649
4682
|
rb_iv_set(obj, "@searchable", v);
|
4650
4683
|
v = Qnil;
|
4684
|
+
iv = SQL_FALSE;
|
4651
4685
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4652
4686
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_UNSIGNED, NULL,
|
4653
4687
|
0, NULL, &iv),
|
4654
4688
|
NULL, "SQLColAttributes(SQL_COLUMN_UNSIGNED)")) {
|
4655
|
-
v = (iv ==
|
4689
|
+
v = (iv == SQL_FALSE) ? Qfalse : Qtrue;
|
4656
4690
|
}
|
4657
4691
|
rb_iv_set(obj, "@unsigned", v);
|
4658
4692
|
v = Qnil;
|
4659
4693
|
#ifdef SQL_COLUMN_AUTO_INCREMENT
|
4694
|
+
iv = SQL_FALSE;
|
4660
4695
|
if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
|
4661
4696
|
SQLColAttributes(hstmt, ic, SQL_COLUMN_AUTO_INCREMENT, NULL,
|
4662
4697
|
0, NULL, &iv),
|
@@ -5086,7 +5121,7 @@ dbc_transaction(VALUE self)
|
|
5086
5121
|
}
|
5087
5122
|
ret = rb_ary_entry(a, 1);
|
5088
5123
|
rb_exc_raise(rb_exc_new3(rb_obj_class(ret),
|
5089
|
-
|
5124
|
+
FUNCALL_NOARGS(ret, IDto_s)));
|
5090
5125
|
return Qnil;
|
5091
5126
|
}
|
5092
5127
|
|
@@ -5203,6 +5238,7 @@ static struct {
|
|
5203
5238
|
|
5204
5239
|
/* yielding ints */
|
5205
5240
|
OPT_CONST_INT(SQL_AUTOCOMMIT, OPT_LEVEL_DBC),
|
5241
|
+
OPT_CONST_INT(SQL_LOGIN_TIMEOUT, OPT_LEVEL_DBC),
|
5206
5242
|
OPT_CONST_INT(SQL_NOSCAN, OPT_LEVEL_BOTH),
|
5207
5243
|
OPT_CONST_INT(SQL_CONCURRENCY, OPT_LEVEL_BOTH),
|
5208
5244
|
OPT_CONST_INT(SQL_QUERY_TIMEOUT, OPT_LEVEL_BOTH),
|
@@ -5220,12 +5256,16 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
|
|
5220
5256
|
{
|
5221
5257
|
DBC *p = NULL;
|
5222
5258
|
STMT *q = NULL;
|
5223
|
-
VALUE val, val2
|
5259
|
+
VALUE val, val2 = Qnil;
|
5224
5260
|
SQLINTEGER v;
|
5225
5261
|
char *msg;
|
5226
5262
|
int level = isstmt ? OPT_LEVEL_STMT : OPT_LEVEL_DBC;
|
5227
5263
|
|
5228
|
-
|
5264
|
+
if (op == -1) {
|
5265
|
+
rb_scan_args(argc, argv, "11", &val, &val2);
|
5266
|
+
} else {
|
5267
|
+
rb_scan_args(argc, argv, "01", &val);
|
5268
|
+
}
|
5229
5269
|
if (isstmt) {
|
5230
5270
|
Data_Get_Struct(self, STMT, q);
|
5231
5271
|
if (q->dbc == Qnil) {
|
@@ -5241,6 +5281,7 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
|
|
5241
5281
|
}
|
5242
5282
|
}
|
5243
5283
|
if (op == -1) {
|
5284
|
+
VALUE vstr;
|
5244
5285
|
char *string;
|
5245
5286
|
int i, op_found = 0;
|
5246
5287
|
|
@@ -5326,6 +5367,7 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
|
|
5326
5367
|
(RTEST(val) ? SQL_NOSCAN_ON : SQL_NOSCAN_OFF);
|
5327
5368
|
break;
|
5328
5369
|
|
5370
|
+
case SQL_LOGIN_TIMEOUT:
|
5329
5371
|
case SQL_CONCURRENCY:
|
5330
5372
|
case SQL_QUERY_TIMEOUT:
|
5331
5373
|
case SQL_MAX_ROWS:
|
@@ -5385,6 +5427,12 @@ dbc_timeout(int argc, VALUE *argv, VALUE self)
|
|
5385
5427
|
return do_option(argc, argv, self, 0, SQL_QUERY_TIMEOUT);
|
5386
5428
|
}
|
5387
5429
|
|
5430
|
+
static VALUE
|
5431
|
+
dbc_login_timeout(int argc, VALUE *argv, VALUE self)
|
5432
|
+
{
|
5433
|
+
return do_option(argc, argv, self, 0, SQL_LOGIN_TIMEOUT);
|
5434
|
+
}
|
5435
|
+
|
5388
5436
|
static VALUE
|
5389
5437
|
dbc_maxlength(int argc, VALUE *argv, VALUE self)
|
5390
5438
|
{
|
@@ -5638,16 +5686,16 @@ date_init(int argc, VALUE *argv, VALUE self)
|
|
5638
5686
|
if (argc > 1) {
|
5639
5687
|
rb_raise(rb_eArgError, "wrong # arguments");
|
5640
5688
|
}
|
5641
|
-
d =
|
5642
|
-
m =
|
5643
|
-
y =
|
5689
|
+
d = FUNCALL_NOARGS(y, IDday);
|
5690
|
+
m = FUNCALL_NOARGS(y, IDmonth);
|
5691
|
+
y = FUNCALL_NOARGS(y, IDyear);
|
5644
5692
|
} else if (rb_obj_is_kind_of(y, rb_cDate) == Qtrue) {
|
5645
5693
|
if (argc > 1) {
|
5646
5694
|
rb_raise(rb_eArgError, "wrong # arguments");
|
5647
5695
|
}
|
5648
|
-
d =
|
5649
|
-
m =
|
5650
|
-
y =
|
5696
|
+
d = FUNCALL_NOARGS(y, IDmday);
|
5697
|
+
m = FUNCALL_NOARGS(y, IDmonth);
|
5698
|
+
y = FUNCALL_NOARGS(y, IDyear);
|
5651
5699
|
} else if ((argc == 1) && (rb_obj_is_kind_of(y, rb_cString) == Qtrue)) {
|
5652
5700
|
if (date_load1(self, y, 0) != Qnil) {
|
5653
5701
|
return self;
|
@@ -5873,9 +5921,9 @@ time_init(int argc, VALUE *argv, VALUE self)
|
|
5873
5921
|
if (argc > 1) {
|
5874
5922
|
rb_raise(rb_eArgError, "wrong # arguments");
|
5875
5923
|
}
|
5876
|
-
s =
|
5877
|
-
m =
|
5878
|
-
h =
|
5924
|
+
s = FUNCALL_NOARGS(h, IDsec);
|
5925
|
+
m = FUNCALL_NOARGS(h, IDmin);
|
5926
|
+
h = FUNCALL_NOARGS(h, IDhour);
|
5879
5927
|
} else if ((argc == 1) && (rb_obj_is_kind_of(h, rb_cString) == Qtrue)) {
|
5880
5928
|
if (time_load1(self, h, 0) != Qnil) {
|
5881
5929
|
return self;
|
@@ -6113,13 +6161,13 @@ timestamp_init(int argc, VALUE *argv, VALUE self)
|
|
6113
6161
|
if (argc > 1) {
|
6114
6162
|
rb_raise(rb_eArgError, "wrong # arguments");
|
6115
6163
|
}
|
6116
|
-
f =
|
6117
|
-
ss =
|
6118
|
-
mm =
|
6119
|
-
hh =
|
6120
|
-
d =
|
6121
|
-
m =
|
6122
|
-
y =
|
6164
|
+
f = FUNCALL_NOARGS(y, IDusec);
|
6165
|
+
ss = FUNCALL_NOARGS(y, IDsec);
|
6166
|
+
mm = FUNCALL_NOARGS(y, IDmin);
|
6167
|
+
hh = FUNCALL_NOARGS(y, IDhour);
|
6168
|
+
d = FUNCALL_NOARGS(y, IDday);
|
6169
|
+
m = FUNCALL_NOARGS(y, IDmonth);
|
6170
|
+
y = FUNCALL_NOARGS(y, IDyear);
|
6123
6171
|
f = INT2NUM(NUM2INT(f) * 1000);
|
6124
6172
|
} else if (rb_obj_is_kind_of(y, rb_cDate) == Qtrue) {
|
6125
6173
|
if (argc > 1) {
|
@@ -6129,9 +6177,9 @@ timestamp_init(int argc, VALUE *argv, VALUE self)
|
|
6129
6177
|
ss = INT2FIX(0);
|
6130
6178
|
mm = INT2FIX(0);
|
6131
6179
|
hh = INT2FIX(0);
|
6132
|
-
d =
|
6133
|
-
m =
|
6134
|
-
y =
|
6180
|
+
d = FUNCALL_NOARGS(y, IDmday);
|
6181
|
+
m = FUNCALL_NOARGS(y, IDmonth);
|
6182
|
+
y = FUNCALL_NOARGS(y, IDyear);
|
6135
6183
|
} else if ((argc == 1) && (rb_obj_is_kind_of(y, rb_cString) == Qtrue)) {
|
6136
6184
|
if (timestamp_load1(self, y, 0) != Qnil) {
|
6137
6185
|
return self;
|
@@ -6606,13 +6654,13 @@ stmt_param_output_value(int argc, VALUE *argv, VALUE self)
|
|
6606
6654
|
|
6607
6655
|
time = (TIME_STRUCT *) q->paraminfo[vnum].outbuf;
|
6608
6656
|
frac = rb_float_new(0.0);
|
6609
|
-
now =
|
6657
|
+
now = FUNCALL_NOARGS(rb_cTime, IDnow);
|
6610
6658
|
v = rb_funcall(rb_cTime,
|
6611
6659
|
(q->dbcp->gmtime == Qtrue) ? IDutc : IDlocal,
|
6612
6660
|
7,
|
6613
|
-
|
6614
|
-
|
6615
|
-
|
6661
|
+
FUNCALL_NOARGS(now, IDyear),
|
6662
|
+
FUNCALL_NOARGS(now, IDmonth),
|
6663
|
+
FUNCALL_NOARGS(now, IDday),
|
6616
6664
|
INT2NUM(time->hour),
|
6617
6665
|
INT2NUM(time->minute),
|
6618
6666
|
INT2NUM(time->second),
|
@@ -7263,14 +7311,14 @@ do_fetch(STMT *q, int mode)
|
|
7263
7311
|
|
7264
7312
|
time = (TIME_STRUCT *) valp;
|
7265
7313
|
frac = rb_float_new(0.0);
|
7266
|
-
now =
|
7314
|
+
now = FUNCALL_NOARGS(rb_cTime, IDnow);
|
7267
7315
|
v = rb_funcall(rb_cTime,
|
7268
7316
|
(q->dbcp->gmtime == Qtrue) ?
|
7269
7317
|
IDutc : IDlocal,
|
7270
7318
|
7,
|
7271
|
-
|
7272
|
-
|
7273
|
-
|
7319
|
+
FUNCALL_NOARGS(now, IDyear),
|
7320
|
+
FUNCALL_NOARGS(now, IDmonth),
|
7321
|
+
FUNCALL_NOARGS(now, IDday),
|
7274
7322
|
INT2NUM(time->hour),
|
7275
7323
|
INT2NUM(time->minute),
|
7276
7324
|
INT2NUM(time->second),
|
@@ -8126,9 +8174,9 @@ bind_one_param(int pnum, VALUE arg, STMT *q, char **msgp, int *outpp)
|
|
8126
8174
|
ctype = SQL_C_TIME;
|
8127
8175
|
time = (TIME_STRUCT *) valp;
|
8128
8176
|
memset(time, 0, sizeof (TIME_STRUCT));
|
8129
|
-
time->hour =
|
8130
|
-
time->minute =
|
8131
|
-
time->second =
|
8177
|
+
time->hour = FUNCALL_NOARGS(arg, IDhour);
|
8178
|
+
time->minute = FUNCALL_NOARGS(arg, IDmin);
|
8179
|
+
time->second = FUNCALL_NOARGS(arg, IDsec);
|
8132
8180
|
rlen = 1;
|
8133
8181
|
vlen = sizeof (TIME_STRUCT);
|
8134
8182
|
} else if (q->paraminfo[pnum].type == SQL_DATE) {
|
@@ -8137,9 +8185,9 @@ bind_one_param(int pnum, VALUE arg, STMT *q, char **msgp, int *outpp)
|
|
8137
8185
|
ctype = SQL_C_DATE;
|
8138
8186
|
date = (DATE_STRUCT *) valp;
|
8139
8187
|
memset(date, 0, sizeof (DATE_STRUCT));
|
8140
|
-
date->year =
|
8141
|
-
date->month =
|
8142
|
-
date->day =
|
8188
|
+
date->year = FUNCALL_NOARGS(arg, IDyear);
|
8189
|
+
date->month = FUNCALL_NOARGS(arg, IDmonth);
|
8190
|
+
date->day = FUNCALL_NOARGS(arg, IDday);
|
8143
8191
|
rlen = 1;
|
8144
8192
|
vlen = sizeof (TIMESTAMP_STRUCT);
|
8145
8193
|
} else {
|
@@ -8148,16 +8196,16 @@ bind_one_param(int pnum, VALUE arg, STMT *q, char **msgp, int *outpp)
|
|
8148
8196
|
ctype = SQL_C_TIMESTAMP;
|
8149
8197
|
ts = (TIMESTAMP_STRUCT *) valp;
|
8150
8198
|
memset(ts, 0, sizeof (TIMESTAMP_STRUCT));
|
8151
|
-
ts->year =
|
8152
|
-
ts->month =
|
8153
|
-
ts->day =
|
8154
|
-
ts->hour =
|
8155
|
-
ts->minute =
|
8156
|
-
ts->second =
|
8199
|
+
ts->year = FUNCALL_NOARGS(arg, IDyear);
|
8200
|
+
ts->month = FUNCALL_NOARGS(arg, IDmonth);
|
8201
|
+
ts->day = FUNCALL_NOARGS(arg, IDday);
|
8202
|
+
ts->hour = FUNCALL_NOARGS(arg, IDhour);
|
8203
|
+
ts->minute = FUNCALL_NOARGS(arg, IDmin);
|
8204
|
+
ts->second = FUNCALL_NOARGS(arg, IDsec);
|
8157
8205
|
#ifdef TIME_USE_USEC
|
8158
|
-
ts->fraction =
|
8206
|
+
ts->fraction = FUNCALL_NOARGS(arg, IDusec) * 1000;
|
8159
8207
|
#else
|
8160
|
-
ts->fraction =
|
8208
|
+
ts->fraction = FUNCALL_NOARGS(arg, IDnsec);
|
8161
8209
|
#endif
|
8162
8210
|
rlen = 1;
|
8163
8211
|
vlen = sizeof (TIMESTAMP_STRUCT);
|
@@ -8170,9 +8218,9 @@ bind_one_param(int pnum, VALUE arg, STMT *q, char **msgp, int *outpp)
|
|
8170
8218
|
ctype = SQL_C_DATE;
|
8171
8219
|
date = (DATE_STRUCT *) valp;
|
8172
8220
|
memset(date, 0, sizeof (DATE_STRUCT));
|
8173
|
-
date->year =
|
8174
|
-
date->month =
|
8175
|
-
date->day =
|
8221
|
+
date->year = FUNCALL_NOARGS(arg, IDyear);
|
8222
|
+
date->month = FUNCALL_NOARGS(arg, IDmonth);
|
8223
|
+
date->day = FUNCALL_NOARGS(arg, IDmday);
|
8176
8224
|
rlen = 1;
|
8177
8225
|
vlen = sizeof (DATE_STRUCT);
|
8178
8226
|
break;
|
@@ -8686,7 +8734,7 @@ again:
|
|
8686
8734
|
rb_raise(rb_eTypeError, "expecting ODBC::Date");
|
8687
8735
|
}
|
8688
8736
|
} else {
|
8689
|
-
VALUE now =
|
8737
|
+
VALUE now = FUNCALL_NOARGS(rb_cTime, IDnow);
|
8690
8738
|
|
8691
8739
|
y = rb_funcall(rb_cTime, IDyear, 1, now);
|
8692
8740
|
m = rb_funcall(rb_cTime, IDmonth, 1, now);
|
@@ -9238,6 +9286,8 @@ Init_odbc()
|
|
9238
9286
|
rb_define_method(Cdbc, "maxrows=", dbc_maxrows, -1);
|
9239
9287
|
rb_define_method(Cdbc, "timeout", dbc_timeout, -1);
|
9240
9288
|
rb_define_method(Cdbc, "timeout=", dbc_timeout, -1);
|
9289
|
+
rb_define_method(Cdbc, "login_timeout", dbc_login_timeout, -1);
|
9290
|
+
rb_define_method(Cdbc, "login_timeout=", dbc_login_timeout, -1);
|
9241
9291
|
rb_define_method(Cdbc, "maxlength", dbc_maxlength, -1);
|
9242
9292
|
rb_define_method(Cdbc, "maxlength=", dbc_maxlength, -1);
|
9243
9293
|
rb_define_method(Cdbc, "rowsetsize", dbc_rowsetsize, -1);
|
@@ -9274,7 +9324,7 @@ Init_odbc()
|
|
9274
9324
|
rb_define_method(Cstmt, "fetch_scroll!", stmt_fetch_scroll_bang, -1);
|
9275
9325
|
rb_define_method(Cstmt, "fetch_hash", stmt_fetch_hash, -1);
|
9276
9326
|
rb_define_method(Cstmt, "fetch_hash!", stmt_fetch_hash_bang, -1);
|
9277
|
-
rb_define_method(Cstmt, "fetch_first_hash", stmt_fetch_first_hash,
|
9327
|
+
rb_define_method(Cstmt, "fetch_first_hash", stmt_fetch_first_hash, -1);
|
9278
9328
|
rb_define_method(Cstmt, "fetch_many", stmt_fetch_many, 1);
|
9279
9329
|
rb_define_method(Cstmt, "fetch_all", stmt_fetch_all, 0);
|
9280
9330
|
rb_define_method(Cstmt, "each", stmt_each, 0);
|
data/ext/utf8/extconf.rb
CHANGED
@@ -40,6 +40,8 @@ def have_func_nolink(func, headers = nil, &b)
|
|
40
40
|
end
|
41
41
|
|
42
42
|
dir_config("odbc")
|
43
|
+
have_header("version.h")
|
44
|
+
have_header("ruby/version.h")
|
43
45
|
have_header("sql.h") || begin
|
44
46
|
puts "ERROR: sql.h not found"
|
45
47
|
exit 1
|
@@ -113,9 +115,9 @@ if PLATFORM =~ /mswin32/ then
|
|
113
115
|
have_func("SQLInstallerError", "odbcinst.h")
|
114
116
|
have_func("SQLInstallerErrorW", "odbcinst.h")
|
115
117
|
elsif PLATFORM =~ /(mingw|cygwin)/ then
|
116
|
-
have_library("odbc32"
|
117
|
-
have_library("odbccp32"
|
118
|
-
have_library("user32"
|
118
|
+
have_library("odbc32")
|
119
|
+
have_library("odbccp32")
|
120
|
+
have_library("user32")
|
119
121
|
header = ["windows.h", "odbcinst.h"]
|
120
122
|
have_func("SQLConfigDataSourceW", header)
|
121
123
|
have_func("SQLWriteFileDSNW", header)
|
data/ruby-odbc.gemspec
CHANGED
data/test/30select.rb
CHANGED
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.999991'
|
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: 2020-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: chw @nospam@ ch-werner.de
|
@@ -66,8 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
requirements: []
|
69
|
-
|
70
|
-
rubygems_version: 2.4.5
|
69
|
+
rubygems_version: 3.1.4
|
71
70
|
signing_key:
|
72
71
|
specification_version: 4
|
73
72
|
summary: ODBC binding for Ruby
|