tiny_tds 1.3.0 → 2.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 126725d886a1a81e1fbc82f80e5a98681899c7dd
4
- data.tar.gz: be121db76ba53eab2d071cd4f506b0f6d5fb5b89
3
+ metadata.gz: ef1ef42e0624ba432750427074d15e225b09a663
4
+ data.tar.gz: af92945285fa1c1890f247c5a991d8e1c35de9c1
5
5
  SHA512:
6
- metadata.gz: adb6481507c55391d4a634d61487399b00c60342746f6551e22407e777d46fa86f50b26bb3764427e953350bfd3c4e48c4c0a43a278228fe9934e87ad497e3de
7
- data.tar.gz: c800ea48a635f643530bd4841dbd2940b1d98ccd479f269e1b8985f799b2f705b75e9ea4c6d6faf82fe5b6945e41430b2e1eb259e2a0b2b77c23740c09449732
6
+ metadata.gz: 83aad0111c02fd086342b5a49ca8c847e5b1b1c3c4c70cadd8795376e9a979f5ee30de304738499f507a2884001d9387b960e2b9da0e48495a25c7851bf07ff4
7
+ data.tar.gz: 2ecefe695f60805df93f52d4ba6f70bba170bc7c85dfd66a8416d68c7b13bc32df8c1a0eb829b845e9f2679130434073f70d7d8931f7b0bb02c9f4bd4bd2b719
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ services:
4
4
  - docker
5
5
  env:
6
6
  global:
7
+ - PATH=/opt/local/bin:$PATH
7
8
  - TESTOPTS="-v"
8
9
  - TINYTDS_UNIT_HOST=localhost
9
10
  rvm:
@@ -11,15 +12,11 @@ rvm:
11
12
  - 2.2.5
12
13
  - 2.3.1
13
14
  before_install:
14
- - export PATH=/opt/local/bin:$PATH
15
15
  - docker info
16
- - sudo ./test/bin/setup.sh
17
16
  - sudo ./test/bin/install-openssl.sh
18
- - openssl version
19
17
  - sudo ./test/bin/install-freetds.sh
20
- - tsql -C
18
+ - sudo ./test/bin/setup.sh
21
19
  install:
22
- - export PATH=/opt/local/bin:$PATH
23
20
  - gem install bundler
24
21
  - bundle --version
25
22
  - bundle install
data/BACKERS.md ADDED
@@ -0,0 +1,32 @@
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/Gemfile CHANGED
@@ -3,5 +3,8 @@ gemspec
3
3
 
4
4
  group :development do
5
5
  gem 'rake-compiler-dock', github: 'rake-compiler/rake-compiler-dock'
6
- gem 'byebug'
6
+ end
7
+
8
+ group :test do
9
+ gem 'minitest'
7
10
  end
data/README.md CHANGED
@@ -8,6 +8,13 @@
8
8
  * [![Dependency Status](https://dependencyci.com/github/rails-sqlserver/tiny_tds/badge)](https://dependencyci.com/github/rails-sqlserver/tiny_tds) - Dependency Status
9
9
  * [![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
10
 
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
+
16
+ ## About TinyTDS
17
+
11
18
  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.
12
19
 
13
20
  TinyTDS offers automatic casting to Ruby primitives along with proper encoding support. It converts all SQL Server datatypes to native Ruby primitives while supporting :utc or :local time zones for time-like types. To date it is the only Ruby client library that allows client encoding options, defaulting to UTF-8, while connecting to SQL Server. It also properly encodes all string and binary data. The motivation for TinyTDS is to become the de-facto low level connection mode for the SQL Server Adapter for ActiveRecord.
@@ -45,21 +52,18 @@ $ make install
45
52
  If none exist, our native extension will use MiniPortile to install any missing dependencies listed above for your specific platform. These dependencies will be built and linked within the installed TinyTDS gem. Please read the MiniPortile and/or Windows sections at the end of this file for advanced configuration options past the following:
46
53
 
47
54
  ```
48
- --enable-system-freetds / --disable-system-freetds
49
- --enable-system-iconv / --disable-system-iconv
50
- --enable-system-openssl / --disable-system-openssl
51
- Force use of system or builtin freetds/iconv/openssl library.
52
- Default is to prefer system libraries and fallback to builtin.
53
-
54
55
  --with-freetds-dir=DIR
55
56
  Use the freetds library placed under DIR.
57
+ ```
56
58
 
57
- --enable-lookup
58
- Search for freetds through all paths in the PATH environment variable.
59
59
 
60
- --enable-cross-build
61
- Do cross-build.
62
- ```
60
+ ## Getting Started
61
+
62
+ Optionally, Microsoft has done a great job writing some articles on how to get started with SQL Server and Ruby using TinyTDS. Please checkout one of the following posts that match your platform.
63
+
64
+ * [SQL Server on a Mac](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/mac)
65
+ * [SQL Server on RHEL](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/rhel)
66
+ * [SQL Server on Ubuntu](https://www.microsoft.com/en-us/sql-server/developer-get-started/ruby/ubuntu)
63
67
 
64
68
 
65
69
  ## FreeTDS Compatibility & Configuration
@@ -387,19 +391,6 @@ This is possible using FreeTDS version 0.95 or higher. You must use the `use_utf
387
391
  The default is true and since FreeTDS v1.0 would do this as well.
388
392
 
389
393
 
390
- ## Using MiniPortile
391
-
392
- MiniPortile is a minimalistic implementation of a port/recipe system. <https://github.com/luislavena/mini_portile>
393
-
394
- The TinyTDS project uses MiniPortile so that we can easily install a local version of FreeTDS and supporting libraries to link against when building a test version of TinyTDS. This same system is also used when installing TinyTDS with Rubygems and building native extensions. It is possible to build TinyTDS with a specific version of FreeTDS using the `TINYTDS_FREETDS_VERSION` environment variable. Here are some exampbles of possible values.
395
-
396
- ```
397
- $ rake TDSVER='7.1' TINYTDS_FREETDS_VERSION='0.95' -- --disable-system-freetds --disable-system-iconv
398
- ```
399
-
400
- To find out more about the FreeTDS release system [visit this thread](http://lists.ibiblio.org/pipermail/freetds/2012q1/027756.html) on their mailing list. You can also browse thier FTP server [ftp://ftp.astron.com/pub/freetds/](ftp://ftp.astron.com/pub/freetds/) for version number strings.
401
-
402
-
403
394
  ## Compiling Gems for Windows
404
395
 
405
396
  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.
@@ -447,13 +438,20 @@ CREATE USER [tinytds] FOR LOGIN [tinytds];
447
438
  EXEC sp_addrolemember N'db_owner', N'tinytds';
448
439
  ```
449
440
 
450
- From here you can now run the tests. This assumes you have both Ruby & the needed FreeTDS installed.
441
+ From here you can build and run tests against an installed version of FreeTDS.
451
442
 
452
443
  ```shell
453
444
  $ bundle install
454
445
  $ bundle exec rake
455
446
  ```
456
447
 
448
+ If you don't have FreeTDS installed on your system you can let the MiniPortile build tasks build and link all the dependencies for you.
449
+ ```shell
450
+ $ bundle install
451
+ $ bundle exec rake ports build
452
+ $ bundle exec rake ports test
453
+ ```
454
+
457
455
  Examples us using enviornment variables to customize the test task.
458
456
 
459
457
  ```
@@ -463,13 +461,6 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
463
461
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=sybase_ase
464
462
  ```
465
463
 
466
- If you do not want to use MiniPortile to compile a local project version of FreeTDS and instead use your local system version, use the `TINYTDS_SKIP_PORTS` environment variable. This will ignore any port tasks and will instead build and link to your system's FreeTDS installation as a normal gem install would.
467
-
468
- ```
469
- $ rake TINYTDS_SKIP_PORTS=1
470
- ```
471
-
472
-
473
464
  ## Help & Support
474
465
 
475
466
  * Github Source: http://github.com/rails-sqlserver/tiny_tds
data/Rakefile CHANGED
@@ -1,107 +1,50 @@
1
1
  # encoding: UTF-8
2
+ require 'rbconfig'
2
3
  require 'rake'
3
4
  require 'rake/clean'
4
- require 'rbconfig'
5
- require 'rake/testtask'
6
5
  require 'rake/extensiontask'
7
- require 'rubygems/package_task'
8
6
  require_relative './ext/tiny_tds/extconsts'
9
7
 
10
- def test_libs
11
- %w(lib test)
12
- end
13
-
14
- def test_files
15
- if ENV['TEST_FILES']
16
- ENV['TEST_FILES'].split(',').map(&:strip).sort
17
- else
18
- Dir.glob('test/**/*_test.rb').sort
19
- end
20
- end
21
-
22
- def add_file_to_gem(spec, relative_path)
23
- target_path = File.join gem_build_path(spec), relative_path
24
- target_dir = File.dirname(target_path)
25
- mkdir_p target_dir
26
- rm_f target_path
27
- safe_ln relative_path, target_path
28
- spec.files += [relative_path]
29
- end
30
-
31
- def gem_build_path(spec)
32
- File.join 'pkg', spec.full_name
33
- end
34
-
35
- gemspec = Gem::Specification.load(File.expand_path('../tiny_tds.gemspec', __FILE__))
36
-
37
- Rake::TestTask.new do |t|
38
- t.libs = test_libs
39
- t.test_files = test_files
40
- t.verbose = true
41
- end
42
-
43
- Gem::PackageTask.new(gemspec) do |pkg|
44
- pkg.need_tar = false
45
- pkg.need_zip = false
46
- end
47
-
48
- task :compile
8
+ SPEC = Gem::Specification.load(File.expand_path('../tiny_tds.gemspec', __FILE__))
9
+ GEM_PLATFORM_HOSTS = {
10
+ 'x86-mingw32' => 'i686-w64-mingw32',
11
+ 'x64-mingw32' => 'x86_64-w64-mingw32'
12
+ }
49
13
 
50
- task build: [:clean, :compile]
51
- task(:build_quietly) { capture_stds { Rake::Task[:build].invoke } }
14
+ # Add our project specific files to clean for a rebuild
15
+ CLEAN.include FileList["{ext,lib}/**/*.{so,#{RbConfig::CONFIG['DLEXT']},o}"],
16
+ FileList["exe/*"]
52
17
 
53
- task default: [:build, :test]
18
+ # Clobber all our temp files and ports files including .install files
19
+ # and archives
20
+ CLOBBER.include FileList["tmp/**/*"],
21
+ FileList["ports/**/*"].exclude(%r{^ports/archives})
54
22
 
55
23
  Dir['tasks/*.rake'].sort.each { |f| load f }
56
24
 
57
- Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
25
+ Rake::ExtensionTask.new('tiny_tds', SPEC) do |ext|
58
26
  ext.lib_dir = 'lib/tiny_tds'
59
27
  ext.cross_compile = true
60
- ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
61
- ext.cross_config_options += %w(--disable-lookup --enable-cross-build)
28
+ ext.cross_platform = GEM_PLATFORM_HOSTS.keys
29
+
62
30
  # Add dependent DLLs to the cross gems
63
31
  ext.cross_compiling do |spec|
64
- platform_host_map = {
65
- 'x86-mingw32' => 'i686-w64-mingw32',
66
- 'x64-mingw32' => 'x86_64-w64-mingw32'
67
- }
32
+ platform_host_map = GEM_PLATFORM_HOSTS
68
33
  gemplat = spec.platform.to_s
69
34
  host = platform_host_map[gemplat]
70
- dlls = [
71
- "libcrypto32-#{OPENSSL_VERSION}-#{host}.dll",
72
- "libssl32-#{OPENSSL_VERSION}-#{host}.dll",
73
- 'libiconv-2.dll',
74
- 'libsybdb-5.dll'
75
- ]
35
+
76
36
  # We don't need the sources in a fat binary gem
77
37
  spec.files = spec.files.reject { |f| f =~ %r{^ports\/archives/} }
78
- spec.files += dlls.map { |dll| "ports/#{host}/bin/#{File.basename(dll)}" }
38
+
39
+ # Make sure to include the ports binaries and libraries
40
+ spec.files += FileList["ports/#{host}/**/**/{bin,lib}/*"].exclude do |f|
41
+ File.directory? f
42
+ end
43
+
79
44
  spec.files += Dir.glob('exe/*')
80
45
  end
81
46
  end
82
47
 
83
- # Bundle the freetds sources to avoid download while gem install.
84
- task gem_build_path(gemspec) do
85
- add_file_to_gem gemspec, "ports/archives/freetds-#{FREETDS_VERSION}.tar.bz2"
86
- end
87
-
88
- desc 'Build the windows binary gems per rake-compiler-dock'
89
- task 'gem:windows' do
90
- require 'rake_compiler_dock'
91
- RakeCompilerDock.sh <<-EOT
92
- bundle && rake cross native gem RUBY_CC_VERSION=2.4.0:2.3.0:2.2.2:2.1.6:2.0.0 CFLAGS="-Wall"
93
- EOT
94
- end
48
+ task build: [:clean, :compile]
49
+ task default: [:build, :test]
95
50
 
96
- def capture_stds
97
- pstdout = $stdout
98
- $stdout = StringIO.new
99
- pstderr = $stderr
100
- $stderr = StringIO.new
101
- yield
102
- $stdout.string
103
- $stderr.string
104
- ensure
105
- $stdout = pstdout
106
- $stderr = pstderr
107
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0
1
+ 2.0.0.pre1
data/appveyor.yml CHANGED
@@ -9,12 +9,15 @@ skip_branch_with_pr: true
9
9
  matrix:
10
10
  fast_finish: true
11
11
  install:
12
+ # Output debugging info
12
13
  - ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
13
14
  - perl --version
14
15
  - ruby --version
15
16
  - gem --version
17
+
18
+ # Set up project prerequisits
16
19
  - bundle install
17
- - bundle exec rake build
20
+ - bundle exec rake ports
18
21
  build: off
19
22
  branches:
20
23
  except:
@@ -26,13 +29,13 @@ test_script:
26
29
  - ps: Start-Service 'MSSQL$SQL2014'
27
30
  - timeout /t 4 /nobreak > NUL
28
31
  - sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
29
- - bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014 TDSVER=7.1
30
- - bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014
32
+ - bundle exec rake ports build test TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014 TDSVER=7.1
33
+ - bundle exec rake ports build test TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014
31
34
  - ps: Stop-Service 'MSSQL$SQL2014'
32
35
  - ps: Start-Service 'MSSQL$SQL2012SP1'
33
36
  - timeout /t 4 /nobreak > NUL
34
37
  - sqlcmd -S ".\SQL2012SP1" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
35
- - bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2012SP1" TINYTDS_SCHEMA=sqlserver_2014
38
+ - bundle exec rake ports build test TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2012SP1" TINYTDS_SCHEMA=sqlserver_2014
36
39
  environment:
37
40
  CI_AZURE_HOST:
38
41
  secure: 8ydpYysZYKEBKvp6plKlYfepH98/zAuT27FFCaJ9Sss=
data/circle.yml CHANGED
@@ -13,13 +13,11 @@ machine:
13
13
 
14
14
  dependencies:
15
15
  override:
16
+ - sudo ./test/bin/install-openssl.sh
17
+ - sudo ./test/bin/install-freetds.sh
16
18
  - rvm-exec 2.1.9 bundle install
17
19
  - rvm-exec 2.2.5 bundle install
18
20
  - rvm-exec 2.3.1 bundle install
19
- - sudo ./test/bin/install-openssl.sh
20
- - openssl version
21
- - sudo ./test/bin/install-freetds.sh
22
- - tsql -C
23
21
 
24
22
  database:
25
23
  post: