tiny_tds 1.0.4-x64-mingw32 → 1.0.5-x64-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +20 -0
- data/.rubocop.yml +31 -0
- data/CHANGELOG +9 -0
- data/ISSUE_TEMPLATE.md +7 -1
- data/README.md +15 -4
- data/Rakefile +17 -15
- data/VERSION +1 -1
- data/appveyor.yml +10 -10
- data/ext/tiny_tds/client.c +30 -12
- data/ext/tiny_tds/client.h +4 -2
- data/ext/tiny_tds/extconsts.rb +1 -1
- data/lib/tiny_tds.rb +4 -4
- data/lib/tiny_tds/bin.rb +9 -10
- data/lib/tiny_tds/client.rb +40 -35
- data/lib/tiny_tds/error.rb +0 -1
- data/lib/tiny_tds/result.rb +2 -3
- data/lib/tiny_tds/version.rb +1 -1
- data/ports/patches/freetds/{1.00 → 1.00.15}/0001-mingw_missing_inet_pton.diff +0 -0
- data/test/appveyor/dbsetup.ps1 +1 -1
- data/test/client_test.rb +14 -8
- data/test/schema/sqlserver_2016.sql +140 -0
- data/tiny_tds.gemspec +3 -3
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aaf8a4adb3303bc24239c509cd032bf5ca339dd8
|
4
|
+
data.tar.gz: cbc13510561e4745dfd79c2284b8e726fa177f9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffb7b1ebf6fd5a22299c87c59bdbd1aa0de928b7548c0603c14e9dd3c209e81c871723b11d8eb492c81cee2afa833425729812588597b9b74df2cbce2b1125f3
|
7
|
+
data.tar.gz: 493a1c1d7cd4dc0b65ccaab76c85e544f104b1027f4708f12dd8ca306787b36ae2a9992e36c49bf2915b8b4f6672ca7eeec95feed25f4d241ef9d3d1f8d540ff
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
engines:
|
2
|
+
bundler-audit:
|
3
|
+
enabled: true
|
4
|
+
duplication:
|
5
|
+
enabled: true
|
6
|
+
config:
|
7
|
+
languages:
|
8
|
+
- ruby
|
9
|
+
fixme:
|
10
|
+
enabled: true
|
11
|
+
rubocop:
|
12
|
+
enabled: true
|
13
|
+
ratings:
|
14
|
+
paths:
|
15
|
+
- "**.rb"
|
16
|
+
exclude_paths:
|
17
|
+
- ext/
|
18
|
+
- ports/
|
19
|
+
- test/
|
20
|
+
- tmp/
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
AllCops:
|
3
|
+
Include:
|
4
|
+
- '**/Rakefile'
|
5
|
+
Exclude:
|
6
|
+
- 'ext/**/*'
|
7
|
+
- 'ports/**/*'
|
8
|
+
- 'test/**/*'
|
9
|
+
- 'tmp/**/*'
|
10
|
+
|
11
|
+
# Redefined
|
12
|
+
|
13
|
+
Metrics/LineLength:
|
14
|
+
Max: 120
|
15
|
+
|
16
|
+
Metrics/ClassLength:
|
17
|
+
Max: 200
|
18
|
+
|
19
|
+
# Disabled
|
20
|
+
|
21
|
+
Style/Documentation:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/EmptyLinesAroundClassBody:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Style/EmptyLinesAroundModuleBody:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Style/EmptyLinesAroundBlockBody:
|
31
|
+
Enabled: false
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
* 1.0.5 *
|
2
|
+
|
3
|
+
* Windows Static Builds - Use FreeTDS 1.00.15, OpenSSL 1.0.2j.
|
4
|
+
* Appveyor tests 2012, 2014, 2016.
|
5
|
+
* Error messages greater than 1024 chars generates a buffer overflow. Fixes #293.
|
6
|
+
* Ensures numeric options are treated numerically Fixes #303.
|
7
|
+
* New `:contained` login option. May deprecate `:azure`. Fixes #292.
|
8
|
+
|
9
|
+
|
1
10
|
* 1.0.4 *
|
2
11
|
|
3
12
|
* Use FreeTDS 1.0 final
|
data/ISSUE_TEMPLATE.md
CHANGED
@@ -2,4 +2,10 @@ Having problems? Have you checked these first:
|
|
2
2
|
|
3
3
|
* Are you using FreeTDS 0.95.80 or later? Check `$ tsql -C` to find out.
|
4
4
|
* If not, please update then uninstall the TinyTDS gem and re-install it.
|
5
|
-
*
|
5
|
+
* Using Ubuntu? If so, you may have forgotten to install FreeTDS first.
|
6
|
+
* Doing work with threads and the raw client? Use the ConnectionPool gem?
|
7
|
+
|
8
|
+
If none of these help. Please make sure to report:
|
9
|
+
|
10
|
+
* What platform you are on. Windows, Mac, Ubuntu, etc.
|
11
|
+
* What version of FreeTDS you are using.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
|
2
2
|
|
3
|
-
[](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) [](https://rubygems.org/gems/tiny_tds) [](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter)
|
3
|
+
[](https://ci.appveyor.com/project/rails-sqlserver/tiny-tds/branch/master) [](https://rubygems.org/gems/tiny_tds) [](https://gitter.im/rails-sqlserver/activerecord-sqlserver-adapter) <a href="https://codeclimate.com/github/rails-sqlserver/tiny_tds"><img src="https://codeclimate.com/github/rails-sqlserver/tiny_tds/badges/gpa.svg" /></a>
|
4
4
|
|
5
5
|
The TinyTDS gem is meant to serve the extremely common use-case of connecting, querying and iterating over results to Microsoft SQL Server or Sybase databases from Ruby using the FreeTDS's DB-Library API.
|
6
6
|
|
@@ -92,6 +92,8 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
|
|
92
92
|
* :timeout - Seconds to wait for a response to a SQL command. Default 5 seconds.
|
93
93
|
* :encoding - Any valid iconv value like CP1251 or ISO-8859-1. Default UTF-8.
|
94
94
|
* :azure - Pass true to signal that you are connecting to azure.
|
95
|
+
* :contained - Pass true to signal that you are connecting with a contained database user.
|
96
|
+
* :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.
|
95
97
|
|
96
98
|
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.
|
97
99
|
|
@@ -324,16 +326,25 @@ SET ANSI_WARNINGS ON
|
|
324
326
|
Also, please read the [Azure SQL Database General Guidelines and Limitations](https://msdn.microsoft.com/en-us/library/ee336245.aspx) MSDN article to understand the differences. Specifically, the connection constraints section!
|
325
327
|
|
326
328
|
|
329
|
+
## Thread Safety
|
330
|
+
|
331
|
+
TinyTDS must be used with a connection pool for thread safety. If you use ActiveRecord or the [Sequel](https://github.com/jeremyevans/sequel) gem this is done for you. However, if you are using TinyTDS on your own, we recommend using the ConnectionPool gem when using threads:
|
332
|
+
|
333
|
+
* ConnectionPool Gem - https://github.com/mperham/connection_pool
|
334
|
+
|
335
|
+
Please read our [thread_test.rb](https://github.com/rails-sqlserver/tiny_tds/blob/master/test/thread_test.rb) file for details on how we test its usage.
|
336
|
+
|
337
|
+
|
327
338
|
## Emoji Support 😍
|
328
339
|
|
329
|
-
This is possible using FreeTDS version 0.95 or higher. You must add the following config to your `freetds.conf` in either the global section or a specfic dataserver. If you are on Windows, the default location for your conf file will be in `C:\Sites`.
|
340
|
+
This is possible using FreeTDS version 0.95 or higher. You must use the `use_utf16` login option or add the following config to your `freetds.conf` in either the global section or a specfic dataserver. If you are on Windows, the default location for your conf file will be in `C:\Sites`.
|
330
341
|
|
331
342
|
```ini
|
332
343
|
[global]
|
333
344
|
use utf-16 = true
|
334
345
|
```
|
335
346
|
|
336
|
-
|
347
|
+
The default is true and since FreeTDS v1.0 would do this as well.
|
337
348
|
|
338
349
|
|
339
350
|
## Using MiniPortile
|
@@ -351,7 +362,7 @@ To find out more about the FreeTDS release system [visit this thread](http://lis
|
|
351
362
|
|
352
363
|
## Compiling Gems for Windows
|
353
364
|
|
354
|
-
For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1 and 2.
|
365
|
+
For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1, 2.2, and 2.3 on Windows. In order to generate these gems, [rake-compiler-dock](https://github.com/rake-compiler/rake-compiler-dock) is used. This project provides a [Docker image](https://registry.hub.docker.com/u/larskanis/rake-compiler-dock/) with rvm, cross-compilers and a number of different target versions of Ruby.
|
355
366
|
|
356
367
|
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:
|
357
368
|
|
data/Rakefile
CHANGED
@@ -8,14 +8,14 @@ require 'rubygems/package_task'
|
|
8
8
|
require_relative './ext/tiny_tds/extconsts'
|
9
9
|
|
10
10
|
def test_libs
|
11
|
-
|
11
|
+
%w(lib test)
|
12
12
|
end
|
13
13
|
|
14
14
|
def test_files
|
15
15
|
if ENV['TEST_FILES']
|
16
|
-
ENV['TEST_FILES'].split(',').map
|
16
|
+
ENV['TEST_FILES'].split(',').map(&:strip).sort
|
17
17
|
else
|
18
|
-
Dir.glob(
|
18
|
+
Dir.glob('test/**/*_test.rb').sort
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -32,7 +32,7 @@ def gem_build_path(spec)
|
|
32
32
|
File.join 'pkg', spec.full_name
|
33
33
|
end
|
34
34
|
|
35
|
-
gemspec = Gem::Specification
|
35
|
+
gemspec = Gem::Specification.load(File.expand_path('../tiny_tds.gemspec', __FILE__))
|
36
36
|
|
37
37
|
Rake::TestTask.new do |t|
|
38
38
|
t.libs = test_libs
|
@@ -47,18 +47,18 @@ end
|
|
47
47
|
|
48
48
|
task :compile
|
49
49
|
|
50
|
-
task :
|
50
|
+
task build: [:clean, :compile]
|
51
51
|
task(:build_quietly) { capture_stds { Rake::Task[:build].invoke } }
|
52
52
|
|
53
|
-
task :
|
53
|
+
task default: [:build, :test]
|
54
54
|
|
55
|
-
Dir[
|
55
|
+
Dir['tasks/*.rake'].sort.each { |f| load f }
|
56
56
|
|
57
57
|
Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
|
58
58
|
ext.lib_dir = 'lib/tiny_tds'
|
59
59
|
ext.cross_compile = true
|
60
60
|
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
|
61
|
-
ext.cross_config_options += %w
|
61
|
+
ext.cross_config_options += %w(--disable-lookup --enable-cross-build)
|
62
62
|
# Add dependent DLLs to the cross gems
|
63
63
|
ext.cross_compiling do |spec|
|
64
64
|
platform_host_map = {
|
@@ -70,16 +70,16 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
|
|
70
70
|
dlls = [
|
71
71
|
"libeay32-1.0.2g-#{host}.dll",
|
72
72
|
"ssleay32-1.0.2g-#{host}.dll",
|
73
|
-
|
74
|
-
|
73
|
+
'libiconv-2.dll',
|
74
|
+
'libsybdb-5.dll'
|
75
75
|
]
|
76
76
|
# We don't need the sources in a fat binary gem
|
77
|
-
spec.files = spec.files.reject { |f| f
|
77
|
+
spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
|
78
78
|
spec.files += dlls.map { |dll| "ports/#{host}/bin/#{File.basename(dll)}" }
|
79
79
|
spec.files += Dir.glob('exe/*')
|
80
80
|
dlls.each do |dll|
|
81
81
|
file "ports/#{host}/bin/#{dll}" do |t|
|
82
|
-
sh
|
82
|
+
sh 'x86_64-w64-mingw32-strip', t.name
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -90,7 +90,7 @@ task gem_build_path(gemspec) do
|
|
90
90
|
add_file_to_gem gemspec, "ports/archives/freetds-#{FREETDS_VERSION}.tar.bz2"
|
91
91
|
end
|
92
92
|
|
93
|
-
desc
|
93
|
+
desc 'Build the windows binary gems per rake-compiler-dock'
|
94
94
|
task 'gem:windows' do
|
95
95
|
require 'rake_compiler_dock'
|
96
96
|
RakeCompilerDock.sh <<-EOT
|
@@ -99,8 +99,10 @@ task 'gem:windows' do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def capture_stds
|
102
|
-
pstdout
|
103
|
-
|
102
|
+
pstdout = $stdout
|
103
|
+
$stdout = StringIO.new
|
104
|
+
pstderr = $stderr
|
105
|
+
$stderr = StringIO.new
|
104
106
|
yield
|
105
107
|
$stdout.string
|
106
108
|
$stderr.string
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/appveyor.yml
CHANGED
@@ -2,12 +2,14 @@ init:
|
|
2
2
|
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
3
3
|
- SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
|
4
4
|
- SET RAKEOPT=-rdevkit
|
5
|
+
- SET TESTOPTS='-v'
|
5
6
|
clone_depth: 5
|
6
7
|
skip_tags: true
|
7
8
|
matrix:
|
8
9
|
fast_finish: true
|
9
10
|
install:
|
10
11
|
- ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
|
12
|
+
- perl --version
|
11
13
|
- ruby --version
|
12
14
|
- gem --version
|
13
15
|
- bundle install
|
@@ -20,6 +22,12 @@ test_script:
|
|
20
22
|
- timeout /t 4 /nobreak > NUL
|
21
23
|
- powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
|
22
24
|
- timeout /t 4 /nobreak > NUL
|
25
|
+
- ps: Start-Service 'MSSQL$SQL2016'
|
26
|
+
- timeout /t 4 /nobreak > NUL
|
27
|
+
- sqlcmd -S ".\SQL2016" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
28
|
+
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2016" TINYTDS_SCHEMA=sqlserver_2014 TDSVER=7.1
|
29
|
+
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2016" TINYTDS_SCHEMA=sqlserver_2014
|
30
|
+
- ps: Stop-Service 'MSSQL$SQL2016'
|
23
31
|
- ps: Start-Service 'MSSQL$SQL2014'
|
24
32
|
- timeout /t 4 /nobreak > NUL
|
25
33
|
- sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
@@ -30,22 +38,14 @@ test_script:
|
|
30
38
|
- timeout /t 4 /nobreak > NUL
|
31
39
|
- sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
32
40
|
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2012SP1" TINYTDS_SCHEMA=sqlserver_2014
|
33
|
-
- ps: Stop-Service 'MSSQL$SQL2012SP1'
|
34
|
-
- ps: Start-Service 'MSSQL$SQL2008R2SP2'
|
35
|
-
- timeout /t 4 /nobreak > NUL
|
36
|
-
- sqlcmd -S ".\SQL2008R2SP2" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
37
|
-
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2008R2SP2" TINYTDS_SCHEMA=sqlserver_2008
|
38
|
-
- timeout /t 4 /nobreak > NUL
|
39
|
-
- bundle exec rake TINYTDS_UNIT_HOST_TEST=%CI_AZURE_HOST% TINYTDS_UNIT_HOST=%CI_AZURE_HOST% TINYTDS_SCHEMA=sqlserver_azure
|
40
41
|
environment:
|
41
42
|
CI_AZURE_HOST:
|
42
43
|
secure: 8ydpYysZYKEBKvp6plKlYfepH98/zAuT27FFCaJ9Sss=
|
43
44
|
TINYTDS_UNIT_AZURE_PASS:
|
44
45
|
secure: fYKSKV4v+36OFQp2nZdX4DfUpgmy5cm0wuR73cgdmEk=
|
45
46
|
matrix:
|
46
|
-
- ruby_version: "200"
|
47
|
-
- ruby_version: "23"
|
48
47
|
- ruby_version: "23-x64"
|
48
|
+
- ruby_version: "23"
|
49
|
+
- ruby_version: "200"
|
49
50
|
on_failure:
|
50
51
|
- find -name compile.log | xargs cat
|
51
|
-
|
data/ext/tiny_tds/client.c
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
VALUE cTinyTdsClient;
|
5
5
|
extern VALUE mTinyTds, cTinyTdsError;
|
6
|
-
static ID sym_username, sym_password, sym_dataserver, sym_database, sym_appname, sym_tds_version, sym_login_timeout, sym_timeout, sym_encoding, sym_azure;
|
6
|
+
static ID sym_username, sym_password, sym_dataserver, sym_database, sym_appname, sym_tds_version, sym_login_timeout, sym_timeout, sym_encoding, sym_azure, sym_contained, sym_use_utf16;
|
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;
|
9
9
|
VALUE opt_escape_regex, opt_escape_dblquote;
|
@@ -110,8 +110,8 @@ int tinytds_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, c
|
|
110
110
|
*/
|
111
111
|
if (!userdata->nonblocking_error.is_set) {
|
112
112
|
userdata->nonblocking_error.cancel = cancel;
|
113
|
-
|
114
|
-
|
113
|
+
strncpy(userdata->nonblocking_error.error, dberrstr, ERROR_MSG_SIZE);
|
114
|
+
strncpy(userdata->nonblocking_error.source, source, ERROR_MSG_SIZE);
|
115
115
|
userdata->nonblocking_error.severity = severity;
|
116
116
|
userdata->nonblocking_error.dberr = dberr;
|
117
117
|
userdata->nonblocking_error.oserr = oserr;
|
@@ -133,8 +133,8 @@ int tinytds_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severi
|
|
133
133
|
if (userdata && userdata->nonblocking) {
|
134
134
|
if (!userdata->nonblocking_error.is_set) {
|
135
135
|
userdata->nonblocking_error.cancel = 1;
|
136
|
-
|
137
|
-
|
136
|
+
strncpy(userdata->nonblocking_error.error, msgtext, ERROR_MSG_SIZE);
|
137
|
+
strncpy(userdata->nonblocking_error.source, source, ERROR_MSG_SIZE);
|
138
138
|
userdata->nonblocking_error.severity = severity;
|
139
139
|
userdata->nonblocking_error.dberr = msgno;
|
140
140
|
userdata->nonblocking_error.oserr = msgstate;
|
@@ -293,7 +293,7 @@ static VALUE rb_tinytds_identity_sql(VALUE self) {
|
|
293
293
|
|
294
294
|
static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
|
295
295
|
/* Parsing options hash to local vars. */
|
296
|
-
VALUE user, pass, dataserver, database, app, version, ltimeout, timeout, charset, azure;
|
296
|
+
VALUE user, pass, dataserver, database, app, version, ltimeout, timeout, charset, azure, contained, use_utf16;
|
297
297
|
GET_CLIENT_WRAPPER(self);
|
298
298
|
|
299
299
|
user = rb_hash_aref(opts, sym_username);
|
@@ -306,6 +306,8 @@ static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
|
|
306
306
|
timeout = rb_hash_aref(opts, sym_timeout);
|
307
307
|
charset = rb_hash_aref(opts, sym_encoding);
|
308
308
|
azure = rb_hash_aref(opts, sym_azure);
|
309
|
+
contained = rb_hash_aref(opts, sym_contained);
|
310
|
+
use_utf16 = rb_hash_aref(opts, sym_use_utf16);
|
309
311
|
/* Dealing with options. */
|
310
312
|
if (dbinit() == FAIL) {
|
311
313
|
rb_raise(cTinyTdsError, "failed dbinit() function");
|
@@ -328,13 +330,28 @@ static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
|
|
328
330
|
dbsettime(NUM2INT(timeout));
|
329
331
|
if (!NIL_P(charset))
|
330
332
|
DBSETLCHARSET(cwrap->login, StringValueCStr(charset));
|
331
|
-
if (!NIL_P(database)
|
332
|
-
|
333
|
-
DBSETLDBNAME
|
334
|
-
|
335
|
-
|
336
|
-
|
333
|
+
if (!NIL_P(database)) {
|
334
|
+
if (azure == Qtrue || contained == Qtrue) {
|
335
|
+
#ifdef DBSETLDBNAME
|
336
|
+
DBSETLDBNAME(cwrap->login, StringValueCStr(database));
|
337
|
+
#else
|
338
|
+
if (azure == Qtrue) {
|
339
|
+
rb_warn("TinyTds: :azure option is not supported in this version of FreeTDS.\n");
|
340
|
+
}
|
341
|
+
if (contained == Qtrue) {
|
342
|
+
rb_warn("TinyTds: :contained option is not supported in this version of FreeTDS.\n");
|
343
|
+
}
|
344
|
+
#endif
|
345
|
+
}
|
337
346
|
}
|
347
|
+
#ifdef DBSETUTF16
|
348
|
+
if (use_utf16 == Qtrue) { DBSETLUTF16(cwrap->login, 1); }
|
349
|
+
if (use_utf16 == Qfalse) { DBSETLUTF16(cwrap->login, 0); }
|
350
|
+
#else
|
351
|
+
if (use_utf16 == Qtrue || use_utf16 == Qfalse) {
|
352
|
+
rb_warn("TinyTds: :use_utf16 option not supported in this version of FreeTDS.\n");
|
353
|
+
}
|
354
|
+
#endif
|
338
355
|
cwrap->client = dbopen(cwrap->login, StringValueCStr(dataserver));
|
339
356
|
if (cwrap->client) {
|
340
357
|
VALUE transposed_encoding;
|
@@ -391,6 +408,7 @@ void init_tinytds_client() {
|
|
391
408
|
sym_timeout = ID2SYM(rb_intern("timeout"));
|
392
409
|
sym_encoding = ID2SYM(rb_intern("encoding"));
|
393
410
|
sym_azure = ID2SYM(rb_intern("azure"));
|
411
|
+
sym_contained = ID2SYM(rb_intern("contained"));
|
394
412
|
/* Intern TinyTds::Error Accessors */
|
395
413
|
intern_source_eql = rb_intern("source=");
|
396
414
|
intern_severity_eql = rb_intern("severity=");
|
data/ext/tiny_tds/client.h
CHANGED
@@ -4,11 +4,13 @@
|
|
4
4
|
|
5
5
|
void init_tinytds_client();
|
6
6
|
|
7
|
+
#define ERROR_MSG_SIZE 1024
|
8
|
+
|
7
9
|
typedef struct {
|
8
10
|
short int is_set;
|
9
11
|
int cancel;
|
10
|
-
char error[
|
11
|
-
char source[
|
12
|
+
char error[ERROR_MSG_SIZE];
|
13
|
+
char source[ERROR_MSG_SIZE];
|
12
14
|
int severity;
|
13
15
|
int dberr;
|
14
16
|
int oserr;
|
data/ext/tiny_tds/extconsts.rb
CHANGED
@@ -5,7 +5,7 @@ ICONV_SOURCE_URI = "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION
|
|
5
5
|
OPENSSL_VERSION = ENV['TINYTDS_OPENSSL_VERSION'] || '1.0.2g'
|
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.00"
|
8
|
+
FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "1.00.15"
|
9
9
|
FREETDS_VERSION_INFO = Hash.new { |h,k|
|
10
10
|
h[k] = {files: "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.bz2"}
|
11
11
|
}
|
data/lib/tiny_tds.rb
CHANGED
@@ -10,12 +10,12 @@ require 'tiny_tds/result'
|
|
10
10
|
|
11
11
|
# Support multiple ruby versions, fat binaries under Windows.
|
12
12
|
if RUBY_PLATFORM =~ /mingw|mswin/ && RUBY_VERSION =~ /(\d+.\d+)/
|
13
|
-
ver =
|
13
|
+
ver = Regexp.last_match(1)
|
14
14
|
# Set the PATH environment variable, so that the DLLs can be found.
|
15
15
|
old_path = ENV['PATH']
|
16
16
|
begin
|
17
17
|
# Do the same host consolidation as in extconf.rb
|
18
|
-
ports_dir = RbConfig::CONFIG[
|
18
|
+
ports_dir = RbConfig::CONFIG['host'].gsub('i686-pc-mingw32', 'i686-w64-mingw32')
|
19
19
|
ENV['PATH'] = "#{File.expand_path("../../ports/#{ports_dir}/bin", __FILE__)};#{old_path}"
|
20
20
|
require "tiny_tds/#{ver}/tiny_tds"
|
21
21
|
rescue LoadError
|
@@ -27,9 +27,9 @@ else
|
|
27
27
|
# Load dependent shared libraries into the process, so that they are already present,
|
28
28
|
# when tiny_tds.so is loaded. This ensures, that shared libraries are loaded even when
|
29
29
|
# the path is different between build and run time (e.g. Heroku).
|
30
|
-
ports_libs = File.expand_path("../../ports/#{RbConfig::CONFIG[
|
30
|
+
ports_libs = File.expand_path("../../ports/#{RbConfig::CONFIG['host']}/lib/*.so", __FILE__)
|
31
31
|
Dir[ports_libs].each do |lib|
|
32
|
-
require
|
32
|
+
require 'fiddle'
|
33
33
|
Fiddle.dlopen(lib)
|
34
34
|
end
|
35
35
|
|
data/lib/tiny_tds/bin.rb
CHANGED
@@ -29,19 +29,18 @@ module TinyTds
|
|
29
29
|
def run(*args)
|
30
30
|
return nil unless path
|
31
31
|
Kernel.system Shellwords.join(args.unshift(path))
|
32
|
-
|
32
|
+
$CHILD_STATUS.to_i
|
33
33
|
end
|
34
34
|
|
35
35
|
def path
|
36
36
|
return @path if defined?(@path)
|
37
|
-
@path = @exefile && File.
|
37
|
+
@path = @exefile && File.exist?(@exefile) ? @exefile : which
|
38
38
|
end
|
39
39
|
|
40
40
|
def info
|
41
41
|
"[TinyTds][v#{TinyTds::VERSION}][#{name}]: #{path}"
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
44
|
private
|
46
45
|
|
47
46
|
def find_bin
|
@@ -51,7 +50,7 @@ module TinyTds
|
|
51
50
|
def find_exe
|
52
51
|
EXTS.each do |ext|
|
53
52
|
f = File.join ROOT, 'exe', "#{name}#{ext}"
|
54
|
-
return f if File.
|
53
|
+
return f if File.exist?(f)
|
55
54
|
end
|
56
55
|
nil
|
57
56
|
end
|
@@ -61,12 +60,12 @@ module TinyTds
|
|
61
60
|
EXTS.each do |ext|
|
62
61
|
exe = File.expand_path File.join(path, "#{name}#{ext}"), ROOT
|
63
62
|
next if exe == @binstub
|
64
|
-
next
|
65
|
-
next
|
63
|
+
next unless File.executable?(exe)
|
64
|
+
next unless binary?(exe)
|
66
65
|
return exe
|
67
66
|
end
|
68
67
|
end
|
69
|
-
|
68
|
+
nil
|
70
69
|
end
|
71
70
|
|
72
71
|
# Implementation directly copied from ptools.
|
@@ -77,9 +76,9 @@ module TinyTds
|
|
77
76
|
bytes = File.stat(file).blksize
|
78
77
|
return false unless bytes
|
79
78
|
bytes = 4096 if bytes > 4096
|
80
|
-
s = (File.read(file, bytes) ||
|
81
|
-
s = s.encode('US-ASCII', :
|
82
|
-
((s.size - s.grep(
|
79
|
+
s = (File.read(file, bytes) || '')
|
80
|
+
s = s.encode('US-ASCII', undef: :replace).split(//)
|
81
|
+
((s.size - s.grep(' '..'~').size) / s.size.to_f) > 0.30
|
83
82
|
end
|
84
83
|
|
85
84
|
end
|
data/lib/tiny_tds/client.rb
CHANGED
@@ -1,21 +1,19 @@
|
|
1
1
|
module TinyTds
|
2
2
|
class Client
|
3
3
|
|
4
|
-
|
5
|
-
:
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
4
|
+
@default_query_options = {
|
5
|
+
as: :hash,
|
6
|
+
symbolize_keys: false,
|
7
|
+
cache_rows: true,
|
8
|
+
timezone: :local,
|
9
|
+
empty_sets: true
|
10
10
|
}
|
11
11
|
|
12
12
|
attr_reader :query_options
|
13
13
|
|
14
14
|
class << self
|
15
15
|
|
16
|
-
|
17
|
-
@@default_query_options
|
18
|
-
end
|
16
|
+
attr_reader :default_query_options
|
19
17
|
|
20
18
|
# Most, if not all, iconv encoding names can be found by ruby. Just in case, you can
|
21
19
|
# overide this method to return a string name that Encoding.find would work with. Default
|
@@ -25,21 +23,33 @@ module TinyTds
|
|
25
23
|
encoding
|
26
24
|
end
|
27
25
|
|
28
|
-
|
26
|
+
def local_offset
|
27
|
+
::Time.local(2010).utc_offset.to_r / 86_400
|
28
|
+
end
|
29
29
|
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
32
|
+
# rubocop:disable Metrics/AbcSize
|
33
|
+
# rubocop:disable Metrics/MethodLength
|
34
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
35
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
36
|
+
def initialize(opts = {})
|
37
|
+
if opts[:dataserver].to_s.empty? && opts[:host].to_s.empty?
|
38
|
+
raise ArgumentError, 'missing :host option if no :dataserver given'
|
39
|
+
end
|
33
40
|
opts[:username] = parse_username(opts)
|
34
|
-
@query_options =
|
41
|
+
@query_options = self.class.default_query_options.dup
|
35
42
|
opts[:password] = opts[:password].to_s if opts[:password] && opts[:password].to_s.strip != ''
|
36
43
|
opts[:appname] ||= 'TinyTds'
|
37
44
|
opts[:tds_version] = tds_versions_setter(opts)
|
45
|
+
opts[:use_utf16] ||= true
|
38
46
|
opts[:login_timeout] ||= 60
|
39
47
|
opts[:timeout] ||= 5
|
40
|
-
opts[:encoding] =
|
48
|
+
opts[:encoding] = opts[:encoding].nil? || opts[:encoding].casecmp('utf8').zero? ? 'UTF-8' : opts[:encoding].upcase
|
41
49
|
opts[:port] ||= 1433
|
42
50
|
opts[:dataserver] = "#{opts[:host]}:#{opts[:port]}" if opts[:dataserver].to_s.empty?
|
51
|
+
forced_integer_keys = [:login_timeout, :port, :timeout]
|
52
|
+
forced_integer_keys.each { |k| opts[k] = opts[k].to_i if opts[k] }
|
43
53
|
connect(opts)
|
44
54
|
end
|
45
55
|
|
@@ -56,24 +66,19 @@ module TinyTds
|
|
56
66
|
!closed? && !dead?
|
57
67
|
end
|
58
68
|
|
59
|
-
|
60
69
|
private
|
61
70
|
|
62
|
-
def self.local_offset
|
63
|
-
::Time.local(2010).utc_offset.to_r / 86400
|
64
|
-
end
|
65
|
-
|
66
71
|
def parse_username(opts)
|
67
72
|
host = opts[:host]
|
68
73
|
username = opts[:username]
|
69
74
|
return username if username.nil? || !opts[:azure]
|
70
|
-
return username if username.include?(
|
71
|
-
user, domain = username.split(
|
75
|
+
return username if username.include?('@') && !username.include?('database.windows.net')
|
76
|
+
user, domain = username.split('@')
|
72
77
|
domain ||= host
|
73
78
|
"#{user}@#{domain.split('.').first}"
|
74
79
|
end
|
75
80
|
|
76
|
-
def tds_versions_setter(opts={})
|
81
|
+
def tds_versions_setter(opts = {})
|
77
82
|
v = opts[:tds_version] || ENV['TDSVER'] || '7.3'
|
78
83
|
TDS_VERSIONS_SETTERS[v.to_s]
|
79
84
|
end
|
@@ -105,19 +110,19 @@ module TinyTds
|
|
105
110
|
# The integer values of the constants are poorly chosen.
|
106
111
|
#
|
107
112
|
TDS_VERSIONS_GETTERS = {
|
108
|
-
0 => {:
|
109
|
-
1 => {:
|
110
|
-
2 => {:
|
111
|
-
3 => {:
|
112
|
-
4 => {:
|
113
|
-
5 => {:
|
114
|
-
6 => {:
|
115
|
-
7 => {:
|
116
|
-
8 => {:
|
117
|
-
9 => {:
|
118
|
-
10 => {:
|
119
|
-
11 => {:
|
120
|
-
12 => {:
|
113
|
+
0 => { name: 'DBTDS_UNKNOWN', description: 'Unknown' },
|
114
|
+
1 => { name: 'DBTDS_2_0', description: 'Pre 4.0 SQL Server' },
|
115
|
+
2 => { name: 'DBTDS_3_4', description: 'Microsoft SQL Server (3.0)' },
|
116
|
+
3 => { name: 'DBTDS_4_0', description: '4.0 SQL Server' },
|
117
|
+
4 => { name: 'DBTDS_4_2', description: '4.2 SQL Server' },
|
118
|
+
5 => { name: 'DBTDS_4_6', description: '2.0 OpenServer and 4.6 SQL Server.' },
|
119
|
+
6 => { name: 'DBTDS_4_9_5', description: '4.9.5 (NCR) SQL Server' },
|
120
|
+
7 => { name: 'DBTDS_5_0', description: '5.0 SQL Server' },
|
121
|
+
8 => { name: 'DBTDS_7_0', description: 'Microsoft SQL Server 7.0' },
|
122
|
+
9 => { name: 'DBTDS_7_1/DBTDS_8_0', description: 'Microsoft SQL Server 2000' },
|
123
|
+
10 => { name: 'DBTDS_7_2/DBTDS_9_0', description: 'Microsoft SQL Server 2005' },
|
124
|
+
11 => { name: 'DBTDS_7_3', description: 'Microsoft SQL Server 2008' },
|
125
|
+
12 => { name: 'DBTDS_7_4', description: 'Microsoft SQL Server 2012/2014' }
|
121
126
|
}.freeze
|
122
127
|
|
123
128
|
end
|
data/lib/tiny_tds/error.rb
CHANGED
data/lib/tiny_tds/result.rb
CHANGED
data/lib/tiny_tds/version.rb
CHANGED
File without changes
|
data/test/appveyor/dbsetup.ps1
CHANGED
@@ -5,7 +5,7 @@ Write-Output "Setting up..."
|
|
5
5
|
|
6
6
|
Write-Output "Setting variables..."
|
7
7
|
$serverName = $env:COMPUTERNAME
|
8
|
-
$instances = @('
|
8
|
+
$instances = @('SQL2012SP1', 'SQL2014', 'SQL2016')
|
9
9
|
$smo = 'Microsoft.SqlServer.Management.Smo.'
|
10
10
|
$wmi = new-object ($smo + 'Wmi.ManagedComputer')
|
11
11
|
|
data/test/client_test.rb
CHANGED
@@ -46,20 +46,26 @@ class ClientTest < TinyTds::TestCase
|
|
46
46
|
assert_equal "''hello''", @client.escape("'hello'")
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
['CP850', 'CP1252', 'ISO-8859-1'].each do |encoding|
|
50
|
+
it "allows valid iconv character set - #{encoding}" do
|
51
|
+
begin
|
52
|
+
client = new_connection(:encoding => encoding)
|
53
|
+
assert_equal encoding, client.charset
|
54
|
+
assert_equal Encoding.find(encoding), client.encoding
|
55
|
+
ensure
|
56
|
+
client.close if client
|
57
|
+
end
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
58
61
|
it 'must be able to use :host/:port connection' do
|
59
62
|
host = ENV['TINYTDS_UNIT_HOST_TEST'] || ENV['TINYTDS_UNIT_HOST']
|
60
63
|
port = ENV['TINYTDS_UNIT_PORT_TEST'] || ENV['TINYTDS_UNIT_PORT'] || 1433
|
61
|
-
|
62
|
-
|
64
|
+
begin
|
65
|
+
client = new_connection dataserver: nil, host: host, port: port
|
66
|
+
ensure
|
67
|
+
client.close if client
|
68
|
+
end
|
63
69
|
end unless sqlserver_azure?
|
64
70
|
|
65
71
|
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
|
4
|
+
* Binary Data - Our test binary data is a 1 pixel gif. The basic (raw) data is below. Quoting this data
|
5
|
+
would involve this (encode) method and be (encoded) with the 0x prefix for raw SQL. In other clients the
|
6
|
+
(raw_db) value without the 0x prefix would need to be (packed) again yield the original (raw) value.
|
7
|
+
|
8
|
+
(raw) - "GIF89a\001\000\001\000\221\000\000\377\377\377\377\377\377\376\001\002\000\000\000!\371\004\004\024\000\377\000,\000\000\000\000\001\000\001\000\000\002\002D\001\000;"
|
9
|
+
(encode) - "0x#{raw.unpack("H*")[0]}"
|
10
|
+
(encoded) - "0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
|
11
|
+
(raw_db) - "47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b"
|
12
|
+
(packed) - [raw_db].pack('H*')
|
13
|
+
|
14
|
+
*/
|
15
|
+
|
16
|
+
CREATE TABLE [dbo].[datatypes] (
|
17
|
+
[id] [int] NOT NULL IDENTITY(1,1) PRIMARY KEY,
|
18
|
+
[bigint] [bigint] NULL,
|
19
|
+
[binary_50] [binary](50) NULL,
|
20
|
+
[bit] [bit] NULL,
|
21
|
+
[char_10] [char](10) NULL,
|
22
|
+
[date] [date] NULL,
|
23
|
+
[datetime] [datetime] NULL,
|
24
|
+
[datetime2_7] [datetime2](7) NULL,
|
25
|
+
[datetime2_2] [datetime2](2) NULL,
|
26
|
+
[datetimeoffset_2] [datetimeoffset](2) NULL,
|
27
|
+
[datetimeoffset_7] [datetimeoffset](7) NULL,
|
28
|
+
[decimal_9_2] [decimal](9, 2) NULL,
|
29
|
+
[decimal_16_4] [decimal](16, 4) NULL,
|
30
|
+
[float] [float] NULL,
|
31
|
+
[geography] [geography] NULL,
|
32
|
+
[geometry] [geometry] NULL,
|
33
|
+
[hierarchyid] [hierarchyid] NULL,
|
34
|
+
[image] [image] NULL,
|
35
|
+
[int] [int] NULL,
|
36
|
+
[money] [money] NULL,
|
37
|
+
[nchar_10] [nchar](10) NULL,
|
38
|
+
[ntext] [ntext] NULL,
|
39
|
+
[numeric_18_0] [numeric](18, 0) NULL,
|
40
|
+
[numeric_36_2] [numeric](36, 2) NULL,
|
41
|
+
[nvarchar_50] [nvarchar](50) NULL,
|
42
|
+
[nvarchar_max] [nvarchar](max) NULL,
|
43
|
+
[real] [real] NULL,
|
44
|
+
[smalldatetime] [smalldatetime] NULL,
|
45
|
+
[smallint] [smallint] NULL,
|
46
|
+
[smallmoney] [smallmoney] NULL,
|
47
|
+
[text] [text] NULL,
|
48
|
+
[time_2] [time](2) NULL,
|
49
|
+
[time_7] [time](7) NULL,
|
50
|
+
[timestamp] [timestamp] NULL,
|
51
|
+
[tinyint] [tinyint] NULL,
|
52
|
+
[uniqueidentifier] [uniqueidentifier] NULL,
|
53
|
+
[varbinary_50] [varbinary](50) NULL,
|
54
|
+
[varbinary_max] [varbinary](max) NULL,
|
55
|
+
[varchar_50] [varchar](50) NULL,
|
56
|
+
[varchar_max] [varchar](max) NULL,
|
57
|
+
[xml] [xml] NULL
|
58
|
+
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
|
59
|
+
|
60
|
+
SET IDENTITY_INSERT [datatypes] ON
|
61
|
+
|
62
|
+
INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 11, -9223372036854775807 )
|
63
|
+
INSERT INTO [datatypes] ([id], [bigint]) VALUES ( 12, 9223372036854775806 )
|
64
|
+
INSERT INTO [datatypes] ([id], [binary_50]) VALUES ( 21, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
|
65
|
+
INSERT INTO [datatypes] ([id], [bit]) VALUES ( 31, 1 )
|
66
|
+
INSERT INTO [datatypes] ([id], [bit]) VALUES ( 32, 0 )
|
67
|
+
INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 41, '1234567890' )
|
68
|
+
INSERT INTO [datatypes] ([id], [char_10]) VALUES ( 42, '12345678' )
|
69
|
+
INSERT INTO [datatypes] ([id], [date]) VALUES ( 51, '0001-01-01' )
|
70
|
+
INSERT INTO [datatypes] ([id], [date]) VALUES ( 52, '9999-12-31' )
|
71
|
+
INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 61, '1753-01-01T00:00:00.000' )
|
72
|
+
INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 62, '9999-12-31T23:59:59.997' )
|
73
|
+
INSERT INTO [datatypes] ([id], [datetime]) VALUES ( 63, '2010-01-01T12:34:56.123' )
|
74
|
+
INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 71, '0001-01-01 00:00:00.0000000' )
|
75
|
+
INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 72, '1984-01-24 04:20:00.0000000' )
|
76
|
+
INSERT INTO [datatypes] ([id], [datetime2_7]) VALUES ( 73, '9999-12-31 23:59:59.9999999' )
|
77
|
+
INSERT INTO [datatypes] ([id], [datetime2_2]) VALUES ( 74, '9999-12-31 23:59:59.123456789' )
|
78
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 81, '1984-01-24T04:20:00.1234567-08:00' ) -- 1984-01-24 04:20:00.00 -08:00
|
79
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 82, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.00 +00:00
|
80
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_2]) VALUES ( 83, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.99 +00:00
|
81
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 84, '1984-01-24T04:20:59.1234567-08:00' ) -- 1984-01-24 04:20:59.1234567 -08:00
|
82
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 85, '1984-01-24T04:20:00.0000000Z' ) -- 1984-01-24 04:20:00.0000000 +00:00
|
83
|
+
INSERT INTO [datatypes] ([id], [datetimeoffset_7]) VALUES ( 86, '9999-12-31T23:59:59.9999999Z' ) -- 9999-12-31 23:59:59.9999999 +00:00
|
84
|
+
INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 91, 12345.01 )
|
85
|
+
INSERT INTO [datatypes] ([id], [decimal_9_2]) VALUES ( 92, 1234567.89 )
|
86
|
+
INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 93, 0.0 )
|
87
|
+
INSERT INTO [datatypes] ([id], [decimal_16_4]) VALUES ( 94, 123456789012.3456 )
|
88
|
+
INSERT INTO [datatypes] ([id], [float]) VALUES ( 101, 123.00000001 )
|
89
|
+
INSERT INTO [datatypes] ([id], [float]) VALUES ( 102, 0.0 )
|
90
|
+
INSERT INTO [datatypes] ([id], [float]) VALUES ( 103, 123.45 )
|
91
|
+
INSERT INTO [datatypes] ([id], [geography]) VALUES ( 111, geography::STGeomFromText('LINESTRING(-122.360 47.656, -122.343 47.656)', 4326) ) -- 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
|
92
|
+
INSERT INTO [datatypes] ([id], [geometry]) VALUES ( 121, geometry::STGeomFromText('LINESTRING (100 100, 20 180, 180 180)', 0) ) -- 0x0000000001040300000000000000000059400000000000005940000000000000344000000000008066400000000000806640000000000080664001000000010000000001000000FFFFFFFF0000000002
|
93
|
+
INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 131, CAST('/1/' AS hierarchyid) ) -- 0x58
|
94
|
+
INSERT INTO [datatypes] ([id], [hierarchyid]) VALUES ( 132, CAST('/2/' AS hierarchyid) ) -- 0x68
|
95
|
+
INSERT INTO [datatypes] ([id], [image]) VALUES ( 141, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
|
96
|
+
INSERT INTO [datatypes] ([id], [int]) VALUES ( 151, -2147483647 )
|
97
|
+
INSERT INTO [datatypes] ([id], [int]) VALUES ( 152, 2147483646 )
|
98
|
+
INSERT INTO [datatypes] ([id], [money]) VALUES ( 161, 4.20 )
|
99
|
+
INSERT INTO [datatypes] ([id], [money]) VALUES ( 162, -922337203685477.5807 )
|
100
|
+
INSERT INTO [datatypes] ([id], [money]) VALUES ( 163, 922337203685477.5806 )
|
101
|
+
INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 171, N'1234567890' )
|
102
|
+
INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 172, N'123456åå' )
|
103
|
+
INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 173, N'abc123' )
|
104
|
+
INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 181, N'test ntext' )
|
105
|
+
INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext åå' )
|
106
|
+
INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 191, 191 )
|
107
|
+
INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 192, 123456789012345678 )
|
108
|
+
INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 193, 12345678901234567890.01 )
|
109
|
+
INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 194, 123.46 )
|
110
|
+
INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 201, N'test nvarchar_50' )
|
111
|
+
INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 202, N'test nvarchar_50 åå' )
|
112
|
+
INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 211, N'test nvarchar_max' )
|
113
|
+
INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max åå' )
|
114
|
+
INSERT INTO [datatypes] ([id], [real]) VALUES ( 221, 123.45 )
|
115
|
+
INSERT INTO [datatypes] ([id], [real]) VALUES ( 222, 0.0 )
|
116
|
+
INSERT INTO [datatypes] ([id], [real]) VALUES ( 223, 0.00001 )
|
117
|
+
INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 231, '1901-01-01T15:45:00.000Z' ) -- 1901-01-01 15:45:00
|
118
|
+
INSERT INTO [datatypes] ([id], [smalldatetime]) VALUES ( 232, '2078-06-05T04:20:00.000Z' ) -- 2078-06-05 04:20:00
|
119
|
+
INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 241, -32767 )
|
120
|
+
INSERT INTO [datatypes] ([id], [smallint]) VALUES ( 242, 32766 )
|
121
|
+
INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 251, 4.20 )
|
122
|
+
INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 252, -214748.3647 )
|
123
|
+
INSERT INTO [datatypes] ([id], [smallmoney]) VALUES ( 253, 214748.3646 )
|
124
|
+
INSERT INTO [datatypes] ([id], [text]) VALUES ( 271, 'test text' )
|
125
|
+
INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 281, '15:45:00.709714966' ) -- 15:45:00.71
|
126
|
+
INSERT INTO [datatypes] ([id], [time_2]) VALUES ( 282, '04:20:00.288321545' ) -- 04:20:00.29
|
127
|
+
INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 283, '15:45:00.709714966' ) -- 15:45:00.709714900
|
128
|
+
INSERT INTO [datatypes] ([id], [time_7]) VALUES ( 284, '04:20:00.288321545' ) -- 04:20:00.288321500
|
129
|
+
INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 301, 0 )
|
130
|
+
INSERT INTO [datatypes] ([id], [tinyint]) VALUES ( 302, 255 )
|
131
|
+
INSERT INTO [datatypes] ([id], [uniqueidentifier]) VALUES ( 311, NEWID() )
|
132
|
+
INSERT INTO [datatypes] ([id], [varbinary_50]) VALUES ( 321, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
|
133
|
+
INSERT INTO [datatypes] ([id], [varbinary_max]) VALUES ( 331, 0x47494638396101000100910000fffffffffffffe010200000021f904041400ff002c00000000010001000002024401003b )
|
134
|
+
INSERT INTO [datatypes] ([id], [varchar_50]) VALUES ( 341, 'test varchar_50' )
|
135
|
+
INSERT INTO [datatypes] ([id], [varchar_max]) VALUES ( 351, 'test varchar_max' )
|
136
|
+
INSERT INTO [datatypes] ([id], [xml]) VALUES ( 361, '<foo><bar>batz</bar></foo>' )
|
137
|
+
|
138
|
+
SET IDENTITY_INSERT [datatypes] OFF
|
139
|
+
|
140
|
+
|
data/tiny_tds.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require
|
2
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'tiny_tds/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'tiny_tds'
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = 'TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library. Developed for the ActiveRecord SQL Server adapter.'
|
14
14
|
s.files = `git ls-files`.split("\n") + Dir.glob('exe/*')
|
15
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
17
|
s.require_paths = ['lib']
|
18
18
|
s.rdoc_options = ['--charset=UTF-8']
|
19
19
|
s.extensions = ['ext/tiny_tds/extconf.rb']
|
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: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: x64-mingw32
|
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: 2016-
|
13
|
+
date: 2016-10-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mini_portile2
|
@@ -107,7 +107,9 @@ executables:
|
|
107
107
|
extensions: []
|
108
108
|
extra_rdoc_files: []
|
109
109
|
files:
|
110
|
+
- ".codeclimate.yml"
|
110
111
|
- ".gitignore"
|
112
|
+
- ".rubocop.yml"
|
111
113
|
- CHANGELOG
|
112
114
|
- CODE_OF_CONDUCT.md
|
113
115
|
- Gemfile
|
@@ -140,7 +142,7 @@ files:
|
|
140
142
|
- lib/tiny_tds/error.rb
|
141
143
|
- lib/tiny_tds/result.rb
|
142
144
|
- lib/tiny_tds/version.rb
|
143
|
-
- ports/patches/freetds/1.00/0001-mingw_missing_inet_pton.diff
|
145
|
+
- ports/patches/freetds/1.00.15/0001-mingw_missing_inet_pton.diff
|
144
146
|
- ports/x86_64-w64-mingw32/bin/libeay32-1.0.2g-x86_64-w64-mingw32.dll
|
145
147
|
- ports/x86_64-w64-mingw32/bin/libiconv-2.dll
|
146
148
|
- ports/x86_64-w64-mingw32/bin/libsybdb-5.dll
|
@@ -157,6 +159,7 @@ files:
|
|
157
159
|
- test/schema/sqlserver_2005.sql
|
158
160
|
- test/schema/sqlserver_2008.sql
|
159
161
|
- test/schema/sqlserver_2014.sql
|
162
|
+
- test/schema/sqlserver_2016.sql
|
160
163
|
- test/schema/sqlserver_azure.sql
|
161
164
|
- test/schema/sybase_ase.sql
|
162
165
|
- test/schema_test.rb
|