ruby-odbc 0.99997 → 0.99999

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: fe13750acbbaeb8c33adb7af778eaba01174229d
4
- data.tar.gz: ab8d5d5837ea84f4dca124994e4db2fdb3cc1c24
3
+ metadata.gz: ebe50088f7b79d16a5dc300d6b07890b808a57c6
4
+ data.tar.gz: 5bfa7a5595c786bcf6125b4bb43f5e0c1312b9cd
5
5
  SHA512:
6
- metadata.gz: 99ac5be18b63d180ca059fde5808d654c60f8d4e014ec4903778c56830da517d38f23b63861a91dedde012a3e71b170c6a33bcd18ae70ab1dbc811d25b58a952
7
- data.tar.gz: ce00b6f94cbc7296f20871853cff5295be26ea9a5b7b39093bf4ba7b36811d932ccc9bcd246014558288adb6aa8f781dcd7c4fed03362e68f48b64f29a1eee70
6
+ metadata.gz: f5ab42fe5a650e2d88cda3106ec3beea1e53bdc651ef6b9ca8848d61904c5b7a4b86e89373e3f392c971ad5cdc8cf3b0423d4163349fa62b337dc2a6cb502c6d
7
+ data.tar.gz: 3f0fd86fce0f7a08cb59913483a4f494a24dcbc4cfb00eceffeb822a63eb7fdee644a6e13ba5e0a83e7375ed3e9c5f88c4f2f36e778e8e52fc643a797aa4bb56
data/ChangeLog CHANGED
@@ -1,6 +1,18 @@
1
1
  ODBC binding for Ruby
2
2
  ---------------------
3
3
 
4
+ Wed Feb 28 2018 version 0.99999 released
5
+
6
+ * update to compile with newer Ruby releases, thanks
7
+ Lars Kanis for patch
8
+ * added ODBC::Database.login_timeout to get/set the
9
+ SQL_LOGIN_TIMEOUT connection attribute
10
+
11
+ Wed Feb 15 2017 version 0.99998 released
12
+
13
+ * minor update to compile with Ruby 2.4, thangs to Kevin Deisz
14
+ * preset output vars before SQLColAttributes() call
15
+
4
16
  Wed Apr 15 2015 version 0.99997 released
5
17
 
6
18
  * fixed bug (typo) when compiling with Ruby < 2.0
data/README CHANGED
@@ -1,6 +1,6 @@
1
- # $Id: README,v 1.44 2015/04/15 13:58:39 chw Exp chw $
1
+ # $Id: README,v 1.46 2018/02/28 15:08:50 chw Exp chw $
2
2
 
3
- ruby-odbc-0.99997
3
+ ruby-odbc-0.99999
4
4
 
5
5
  This is an ODBC binding for Ruby. So far it has been tested with
6
6
 
@@ -20,6 +20,8 @@ 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
+ - Ruby 2.4
24
+
23
25
  Michael Neumann <neumann@s-direktnet.de> and
24
26
  Will Merrell <wmerrell@catalystcorp.com> reported successful compilation
25
27
  with Cygwin on Win32.
@@ -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, 13 March 2013
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"><code>to_time(<var>date</var>,[<var>time</var>])</code></a>
77
- <dt><a name="ODBC::to_time3"><code>to_time(<var>time</var>,[<var>date</var>])</code></a>
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
- from a character or binary column.
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>
@@ -124,9 +124,9 @@ if PLATFORM =~ /mswin32/ then
124
124
  have_func("SQLInstallerError", "odbcinst.h")
125
125
  # mingw untested !!!
126
126
  elsif PLATFORM =~ /(mingw|cygwin)/ then
127
- have_library("odbc32", "")
128
- have_library("odbccp32", "")
129
- have_library("user32", "")
127
+ have_library("odbc32")
128
+ have_library("odbccp32")
129
+ have_library("user32")
130
130
  elsif (testdlopen && PLATFORM !~ /(macos|darwin)/ && CONFIG["CC"] =~ /gcc/ && have_func("dlopen", "dlfcn.h") && have_library("dl", "dlopen")) then
131
131
  $LDFLAGS+=" -Wl,-init -Wl,ruby_odbc_init -Wl,-fini -Wl,ruby_odbc_fini"
132
132
  $CPPFLAGS+=" -DHAVE_SQLCONFIGDATASOURCE"
data/ext/odbc.c CHANGED
@@ -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.77 2015/04/15 06:03:11 chw Exp chw $
11
+ * $Id: odbc.c,v 1.79 2018/02/28 15:15:24 chw Exp chw $
12
12
  */
13
13
 
14
14
  #undef ODBCVER
@@ -4123,10 +4123,10 @@ make_coltypes(SQLHSTMT hstmt, int ncols, char **msgp)
4123
4123
  {
4124
4124
  int i;
4125
4125
  COLTYPE *ret = NULL;
4126
- SQLLEN type, size = 0;
4127
4126
 
4128
4127
  for (i = 0; i < ncols; i++) {
4129
4128
  SQLUSMALLINT ic = i + 1;
4129
+ SQLLEN type = SQL_UNKNOWN_TYPE, size = 0;
4130
4130
 
4131
4131
  if (!succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4132
4132
  SQLColAttributes(hstmt, ic,
@@ -4152,6 +4152,7 @@ make_coltypes(SQLHSTMT hstmt, int ncols, char **msgp)
4152
4152
  }
4153
4153
  for (i = 0; i < ncols; i++) {
4154
4154
  SQLUSMALLINT ic = i + 1;
4155
+ SQLLEN type = SQL_UNKNOWN_TYPE, size = 0;
4155
4156
 
4156
4157
  callsql(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4157
4158
  SQLColAttributes(hstmt, ic,
@@ -4509,7 +4510,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4509
4510
  {
4510
4511
  VALUE obj, v;
4511
4512
  SQLUSMALLINT ic = i + 1;
4512
- SQLLEN iv = 0;
4513
+ SQLLEN iv;
4513
4514
  #ifdef UNICODE
4514
4515
  SQLWCHAR name[SQL_MAX_MESSAGE_LENGTH];
4515
4516
  #else
@@ -4581,6 +4582,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4581
4582
  #endif
4582
4583
  }
4583
4584
  rb_iv_set(obj, "@table", v);
4585
+ iv = SQL_UNKNOWN_TYPE;
4584
4586
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4585
4587
  SQLColAttributes(hstmt, ic, SQL_COLUMN_TYPE, NULL,
4586
4588
  0, NULL, &iv),
@@ -4591,6 +4593,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4591
4593
  }
4592
4594
  rb_iv_set(obj, "@type", v);
4593
4595
  v = Qnil;
4596
+ iv = 0;
4594
4597
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4595
4598
  SQLColAttributes(hstmt, ic,
4596
4599
  #if (ODBCVER >= 0x0300)
@@ -4616,6 +4619,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4616
4619
  }
4617
4620
  rb_iv_set(obj, "@length", v);
4618
4621
  v = Qnil;
4622
+ iv = SQL_NO_NULLS;
4619
4623
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4620
4624
  SQLColAttributes(hstmt, ic, SQL_COLUMN_NULLABLE, NULL,
4621
4625
  0, NULL, &iv),
@@ -4624,6 +4628,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4624
4628
  }
4625
4629
  rb_iv_set(obj, "@nullable", v);
4626
4630
  v = Qnil;
4631
+ iv = 0;
4627
4632
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4628
4633
  SQLColAttributes(hstmt, ic, SQL_COLUMN_SCALE, NULL,
4629
4634
  0, NULL, &iv),
@@ -4632,6 +4637,7 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4632
4637
  }
4633
4638
  rb_iv_set(obj, "@scale", v);
4634
4639
  v = Qnil;
4640
+ iv = 0;
4635
4641
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4636
4642
  SQLColAttributes(hstmt, ic, SQL_COLUMN_PRECISION, NULL,
4637
4643
  0, NULL, &iv),
@@ -4640,23 +4646,26 @@ make_column(SQLHSTMT hstmt, int i, int upc, int use_scn)
4640
4646
  }
4641
4647
  rb_iv_set(obj, "@precision", v);
4642
4648
  v = Qnil;
4649
+ iv = SQL_UNSEARCHABLE;
4643
4650
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4644
4651
  SQLColAttributes(hstmt, ic, SQL_COLUMN_SEARCHABLE, NULL,
4645
4652
  0, NULL, &iv),
4646
4653
  NULL, "SQLColAttributes(SQL_COLUMN_SEARCHABLE)")) {
4647
- v = (iv == SQL_NO_NULLS) ? Qfalse : Qtrue;
4654
+ v = (iv == SQL_UNSEARCHABLE) ? Qfalse : Qtrue;
4648
4655
  }
4649
4656
  rb_iv_set(obj, "@searchable", v);
4650
4657
  v = Qnil;
4658
+ iv = SQL_FALSE;
4651
4659
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4652
4660
  SQLColAttributes(hstmt, ic, SQL_COLUMN_UNSIGNED, NULL,
4653
4661
  0, NULL, &iv),
4654
4662
  NULL, "SQLColAttributes(SQL_COLUMN_UNSIGNED)")) {
4655
- v = (iv == SQL_NO_NULLS) ? Qfalse : Qtrue;
4663
+ v = (iv == SQL_FALSE) ? Qfalse : Qtrue;
4656
4664
  }
4657
4665
  rb_iv_set(obj, "@unsigned", v);
4658
4666
  v = Qnil;
4659
4667
  #ifdef SQL_COLUMN_AUTO_INCREMENT
4668
+ iv = SQL_FALSE;
4660
4669
  if (succeeded(SQL_NULL_HENV, SQL_NULL_HDBC, hstmt,
4661
4670
  SQLColAttributes(hstmt, ic, SQL_COLUMN_AUTO_INCREMENT, NULL,
4662
4671
  0, NULL, &iv),
@@ -5203,6 +5212,7 @@ static struct {
5203
5212
 
5204
5213
  /* yielding ints */
5205
5214
  OPT_CONST_INT(SQL_AUTOCOMMIT, OPT_LEVEL_DBC),
5215
+ OPT_CONST_INT(SQL_LOGIN_TIMEOUT, OPT_LEVEL_DBC),
5206
5216
  OPT_CONST_INT(SQL_NOSCAN, OPT_LEVEL_BOTH),
5207
5217
  OPT_CONST_INT(SQL_CONCURRENCY, OPT_LEVEL_BOTH),
5208
5218
  OPT_CONST_INT(SQL_QUERY_TIMEOUT, OPT_LEVEL_BOTH),
@@ -5220,12 +5230,16 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
5220
5230
  {
5221
5231
  DBC *p = NULL;
5222
5232
  STMT *q = NULL;
5223
- VALUE val, val2, vstr;
5233
+ VALUE val, val2 = Qnil;
5224
5234
  SQLINTEGER v;
5225
5235
  char *msg;
5226
5236
  int level = isstmt ? OPT_LEVEL_STMT : OPT_LEVEL_DBC;
5227
5237
 
5228
- rb_scan_args(argc, argv, (op == -1) ? "11" : "01", &val, &val2);
5238
+ if (op == -1) {
5239
+ rb_scan_args(argc, argv, "11", &val, &val2);
5240
+ } else {
5241
+ rb_scan_args(argc, argv, "01", &val);
5242
+ }
5229
5243
  if (isstmt) {
5230
5244
  Data_Get_Struct(self, STMT, q);
5231
5245
  if (q->dbc == Qnil) {
@@ -5241,6 +5255,7 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
5241
5255
  }
5242
5256
  }
5243
5257
  if (op == -1) {
5258
+ VALUE vstr;
5244
5259
  char *string;
5245
5260
  int i, op_found = 0;
5246
5261
 
@@ -5326,6 +5341,7 @@ do_option(int argc, VALUE *argv, VALUE self, int isstmt, int op)
5326
5341
  (RTEST(val) ? SQL_NOSCAN_ON : SQL_NOSCAN_OFF);
5327
5342
  break;
5328
5343
 
5344
+ case SQL_LOGIN_TIMEOUT:
5329
5345
  case SQL_CONCURRENCY:
5330
5346
  case SQL_QUERY_TIMEOUT:
5331
5347
  case SQL_MAX_ROWS:
@@ -5385,6 +5401,12 @@ dbc_timeout(int argc, VALUE *argv, VALUE self)
5385
5401
  return do_option(argc, argv, self, 0, SQL_QUERY_TIMEOUT);
5386
5402
  }
5387
5403
 
5404
+ static VALUE
5405
+ dbc_login_timeout(int argc, VALUE *argv, VALUE self)
5406
+ {
5407
+ return do_option(argc, argv, self, 0, SQL_LOGIN_TIMEOUT);
5408
+ }
5409
+
5388
5410
  static VALUE
5389
5411
  dbc_maxlength(int argc, VALUE *argv, VALUE self)
5390
5412
  {
@@ -9238,6 +9260,8 @@ Init_odbc()
9238
9260
  rb_define_method(Cdbc, "maxrows=", dbc_maxrows, -1);
9239
9261
  rb_define_method(Cdbc, "timeout", dbc_timeout, -1);
9240
9262
  rb_define_method(Cdbc, "timeout=", dbc_timeout, -1);
9263
+ rb_define_method(Cdbc, "login_timeout", dbc_login_timeout, -1);
9264
+ rb_define_method(Cdbc, "login_timeout=", dbc_login_timeout, -1);
9241
9265
  rb_define_method(Cdbc, "maxlength", dbc_maxlength, -1);
9242
9266
  rb_define_method(Cdbc, "maxlength=", dbc_maxlength, -1);
9243
9267
  rb_define_method(Cdbc, "rowsetsize", dbc_rowsetsize, -1);
@@ -113,9 +113,9 @@ if PLATFORM =~ /mswin32/ then
113
113
  have_func("SQLInstallerError", "odbcinst.h")
114
114
  have_func("SQLInstallerErrorW", "odbcinst.h")
115
115
  elsif PLATFORM =~ /(mingw|cygwin)/ then
116
- have_library("odbc32", "")
117
- have_library("odbccp32", "")
118
- have_library("user32", "")
116
+ have_library("odbc32")
117
+ have_library("odbccp32")
118
+ have_library("user32")
119
119
  header = ["windows.h", "odbcinst.h"]
120
120
  have_func("SQLConfigDataSourceW", header)
121
121
  have_func("SQLWriteFileDSNW", header)
@@ -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.99997"
4
+ s.version = "0.99999"
5
5
  s.date = Date.today.to_s
6
6
  s.author = "Christian Werner"
7
7
  s.email = "chw @nospam@ ch-werner.de"
@@ -1,4 +1,4 @@
1
- $q = $c.prepare("select id,str from test")
1
+ $q = $c.prepare("select id,str from test order by id")
2
2
 
3
3
  if $q.column(0).name.upcase != "ID" then raise "fetch failed" end
4
4
  if $q.column(1).name.upcase != "STR" then raise "fetch failed" 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.99997'
4
+ version: '0.99999'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-17 00:00:00.000000000 Z
11
+ date: 2018-02-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: chw @nospam@ ch-werner.de