tiny_tds 2.1.0.pre4-x64-mingw32 → 2.1.3-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -3
- data/CHANGELOG.md +21 -0
- data/ISSUE_TEMPLATE.md +32 -6
- data/README.md +30 -15
- 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/tasks/native_gem.rake +1 -1
- data/tasks/ports.rake +6 -8
- data/tasks/ports/openssl.rb +2 -18
- data/test/bin/setup.sh +1 -1
- data/test/client_test.rb +46 -38
- data/test/gem_test.rb +15 -15
- data/test/result_test.rb +41 -41
- data/test/schema_test.rb +22 -22
- data/test/test_helper.rb +2 -2
- data/test/thread_test.rb +1 -1
- data/tiny_tds.gemspec +2 -2
- metadata +35 -39
- 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: e512a3fac65015371dff5419a96d735ad548ba9c7215956a798c820aa1829e62
|
4
|
+
data.tar.gz: 56e856f74da1a557a1a2050376bfcaff8dfd90745c00f7ab406ac7d70a66e96b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b3941293d3dfffb05c06a18e02e1705f17e619efc242b6ddf518a7f9d03860a48d733e2ca9b66748220872f16b55f4ce8c5103e7c91865a0a6149b6b5b8f717
|
7
|
+
data.tar.gz: e50f0c8d362a3b402029d12ddd0305f2d41ffa577b056bf044342569eac6c53060096162e593ae8692a0c98f595d501360e8b1c73af57ddea5c0583c105f6da0
|
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.
|
@@ -196,6 +215,8 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
196
215
|
state of the client and the need to use Result#cancel to stop processing active results. It is also
|
197
216
|
safe to call Result#cancel over and over again.
|
198
217
|
* Look for the syb headers only.
|
218
|
+
* Fix minitest global matchers warnings.
|
219
|
+
* Fix test warnings.
|
199
220
|
|
200
221
|
|
201
222
|
## 0.3.2
|
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/README.md
CHANGED
@@ -1,17 +1,10 @@
|
|
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
|
-
* [![Dependency Status](https://dependencyci.com/github/rails-sqlserver/tiny_tds/badge)](https://dependencyci.com/github/rails-sqlserver/tiny_tds) - Dependency Status
|
9
6
|
* [![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
7
|
|
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
8
|
|
16
9
|
## About TinyTDS
|
17
10
|
|
@@ -40,19 +33,19 @@ If you're using RubyInstaller the binary gem will require that devkit is install
|
|
40
33
|
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
34
|
|
42
35
|
```shell
|
43
|
-
$ apt-get wget
|
36
|
+
$ apt-get install wget
|
44
37
|
$ apt-get install build-essential
|
45
38
|
$ apt-get install libc6-dev
|
46
39
|
|
47
|
-
$ wget http://www.freetds.org/files/stable/freetds-1.
|
48
|
-
$ tar -xzf freetds-1.
|
49
|
-
$ cd freetds-1.
|
40
|
+
$ wget http://www.freetds.org/files/stable/freetds-1.1.24.tar.gz
|
41
|
+
$ tar -xzf freetds-1.1.24.tar.gz
|
42
|
+
$ cd freetds-1.1.24
|
50
43
|
$ ./configure --prefix=/usr/local --with-tdsver=7.3
|
51
44
|
$ make
|
52
45
|
$ make install
|
53
46
|
```
|
54
47
|
|
55
|
-
|
48
|
+
Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
|
56
49
|
|
57
50
|
```
|
58
51
|
--with-freetds-dir=DIR
|
@@ -75,11 +68,11 @@ TinyTDS is developed against FreeTDS 0.95, 0.99, and 1.0 current. Our default an
|
|
75
68
|
|
76
69
|
**NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
|
77
70
|
|
78
|
-
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
|
71
|
+
* **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against.
|
79
72
|
|
80
73
|
* **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
74
|
|
82
|
-
* **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have
|
75
|
+
* **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
76
|
|
84
77
|
* **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
78
|
|
@@ -122,6 +115,17 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
|
|
122
115
|
* :azure - Pass true to signal that you are connecting to azure.
|
123
116
|
* :contained - Pass true to signal that you are connecting with a contained database user.
|
124
117
|
* :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.
|
118
|
+
* :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:
|
119
|
+
|
120
|
+
```ruby
|
121
|
+
opts = ... # host, username, password, etc
|
122
|
+
opts[:message_handler] = Proc.new { |m| puts m.message }
|
123
|
+
client = TinyTds::Client.new opts
|
124
|
+
# => Changed database context to 'master'.
|
125
|
+
# => Changed language setting to us_english.
|
126
|
+
client.execute("print 'hello world!'").do
|
127
|
+
# => hello world!
|
128
|
+
```
|
125
129
|
|
126
130
|
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
131
|
|
@@ -396,7 +400,7 @@ The default is true and since FreeTDS v1.0 would do this as well.
|
|
396
400
|
|
397
401
|
## Compiling Gems for Windows
|
398
402
|
|
399
|
-
For the convenience of Windows users, TinyTDS ships pre-compiled gems for
|
403
|
+
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
404
|
|
401
405
|
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
406
|
|
@@ -457,6 +461,17 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
|
|
457
461
|
$ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
|
458
462
|
```
|
459
463
|
|
464
|
+
## Docker Builds
|
465
|
+
|
466
|
+
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
|
467
|
+
into another, lighter, container without build tools you will need to make sure you tell the OS how to find dependencies for TinyTDS.
|
468
|
+
|
469
|
+
After you have built and installed FreeTDS it will normally place library files in `/usr/local/lib`. When TinyTDS builds native extensions,
|
470
|
+
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.
|
471
|
+
|
472
|
+
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
|
473
|
+
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`.
|
474
|
+
|
460
475
|
## Help & Support
|
461
476
|
|
462
477
|
* Github Source: http://github.com/rails-sqlserver/tiny_tds
|
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/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/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
|
|