tiny_tds 2.1.0.pre4 → 2.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +0 -0
- data/.gitattributes +0 -0
- data/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.travis.yml +4 -3
- data/CHANGELOG.md +19 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/ISSUE_TEMPLATE.md +32 -6
- data/MIT-LICENSE +0 -0
- data/README.md +30 -14
- data/Rakefile +0 -0
- data/VERSION +1 -1
- data/appveyor.yml +13 -6
- data/ext/tiny_tds/client.c +3 -3
- data/ext/tiny_tds/client.h +1 -0
- data/ext/tiny_tds/extconf.rb +17 -13
- data/ext/tiny_tds/extconsts.rb +2 -2
- data/ext/tiny_tds/result.c +7 -6
- data/ext/tiny_tds/result.h +0 -0
- data/ext/tiny_tds/tiny_tds_ext.c +0 -0
- data/ext/tiny_tds/tiny_tds_ext.h +0 -0
- data/lib/tiny_tds.rb +0 -0
- data/lib/tiny_tds/bin.rb +0 -0
- data/lib/tiny_tds/client.rb +0 -0
- data/lib/tiny_tds/error.rb +0 -0
- data/lib/tiny_tds/gem.rb +0 -0
- data/lib/tiny_tds/result.rb +0 -0
- data/lib/tiny_tds/version.rb +0 -0
- data/patches/freetds/1.00.27/0001-mingw_missing_inet_pton.diff +0 -0
- data/patches/freetds/1.00.27/0002-Don-t-use-MSYS2-file-libws2_32.diff +0 -0
- data/patches/libiconv/1.14/1-avoid-gets-error.patch +0 -0
- data/tasks/native_gem.rake +1 -1
- data/tasks/package.rake +0 -0
- data/tasks/ports.rake +6 -8
- data/tasks/ports/freetds.rb +0 -0
- data/tasks/ports/libiconv.rb +0 -0
- data/tasks/ports/openssl.rb +2 -18
- data/tasks/ports/recipe.rb +0 -0
- data/tasks/test.rake +0 -0
- data/test/appveyor/dbsetup.ps1 +0 -0
- data/test/appveyor/dbsetup.sql +0 -0
- data/test/benchmark/query.rb +0 -0
- data/test/benchmark/query_odbc.rb +0 -0
- data/test/benchmark/query_tinytds.rb +0 -0
- data/test/bin/setup.sh +1 -1
- data/test/client_test.rb +0 -0
- data/test/gem_test.rb +0 -0
- data/test/result_test.rb +0 -0
- data/test/schema/sqlserver_2000.sql +0 -0
- data/test/schema/sqlserver_2005.sql +0 -0
- data/test/schema/sqlserver_2008.sql +0 -0
- data/test/schema/sqlserver_2014.sql +0 -0
- data/test/schema/sqlserver_2016.sql +0 -0
- data/test/schema/sqlserver_azure.sql +0 -0
- data/test/schema/sybase_ase.sql +0 -0
- data/test/schema_test.rb +10 -10
- data/test/test_helper.rb +1 -1
- data/test/thread_test.rb +0 -0
- data/tiny_tds.gemspec +2 -2
- metadata +10 -35
- data/BACKERS.md +0 -32
- data/circle.yml +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '009faf9814321046171c7dfe6a0cbf86b137f4295ae079c1b8ae47067a940d10'
|
4
|
+
data.tar.gz: 6a20fcde7f6863f3e876f3484c4c93ded56511d93ac76de355c43f365758539d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6572f896cf1a4812b652417d1b353487d49998df7dac8518de7310123cce5c295d775e102a184355b8501a3fa3b1f9f66f892026a33fc97bfde56e3cb9912a36
|
7
|
+
data.tar.gz: d05b4c50dbbe86f920a34cc6a6fc9bd20b9b27564d75b2e05f214b1600504898e22f5935ba1183f82646095a95d8bbbcba3f1fcc2548920e35d87b11c7bf0cd4
|
data/.codeclimate.yml
CHANGED
File without changes
|
data/.gitattributes
CHANGED
File without changes
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## (unreleased)
|
2
|
+
|
3
|
+
## 2.1.3
|
4
|
+
|
5
|
+
* Removed old/unused appveyor config
|
6
|
+
* Remove old Rubies from CI & cross compile list
|
7
|
+
* Add Ruby 2.6 and 2.7 to the cross compile list
|
8
|
+
|
9
|
+
## 2.1.2
|
10
|
+
|
11
|
+
* Use Kernel.BigDecimal vs BigDecimal.new. Fixes #409.
|
12
|
+
* Change `DBSETUTF16` abscence warning message. Fixes #410.
|
13
|
+
* Add Windows binary for Ruby-2.5. Fixes #408.
|
14
|
+
|
15
|
+
## 2.1.1
|
16
|
+
|
17
|
+
* Move message_handler from a shared value to userdata.
|
18
|
+
|
19
|
+
|
1
20
|
## 2.1.0
|
2
21
|
|
3
22
|
* Support RubyInstaller2 for Windows. Fixes #365.
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/ISSUE_TEMPLATE.md
CHANGED
@@ -1,12 +1,38 @@
|
|
1
|
-
|
1
|
+
## Before submitting an issue please check these first!
|
2
2
|
|
3
|
-
*
|
3
|
+
* On Windows? If so, do you need devkit for your ruby install?
|
4
|
+
* Using Ubuntu? If so, you may have forgotten to install FreeTDS first.
|
4
5
|
* Are you using FreeTDS 0.95.80 or later? Check `$ tsql -C` to find out.
|
5
6
|
* If not, please update then uninstall the TinyTDS gem and re-install it.
|
6
|
-
*
|
7
|
+
* Have you made sure to [enable SQL Server authentication](http://bit.ly/1Kw3set)?
|
7
8
|
* Doing work with threads and the raw client? Use the ConnectionPool gem?
|
8
9
|
|
9
|
-
If none of these help. Please
|
10
|
+
If none of these help. Please fill out the following:
|
11
|
+
|
12
|
+
## Environment
|
13
|
+
|
14
|
+
**Operating System**
|
15
|
+
|
16
|
+
Please describe your operating system and version here.
|
17
|
+
If unsure please try the following from the command line:
|
18
|
+
|
19
|
+
* For Windows: `systeminfo | findstr /C:OS`
|
20
|
+
* For Linux: `lsb_release -a; uname -a`
|
21
|
+
* For Mac OSX: `sw_vers`
|
22
|
+
|
23
|
+
**TinyTDS Version and Information**
|
24
|
+
|
25
|
+
```
|
26
|
+
Please paste the full output of `ttds-tsql -C` (or `tsql -C` for older versions
|
27
|
+
of TinyTDS) here. If TinyTDS does not install, please provide the gem version.
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
**FreeTDS Version**
|
32
|
+
|
33
|
+
Please provide your system's FreeTDS version. If you are using the pre-compiled
|
34
|
+
windows gem you may omit this section.
|
35
|
+
|
36
|
+
## Description
|
10
37
|
|
11
|
-
|
12
|
-
* What version of FreeTDS you are using.
|
38
|
+
Please describe the bug or feature request here.
|
data/MIT-LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -1,17 +1,11 @@
|
|
1
1
|
# TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
|
2
2
|
|
3
3
|
* [![TravisCI](https://travis-ci.org/rails-sqlserver/tiny_tds.svg?branch=master)](https://travis-ci.org/rails-sqlserver/tiny_tds) - TravisCI
|
4
|
-
* [![CircleCI](https://circleci.com/gh/rails-sqlserver/tiny_tds/tree/master.svg?style=svg)](https://circleci.com/gh/rails-sqlserver/tiny_tds/tree/master) - CircleCI
|
5
4
|
* [![Build Status](https://ci.appveyor.com/api/projects/status/g2bhhbsdkx0mal55/branch/master?svg=true)](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) - Appveyor
|
6
|
-
* [![Code Climate](https://codeclimate.com/github/rails-sqlserver/tiny_tds/badges/gpa.svg)](https://codeclimate.com/github/rails-sqlserver/tiny_tds) - Code Climate
|
7
5
|
* [![Gem Version](https://img.shields.io/gem/v/tiny_tds.svg)](https://rubygems.org/gems/tiny_tds) - Gem Version
|
8
6
|
* [![Dependency Status](https://dependencyci.com/github/rails-sqlserver/tiny_tds/badge)](https://dependencyci.com/github/rails-sqlserver/tiny_tds) - Dependency Status
|
9
7
|
* [![Gitter chat](https://img.shields.io/badge/%E2%8A%AA%20GITTER%20-JOIN%20CHAT%20%E2%86%92-brightgreen.svg?style=flat)](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter) - Community
|
10
8
|
|
11
|
-
## Supporting TinyTDS/Adapter
|
12
|
-
|
13
|
-
Both TinyTDS and the Rails SQL Server Adapter are MIT-licensed open source projects. Its ongoing development is made possible thanks to the support by these awesome [backers](https://github.com/rails-sqlserver/tiny_tds/blob/master/BACKERS.md). If you'd like to join them, check out our [Patreon Campaign](https://www.patreon.com/metaskills).
|
14
|
-
|
15
9
|
|
16
10
|
## About TinyTDS
|
17
11
|
|
@@ -40,19 +34,19 @@ If you're using RubyInstaller the binary gem will require that devkit is install
|
|
40
34
|
On all other platforms, we will find these dependencies. It is recommended that you install the latest FreeTDS via your method of choice. For example, here is how to install FreeTDS on Ubuntu. You might also need the `build-essential` and possibly the `libc6-dev` packages.
|
41
35
|
|
42
36
|
```shell
|
43
|
-
$ apt-get wget
|
37
|
+
$ apt-get install wget
|
44
38
|
$ apt-get install build-essential
|
45
39
|
$ apt-get install libc6-dev
|
46
40
|
|
47
|
-
$ wget http://www.freetds.org/files/stable/freetds-1.
|
48
|
-
$ tar -xzf freetds-1.
|
49
|
-
$ cd freetds-1.
|
41
|
+
$ wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz
|
42
|
+
$ tar -xzf freetds-1.1.24.tar.gz
|
43
|
+
$ cd freetds-1.1.24
|
50
44
|
$ ./configure --prefix=/usr/local --with-tdsver=7.3
|
51
45
|
$ make
|
52
46
|
$ make install
|
53
47
|
```
|
54
48
|
|
55
|
-
|
49
|
+
Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
|
56
50
|
|
57
51
|
```
|
58
52
|
--with-freetds-dir=DIR
|
@@ -75,11 +69,11 @@ TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default an
|
|
75
69
|
|
76
70
|
**NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
|
77
71
|
|
78
|
-
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
|
72
|
+
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
|
79
73
|
|
80
74
|
* **OK, I am installing FreeTDS, how do I configure it?** Contrary to what most people think, you do not need to specially configure FreeTDS in any way for client libraries like TinyTDS to use it. About the only requirement is that you compile it with libiconv for proper encoding support. FreeTDS must also be compiled with OpenSSL (or the like) to use it with Azure. See the "Using TinyTDS with Azure" section below for more info.
|
81
75
|
|
82
|
-
* **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have
|
76
|
+
* **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have to. This is only a default for clients/configs that do not specify what TDS version they want to use. We are currently having issues with passing down a TDS version with the login bit. Till we get that fixed, if you are not using a freetds.conf or a TDSVER environment variable, then make sure to use 7.1.
|
83
77
|
|
84
78
|
* **But I want to use TDS version 7.2 for SQL Server 2005 and up!** TinyTDS uses TDS version 7.1 (previously named 8.0) and fully supports all the data types supported by FreeTDS, this includes `varchar(max)` and `nvarchar(max)`. Technically compiling and using TDS version 7.2 with FreeTDS is not supported. But this does not mean those data types will not work. I know, it's confusing If you want to learn more, read this thread. http://lists.ibiblio.org/pipermail/freetds/2011q3/027306.html
|
85
79
|
|
@@ -122,6 +116,17 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
|
|
122
116
|
* :azure - Pass true to signal that you are connecting to azure.
|
123
117
|
* :contained - Pass true to signal that you are connecting with a contained database user.
|
124
118
|
* :use_utf16 - Instead of using UCS-2 for database wide character encoding use UTF-16. Newer Windows versions use this encoding instead of UCS-2. Default true.
|
119
|
+
* :message_handler - Pass in a `call`-able object such as a `Proc` or a method to receive info messages from the database. It should have a single parameter, which will be a `TinyTds::Error` object representing the message. For example:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
opts = ... # host, username, password, etc
|
123
|
+
opts[:message_handler] = Proc.new { |m| puts m.message }
|
124
|
+
client = TinyTds::Client.new opts
|
125
|
+
# => Changed database context to 'master'.
|
126
|
+
# => Changed language setting to us_english.
|
127
|
+
client.execute("print 'hello world!'").do
|
128
|
+
# => hello world!
|
129
|
+
```
|
125
130
|
|
126
131
|
Use the `#active?` method to determine if a connection is good. The implementation of this method may change but it should always guarantee that a connection is good. Current it checks for either a closed or dead connection.
|
127
132
|
|
@@ -396,7 +401,7 @@ The default is true and since FreeTDS v1.0 would do this as well.
|
|
396
401
|
|
397
402
|
## Compiling Gems for Windows
|
398
403
|
|
399
|
-
For the convenience of Windows users, TinyTDS ships pre-compiled gems for
|
404
|
+
For the convenience of Windows users, TinyTDS ships pre-compiled gems for supported versions of Ruby on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides several [Docker images](https://registry.hub.docker.com/u/larskanis/) with rvm, cross-compilers and a number of different target versions of Ruby.
|
400
405
|
|
401
406
|
Run the following rake task to compile the gems for Windows. This will check the availability of [Docker](https://www.docker.com/) (and boot2docker on Windows or OS-X) and will give some advice for download and installation. When docker is running, it will download the docker image (once-only) and start the build:
|
402
407
|
|
@@ -457,6 +462,17 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
|
|
457
462
|
$ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
|
458
463
|
```
|
459
464
|
|
465
|
+
## Docker Builds
|
466
|
+
|
467
|
+
If you use a [multi stage](https://docs.docker.com/develop/develop-images/multistage-build/) Docker build to assemble your gems in one phase and then copy your app and gems
|
468
|
+
into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
|
469
|
+
|
470
|
+
After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
|
471
|
+
it [already knows to look here](https://github.com/rails-sqlserver/tiny_tds/blob/master/ext/tiny_tds/extconf.rb#L31) but if you copy your app to a new container that link will be broken.
|
472
|
+
|
473
|
+
Set the LD_LIBRARY_PATH environment variable `export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}` and run `ldconfig`. If you run `ldd tiny_tds.so` you should not see any broken links. Make
|
474
|
+
sure you also copied in the library dependencies from your build container with a command like `COPY --from=builder /usr/local/lib /usr/local/lib`.
|
475
|
+
|
460
476
|
## Help & Support
|
461
477
|
|
462
478
|
* Github Source: http://github.com/rails-sqlserver/tiny_tds
|
data/Rakefile
CHANGED
File without changes
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.3
|
data/appveyor.yml
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
init:
|
2
2
|
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
3
|
-
- SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
|
4
3
|
- SET RAKEOPT=-rdevkit
|
5
4
|
- SET TESTOPTS='-v'
|
6
|
-
- SET MAKE=make V=1
|
5
|
+
- SET MAKE=make V=1 -j2
|
7
6
|
clone_depth: 5
|
8
7
|
skip_tags: true
|
9
8
|
skip_branch_with_pr: true
|
10
9
|
matrix:
|
11
|
-
fast_finish:
|
10
|
+
fast_finish: false
|
12
11
|
install:
|
13
12
|
# Output debugging info
|
14
13
|
- ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
|
14
|
+
- ps: |
|
15
|
+
if ($env:ruby_version -like "*head*") {
|
16
|
+
$(new-object net.webclient).DownloadFile("https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-$env:ruby_version.exe", "$pwd/ruby-setup.exe")
|
17
|
+
cmd /c ruby-setup.exe /verysilent /dir=C:/Ruby$env:ruby_version
|
18
|
+
}
|
15
19
|
- perl --version
|
16
20
|
- ruby --version
|
17
21
|
- gem --version
|
18
22
|
|
23
|
+
# prevent freetds to link to wrong ws2_32 lib on i686-w64-mingw32
|
24
|
+
- c:/msys64/usr/bin/rm /usr/lib/w32api/libws2_32.a
|
19
25
|
# Set up project prerequisits
|
20
26
|
- bundle install
|
21
27
|
- bundle exec rake ports
|
@@ -43,9 +49,10 @@ environment:
|
|
43
49
|
TINYTDS_UNIT_AZURE_PASS:
|
44
50
|
secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk=
|
45
51
|
matrix:
|
46
|
-
- ruby_version: "24-x64"
|
47
52
|
- ruby_version: "24"
|
48
|
-
- ruby_version: "
|
49
|
-
- ruby_version: "
|
53
|
+
- ruby_version: "25-x64"
|
54
|
+
- ruby_version: "26"
|
55
|
+
- ruby_version: "head-x64"
|
50
56
|
on_failure:
|
57
|
+
- find -name config.log | xargs cat
|
51
58
|
- find -name compile.log | xargs cat
|
data/ext/tiny_tds/client.c
CHANGED
@@ -7,7 +7,6 @@ static ID sym_username, sym_password, sym_dataserver, sym_database, sym_appname,
|
|
7
7
|
static ID intern_source_eql, intern_severity_eql, intern_db_error_number_eql, intern_os_error_number_eql;
|
8
8
|
static ID intern_new, intern_dup, intern_transpose_iconv_encoding, intern_local_offset, intern_gsub, intern_call;
|
9
9
|
VALUE opt_escape_regex, opt_escape_dblquote;
|
10
|
-
VALUE message_handler;
|
11
10
|
|
12
11
|
|
13
12
|
// Lib Macros
|
@@ -44,6 +43,7 @@ VALUE rb_tinytds_raise_error(DBPROCESS *dbproc, int is_message, int cancel, cons
|
|
44
43
|
rb_funcall(e, intern_os_error_number_eql, 1, INT2FIX(oserr));
|
45
44
|
|
46
45
|
if (severity <= 10 && is_message) {
|
46
|
+
VALUE message_handler = userdata && userdata->message_handler ? userdata->message_handler : Qnil;
|
47
47
|
if (message_handler && message_handler != Qnil && rb_respond_to(message_handler, intern_call) != 0) {
|
48
48
|
rb_funcall(message_handler, intern_call, 1, e);
|
49
49
|
}
|
@@ -322,7 +322,7 @@ static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
|
|
322
322
|
azure = rb_hash_aref(opts, sym_azure);
|
323
323
|
contained = rb_hash_aref(opts, sym_contained);
|
324
324
|
use_utf16 = rb_hash_aref(opts, sym_use_utf16);
|
325
|
-
message_handler = rb_hash_aref(opts, sym_message_handler);
|
325
|
+
cwrap->userdata->message_handler = rb_hash_aref(opts, sym_message_handler);
|
326
326
|
/* Dealing with options. */
|
327
327
|
if (dbinit() == FAIL) {
|
328
328
|
rb_raise(cTinyTdsError, "failed dbinit() function");
|
@@ -362,7 +362,7 @@ static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
|
|
362
362
|
if (use_utf16 == Qfalse) { DBSETLUTF16(cwrap->login, 0); }
|
363
363
|
#else
|
364
364
|
if (use_utf16 == Qtrue || use_utf16 == Qfalse) {
|
365
|
-
|
365
|
+
rb_warning("TinyTds: Please consider upgrading to FreeTDS 0.99 or higher for better unicode support.\n");
|
366
366
|
}
|
367
367
|
#endif
|
368
368
|
|
data/ext/tiny_tds/client.h
CHANGED
data/ext/tiny_tds/extconf.rb
CHANGED
@@ -22,35 +22,39 @@ do_help if arg_config('--help')
|
|
22
22
|
|
23
23
|
# Make sure to check the ports path for the configured host
|
24
24
|
host = RbConfig::CONFIG['host']
|
25
|
-
project_dir = File.
|
25
|
+
project_dir = File.expand_path("../../..", __FILE__)
|
26
26
|
freetds_ports_dir = File.join(project_dir, 'ports', host, 'freetds', FREETDS_VERSION)
|
27
27
|
freetds_ports_dir = File.expand_path(freetds_ports_dir)
|
28
28
|
|
29
29
|
# Add all the special path searching from the original tiny_tds build
|
30
|
-
# order is important here! First in,
|
30
|
+
# order is important here! First in, first searched.
|
31
31
|
DIRS = %w(
|
32
|
-
/usr/local
|
33
32
|
/opt/local
|
33
|
+
/usr/local
|
34
34
|
)
|
35
35
|
|
36
|
+
# Add the ports directory if it exists for local developer builds
|
37
|
+
DIRS.unshift(freetds_ports_dir) if File.directory?(freetds_ports_dir)
|
38
|
+
|
36
39
|
# Grab freetds environment variable for use by people on services like
|
37
40
|
# Heroku who they can't easily use bundler config to set directories
|
38
|
-
DIRS.
|
39
|
-
|
40
|
-
# Add the ports directory if it exists for local developer builds
|
41
|
-
DIRS.push(freetds_ports_dir) if File.directory?(freetds_ports_dir)
|
41
|
+
DIRS.unshift(ENV['FREETDS_DIR']) if ENV.has_key?('FREETDS_DIR')
|
42
42
|
|
43
43
|
# Add the search paths for freetds configured above
|
44
|
-
DIRS.
|
45
|
-
idir = "#{path}/include"
|
44
|
+
ldirs = DIRS.flat_map do |path|
|
46
45
|
ldir = "#{path}/lib"
|
46
|
+
[ldir, "#{ldir}/freetds"]
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
)
|
49
|
+
idirs = DIRS.flat_map do |path|
|
50
|
+
idir = "#{path}/include"
|
51
|
+
[idir, "#{idir}/freetds"]
|
52
52
|
end
|
53
53
|
|
54
|
+
puts "looking for freetds headers in the following directories:\n#{idirs.map{|a| " - #{a}\n"}.join}"
|
55
|
+
puts "looking for freetds library in the following directories:\n#{ldirs.map{|a| " - #{a}\n"}.join}"
|
56
|
+
dir_config('freetds', idirs, ldirs)
|
57
|
+
|
54
58
|
have_dependencies = [
|
55
59
|
find_header('sybfront.h'),
|
56
60
|
find_header('sybdb.h'),
|
data/ext/tiny_tds/extconsts.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
ICONV_VERSION = ENV['TINYTDS_ICONV_VERSION'] || "1.15"
|
3
3
|
ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
|
4
4
|
|
5
|
-
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.
|
5
|
+
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.1.1d'
|
6
6
|
OPENSSL_SOURCE_URI = "https://www.openssl.org/source/openssl-#{OPENSSL_VERSION}.tar.gz"
|
7
7
|
|
8
|
-
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.
|
8
|
+
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.1.24"
|
9
9
|
FREETDS_VERSION_INFO = Hash.new { |h,k|
|
10
10
|
h[k] = {files: "http://www.freetds.org/files/stable/freetds-#{k}.tar.bz2"}
|
11
11
|
}
|
data/ext/tiny_tds/result.c
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
|
7
7
|
VALUE cTinyTdsResult;
|
8
8
|
extern VALUE mTinyTds, cTinyTdsClient, cTinyTdsError;
|
9
|
-
VALUE
|
9
|
+
VALUE cKernel, cDate;
|
10
10
|
VALUE opt_decimal_zero, opt_float_zero, opt_one, opt_zero, opt_four, opt_19hdr, opt_onek, opt_tenk, opt_onemil, opt_onebil;
|
11
11
|
static ID intern_new, intern_utc, intern_local, intern_localtime, intern_merge,
|
12
|
-
intern_civil, intern_new_offset, intern_plus, intern_divide;
|
12
|
+
intern_civil, intern_new_offset, intern_plus, intern_divide, intern_bigd;
|
13
13
|
static ID sym_symbolize_keys, sym_as, sym_array, sym_cache_rows, sym_first, sym_timezone, sym_local, sym_utc, sym_empty_sets;
|
14
14
|
|
15
15
|
|
@@ -228,7 +228,7 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
|
|
228
228
|
int data_slength = (int)data_info->precision + (int)data_info->scale + 1;
|
229
229
|
char converted_decimal[data_slength];
|
230
230
|
dbconvert(rwrap->client, coltype, data, data_len, SYBVARCHAR, (BYTE *)converted_decimal, -1);
|
231
|
-
val = rb_funcall(
|
231
|
+
val = rb_funcall(cKernel, intern_bigd, 1, rb_str_new2((char *)converted_decimal));
|
232
232
|
break;
|
233
233
|
}
|
234
234
|
case SYBFLT8: {
|
@@ -246,7 +246,7 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
|
|
246
246
|
char converted_money[25];
|
247
247
|
long long money_value = ((long long)money->mnyhigh << 32) | money->mnylow;
|
248
248
|
sprintf(converted_money, "%" LONG_LONG_FORMAT, money_value);
|
249
|
-
val = rb_funcall(
|
249
|
+
val = rb_funcall(cKernel, intern_bigd, 2, rb_str_new2(converted_money), opt_four);
|
250
250
|
val = rb_funcall(val, intern_divide, 1, opt_tenk);
|
251
251
|
break;
|
252
252
|
}
|
@@ -254,7 +254,7 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
|
|
254
254
|
DBMONEY4 *money = (DBMONEY4 *)data;
|
255
255
|
char converted_money[20];
|
256
256
|
sprintf(converted_money, "%f", money->mny4 / 10000.0);
|
257
|
-
val = rb_funcall(
|
257
|
+
val = rb_funcall(cKernel, intern_bigd, 1, rb_str_new2(converted_money));
|
258
258
|
break;
|
259
259
|
}
|
260
260
|
case SYBBINARY:
|
@@ -566,7 +566,7 @@ static VALUE rb_tinytds_result_insert(VALUE self) {
|
|
566
566
|
|
567
567
|
void init_tinytds_result() {
|
568
568
|
/* Data Classes */
|
569
|
-
|
569
|
+
cKernel = rb_const_get(rb_cObject, rb_intern("Kernel"));
|
570
570
|
cDate = rb_const_get(rb_cObject, rb_intern("Date"));
|
571
571
|
/* Define TinyTds::Result */
|
572
572
|
cTinyTdsResult = rb_define_class_under(mTinyTds, "Result", rb_cObject);
|
@@ -588,6 +588,7 @@ void init_tinytds_result() {
|
|
588
588
|
intern_new_offset = rb_intern("new_offset");
|
589
589
|
intern_plus = rb_intern("+");
|
590
590
|
intern_divide = rb_intern("/");
|
591
|
+
intern_bigd = rb_intern("BigDecimal");
|
591
592
|
/* Symbol Helpers */
|
592
593
|
sym_symbolize_keys = ID2SYM(rb_intern("symbolize_keys"));
|
593
594
|
sym_as = ID2SYM(rb_intern("as"));
|
data/ext/tiny_tds/result.h
CHANGED
File without changes
|
data/ext/tiny_tds/tiny_tds_ext.c
CHANGED
File without changes
|
data/ext/tiny_tds/tiny_tds_ext.h
CHANGED
File without changes
|
data/lib/tiny_tds.rb
CHANGED
File without changes
|
data/lib/tiny_tds/bin.rb
CHANGED
File without changes
|
data/lib/tiny_tds/client.rb
CHANGED
File without changes
|
data/lib/tiny_tds/error.rb
CHANGED
File without changes
|
data/lib/tiny_tds/gem.rb
CHANGED
File without changes
|
data/lib/tiny_tds/result.rb
CHANGED
File without changes
|
data/lib/tiny_tds/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/tasks/native_gem.rake
CHANGED
@@ -8,7 +8,7 @@ task 'gem:windows' => ['ports:cross'] do
|
|
8
8
|
build = ['bundle']
|
9
9
|
|
10
10
|
# and finally build the native gem
|
11
|
-
build << 'rake cross native gem RUBY_CC_VERSION=2.
|
11
|
+
build << 'rake cross native gem RUBY_CC_VERSION=2.7.0:2.6.0:2.5.0:2.4.0 CFLAGS="-Wall" MAKE="make -j`nproc`"'
|
12
12
|
|
13
13
|
RakeCompilerDock.sh build.join(' && ')
|
14
14
|
end
|
data/tasks/package.rake
CHANGED
File without changes
|
data/tasks/ports.rake
CHANGED
@@ -6,14 +6,14 @@ require_relative 'ports/openssl'
|
|
6
6
|
require_relative 'ports/freetds'
|
7
7
|
require_relative '../ext/tiny_tds/extconsts'
|
8
8
|
|
9
|
-
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE if defined? OpenSSL
|
10
|
-
|
11
9
|
namespace :ports do
|
12
10
|
openssl = Ports::Openssl.new(OPENSSL_VERSION)
|
13
11
|
libiconv = Ports::Libiconv.new(ICONV_VERSION)
|
14
12
|
freetds = Ports::Freetds.new(FREETDS_VERSION)
|
15
13
|
|
16
14
|
directory "ports"
|
15
|
+
CLEAN.include "ports/*mingw32*"
|
16
|
+
CLEAN.include "ports/*.installed"
|
17
17
|
|
18
18
|
task :openssl, [:host] do |task, args|
|
19
19
|
args.with_defaults(host: RbConfig::CONFIG['host'])
|
@@ -71,15 +71,13 @@ namespace :ports do
|
|
71
71
|
task 'cross' do
|
72
72
|
require 'rake_compiler_dock'
|
73
73
|
|
74
|
-
# make sure to install our bundle
|
75
|
-
build = ['bundle']
|
76
|
-
|
77
74
|
# build the ports for all our cross compile hosts
|
78
75
|
GEM_PLATFORM_HOSTS.each do |gem_platform, host|
|
79
|
-
|
76
|
+
# make sure to install our bundle
|
77
|
+
build = ['bundle']
|
78
|
+
build << "rake ports:compile[#{host}] MAKE='make -j`nproc`'"
|
79
|
+
RakeCompilerDock.sh build.join(' && '), platform: gem_platform
|
80
80
|
end
|
81
|
-
|
82
|
-
RakeCompilerDock.sh build.join(' && ')
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
data/tasks/ports/freetds.rb
CHANGED
File without changes
|
data/tasks/ports/libiconv.rb
CHANGED
File without changes
|
data/tasks/ports/openssl.rb
CHANGED
@@ -27,27 +27,11 @@ module Ports
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def execute(action, command, options={})
|
31
|
-
# OpenSSL Requires Perl >= 5.10, while the Ruby devkit uses MSYS1 with Perl 5.8.8.
|
32
|
-
# To overcome this, prepend Git's usr/bin to the PATH.
|
33
|
-
# It has MSYS2 with a recent version of perl.
|
34
|
-
prev_path = ENV['PATH']
|
35
|
-
if host =~ /mingw/ && IO.popen(["perl", "-e", "print($])"], &:read).to_f < 5.010
|
36
|
-
git_perl = 'C:/Program Files/Git/usr/bin'
|
37
|
-
if File.directory?(git_perl)
|
38
|
-
ENV['PATH'] = "#{git_perl}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
|
39
|
-
ENV['PERL'] = 'perl'
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
super
|
44
|
-
ENV['PATH'] = prev_path
|
45
|
-
end
|
46
|
-
|
47
30
|
def configure_defaults
|
48
31
|
opts = [
|
49
32
|
'shared',
|
50
|
-
target_arch
|
33
|
+
target_arch,
|
34
|
+
"--openssldir=#{path}",
|
51
35
|
]
|
52
36
|
|
53
37
|
if cross_build?
|
data/tasks/ports/recipe.rb
CHANGED
File without changes
|
data/tasks/test.rake
CHANGED
File without changes
|
data/test/appveyor/dbsetup.ps1
CHANGED
File without changes
|
data/test/appveyor/dbsetup.sql
CHANGED
File without changes
|
data/test/benchmark/query.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/test/bin/setup.sh
CHANGED
data/test/client_test.rb
CHANGED
File without changes
|
data/test/gem_test.rb
CHANGED
File without changes
|
data/test/result_test.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/test/schema/sybase_ase.sql
CHANGED
File without changes
|
data/test/schema_test.rb
CHANGED
@@ -76,10 +76,10 @@ class SchemaTest < TinyTds::TestCase
|
|
76
76
|
|
77
77
|
it 'casts decimal' do
|
78
78
|
assert_instance_of BigDecimal, find_value(91, :decimal_9_2)
|
79
|
-
assert_equal BigDecimal
|
80
|
-
assert_equal BigDecimal
|
81
|
-
assert_equal BigDecimal
|
82
|
-
assert_equal BigDecimal
|
79
|
+
assert_equal BigDecimal('12345.01'), find_value(91, :decimal_9_2)
|
80
|
+
assert_equal BigDecimal('1234567.89'), find_value(92, :decimal_9_2)
|
81
|
+
assert_equal BigDecimal('0.0'), find_value(93, :decimal_16_4)
|
82
|
+
assert_equal BigDecimal('123456789012.3456'), find_value(94, :decimal_16_4)
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'casts float' do
|
@@ -102,9 +102,9 @@ class SchemaTest < TinyTds::TestCase
|
|
102
102
|
|
103
103
|
it 'casts money' do
|
104
104
|
assert_instance_of BigDecimal, find_value(161, :money)
|
105
|
-
assert_equal BigDecimal
|
106
|
-
assert_equal BigDecimal
|
107
|
-
assert_equal BigDecimal
|
105
|
+
assert_equal BigDecimal('4.20'), find_value(161, :money)
|
106
|
+
assert_equal BigDecimal('922337203685477.5806'), find_value(163 ,:money)
|
107
|
+
assert_equal BigDecimal('-922337203685477.5807'), find_value(162 ,:money)
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'casts nchar' do
|
@@ -176,9 +176,9 @@ class SchemaTest < TinyTds::TestCase
|
|
176
176
|
|
177
177
|
it 'casts smallmoney' do
|
178
178
|
assert_instance_of BigDecimal, find_value(251, :smallmoney)
|
179
|
-
assert_equal BigDecimal
|
180
|
-
assert_equal BigDecimal
|
181
|
-
assert_equal BigDecimal
|
179
|
+
assert_equal BigDecimal("4.20"), find_value(251, :smallmoney)
|
180
|
+
assert_equal BigDecimal("-214748.3647"), find_value(252, :smallmoney)
|
181
|
+
assert_equal BigDecimal("214748.3646"), find_value(253, :smallmoney)
|
182
182
|
end
|
183
183
|
|
184
184
|
it 'casts text' do
|
data/test/test_helper.rb
CHANGED
data/test/thread_test.rb
CHANGED
File without changes
|
data/tiny_tds.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.required_ruby_version = '>= 2.0.0'
|
22
22
|
s.metadata['msys2_mingw_dependencies'] = 'freetds'
|
23
23
|
s.add_development_dependency 'mini_portile2', '~> 2.0'
|
24
|
-
s.add_development_dependency 'rake', '~>
|
24
|
+
s.add_development_dependency 'rake', '~> 13.0'
|
25
25
|
s.add_development_dependency 'rake-compiler', '~> 1.0'
|
26
|
-
s.add_development_dependency 'rake-compiler-dock', '~>
|
26
|
+
s.add_development_dependency 'rake-compiler-dock', '~> 1.0'
|
27
27
|
s.add_development_dependency 'minitest', '~> 5.6'
|
28
28
|
s.add_development_dependency 'connection_pool', '~> 2.2'
|
29
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_tds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Collins
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-09-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mini_portile2
|
@@ -32,14 +32,14 @@ dependencies:
|
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
35
|
+
version: '13.0'
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
42
|
+
version: '13.0'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rake-compiler
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,14 +60,14 @@ dependencies:
|
|
60
60
|
requirements:
|
61
61
|
- - "~>"
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '1.0'
|
64
64
|
type: :development
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: '1.0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: minitest
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -113,7 +113,6 @@ files:
|
|
113
113
|
- ".gitignore"
|
114
114
|
- ".rubocop.yml"
|
115
115
|
- ".travis.yml"
|
116
|
-
- BACKERS.md
|
117
116
|
- CHANGELOG.md
|
118
117
|
- CODE_OF_CONDUCT.md
|
119
118
|
- Gemfile
|
@@ -125,7 +124,6 @@ files:
|
|
125
124
|
- appveyor.yml
|
126
125
|
- bin/defncopy-ttds
|
127
126
|
- bin/tsql-ttds
|
128
|
-
- circle.yml
|
129
127
|
- exe/.keep
|
130
128
|
- ext/tiny_tds/client.c
|
131
129
|
- ext/tiny_tds/client.h
|
@@ -193,35 +191,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
193
191
|
version: 2.0.0
|
194
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
193
|
requirements:
|
196
|
-
- - "
|
194
|
+
- - ">="
|
197
195
|
- !ruby/object:Gem::Version
|
198
|
-
version:
|
196
|
+
version: '0'
|
199
197
|
requirements: []
|
200
|
-
|
201
|
-
rubygems_version: 2.6.8
|
198
|
+
rubygems_version: 3.0.3
|
202
199
|
signing_key:
|
203
200
|
specification_version: 4
|
204
201
|
summary: TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.
|
205
|
-
test_files:
|
206
|
-
- test/appveyor/dbsetup.ps1
|
207
|
-
- test/appveyor/dbsetup.sql
|
208
|
-
- test/benchmark/query.rb
|
209
|
-
- test/benchmark/query_odbc.rb
|
210
|
-
- test/benchmark/query_tinytds.rb
|
211
|
-
- test/bin/install-freetds.sh
|
212
|
-
- test/bin/install-openssl.sh
|
213
|
-
- test/bin/setup.sh
|
214
|
-
- test/client_test.rb
|
215
|
-
- test/gem_test.rb
|
216
|
-
- test/result_test.rb
|
217
|
-
- test/schema/1px.gif
|
218
|
-
- test/schema/sqlserver_2000.sql
|
219
|
-
- test/schema/sqlserver_2005.sql
|
220
|
-
- test/schema/sqlserver_2008.sql
|
221
|
-
- test/schema/sqlserver_2014.sql
|
222
|
-
- test/schema/sqlserver_2016.sql
|
223
|
-
- test/schema/sqlserver_azure.sql
|
224
|
-
- test/schema/sybase_ase.sql
|
225
|
-
- test/schema_test.rb
|
226
|
-
- test/test_helper.rb
|
227
|
-
- test/thread_test.rb
|
202
|
+
test_files: []
|
data/BACKERS.md
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# Backers
|
2
|
-
|
3
|
-
You can join in supporting TinyTDS and the Rails SQL Server Adapter development by [pledging on Patreon](https://www.patreon.com/metaskills)! Backers in the same pledge level appear in the order of pledge date.
|
4
|
-
|
5
|
-
### $2000
|
6
|
-
|
7
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611218)
|
8
|
-
|
9
|
-
|
10
|
-
### $500
|
11
|
-
|
12
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611209)
|
13
|
-
|
14
|
-
|
15
|
-
### $250
|
16
|
-
|
17
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611199)
|
18
|
-
|
19
|
-
|
20
|
-
### $100
|
21
|
-
|
22
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611196)
|
23
|
-
|
24
|
-
|
25
|
-
### $50+
|
26
|
-
|
27
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611186)
|
28
|
-
|
29
|
-
|
30
|
-
### $10+
|
31
|
-
|
32
|
-
[It could be you!](https://www.patreon.com/bePatron?c=765225&rid=1611149)
|
data/circle.yml
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
general:
|
2
|
-
branches:
|
3
|
-
ignore:
|
4
|
-
- /dev.*/
|
5
|
-
|
6
|
-
machine:
|
7
|
-
environment:
|
8
|
-
PATH: /opt/local/bin:${PATH}
|
9
|
-
TESTOPTS: -v
|
10
|
-
TINYTDS_UNIT_HOST: localhost
|
11
|
-
services:
|
12
|
-
- docker
|
13
|
-
|
14
|
-
dependencies:
|
15
|
-
override:
|
16
|
-
- sudo ./test/bin/install-openssl.sh
|
17
|
-
- sudo ./test/bin/install-freetds.sh
|
18
|
-
- rvm-exec 2.1.9 bundle install
|
19
|
-
- rvm-exec 2.2.5 bundle install
|
20
|
-
- rvm-exec 2.3.1 bundle install
|
21
|
-
|
22
|
-
database:
|
23
|
-
post:
|
24
|
-
- docker info
|
25
|
-
- ./test/bin/setup.sh
|
26
|
-
|
27
|
-
test:
|
28
|
-
override:
|
29
|
-
- rvm-exec 2.1.9 bundle exec rake
|
30
|
-
- rvm-exec 2.2.5 bundle exec rake
|
31
|
-
- rvm-exec 2.3.1 bundle exec rake
|