tiny_tds 0.7.0-x64-mingw32 → 0.9.5.beta.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/CHANGELOG +17 -46
- data/Gemfile +4 -0
- data/README.md +20 -14
- data/Rakefile +18 -13
- data/VERSION +1 -0
- data/appveyor.yml +17 -6
- data/bin/tsql +25 -0
- data/exe/.keep +0 -0
- data/ext/tiny_tds/client.c +26 -24
- data/ext/tiny_tds/client.h +1 -0
- data/ext/tiny_tds/extconf.rb +57 -36
- data/ext/tiny_tds/extconsts.rb +14 -0
- data/ext/tiny_tds/result.c +76 -36
- data/ext/tiny_tds/result.h +0 -4
- data/ext/tiny_tds/tiny_tds_ext.h +4 -2
- data/lib/tiny_tds.rb +3 -9
- data/lib/tiny_tds/client.rb +61 -34
- data/lib/tiny_tds/version.rb +1 -1
- data/ports/patches/freetds/0.91.112/Makefile.in.diff +29 -0
- data/ports/patches/freetds/0.91.112/dblib-30-char-username.diff +11 -0
- data/ports/patches/freetds/0.95.75/0001-mingw_missing_inet_pton.diff +34 -0
- data/test/client_test.rb +32 -12
- data/test/result_test.rb +13 -13
- data/test/schema/sqlserver_2000.sql +13 -13
- data/test/schema/sqlserver_2005.sql +13 -13
- data/test/schema/sqlserver_2008.sql +13 -13
- data/test/schema/sqlserver_2014.sql +9 -9
- data/test/schema/sqlserver_azure.sql +13 -13
- data/test/schema/sybase_ase.sql +7 -7
- data/test/schema_test.rb +157 -33
- data/test/test_helper.rb +13 -8
- data/test/thread_test.rb +6 -4
- metadata +21 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2743d7db4471dca5a57977d20b7680feba24519
|
4
|
+
data.tar.gz: 1af67a12a1c32217dd092a39fa561c3f6cbe904e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 166f8faa43a9387c3d732f13be3b3274a5a56335bcf2e90919afba8aabb217ba9d563c618ac4436ad6a10661068c5170b96a6ba5bb5c66f96216cf8fd4aa8c32
|
7
|
+
data.tar.gz: e6afd04c24907adc327158cbea16527a68db6d88b2cac4d59c60136211299025d2e72972db4425494ae1a6143db27d39697ad8292128cff016ebbaf2f24054bc
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,33 +1,39 @@
|
|
1
|
+
* 0.9.5 *
|
2
|
+
|
3
|
+
* Binstub wrappers for `tsql`. Fixes #227 #251
|
4
|
+
* Add support for 2008 data types. Must use TDSVER 7.3 or higher. Fixes #244 #251
|
5
|
+
- [date]
|
6
|
+
- [datetime2]
|
7
|
+
- [datetimeoffset]
|
8
|
+
- [time]
|
9
|
+
* Default FreeTDS to 0.95. Support 0.91 Alternate Fixes #233
|
10
|
+
- Allow our `tds_version` to mirror TDSVER env var. Ex '7.3' vs '73'.
|
11
|
+
- Change error handler for `SYBEICONVO` to hard return INT_CANCEL.
|
12
|
+
* Made sure Azure logins are user@short vs. long domain. Fixes #229
|
13
|
+
* Removed Ruby 1.9.3 from CI builds.
|
14
|
+
* CI now tests Azure too.
|
15
|
+
* Fixed compiler warnings on all platforms. Fixed #241
|
16
|
+
* FreeTDS - Remove support for bad iconv.
|
17
|
+
|
1
18
|
|
2
19
|
* 0.7.0 *
|
3
20
|
|
4
21
|
* Refactor build of FreeTDS & Iconv recipes. Add OpenSSL. Merged #207.
|
5
|
-
|
6
22
|
* Ensure zero terminated strings, where C-str pointers are expected. Use StringValueCStr() Fixes #208.
|
7
|
-
|
8
23
|
* Revert 999fa571 so timeouts do not kill the client. Fixes #179.
|
9
|
-
|
10
24
|
* Remove `sspi_w_kerberos.diff` patch. Not needed anymore.
|
11
|
-
|
12
25
|
* Tested again on Azure. Added notes to README on recommended settings.
|
13
|
-
|
14
26
|
* Replace `rb_thread_blocking_region` (removed in Ruby 2.2.0) w/`rb_thread_call_without_gvl`. Fixes #182.
|
15
|
-
|
16
27
|
* Remove 30 char password warning. Fixes #172.
|
17
|
-
|
18
28
|
* Remove Ruby 1.8.6 support. We always use Time vs edge case DateTime.
|
19
29
|
|
20
30
|
|
21
31
|
* 0.6.2 *
|
22
32
|
|
23
33
|
* Support an optional environment variable to find FreeTDS. Fixes #128.
|
24
|
-
|
25
34
|
* Allow Support for 31+ Character Usernames/Passwords. Fixes #134. Thanks @wbond.
|
26
|
-
|
27
35
|
* Stronger Global VM Lock support for nonblocking connections. Fixes #133. Thanks @wbond.
|
28
|
-
|
29
36
|
* Timeout fix for working with Azure SQL. Fixes #138.
|
30
|
-
|
31
37
|
* Correctly handle requests that return multiple results sets via `.do`, such
|
32
38
|
as backups and restores. Fixes #150.
|
33
39
|
|
@@ -40,29 +46,17 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
40
46
|
* 0.6.0 *
|
41
47
|
|
42
48
|
* Use dbsetversion() vs. dbsetlversion. Fixes #62.
|
43
|
-
|
44
49
|
* Remove Ruby 1.8 support.
|
45
|
-
|
46
50
|
* Implement misc rb_thread_blocking_region support. Fixes #121. Thanks @lepfhty.
|
47
|
-
|
48
51
|
* Test FreeTDS v0.91.89 patch release.
|
49
|
-
|
50
52
|
* Fix lost connection handling. Fixes #124. Thanks @krzcho.
|
51
|
-
|
52
53
|
* Remove unused variable. Fixes #103. Thanks @jeremyevans.
|
53
|
-
|
54
54
|
* Remove need to specify username for Windows Authentication.
|
55
|
-
|
56
55
|
* Use proper SQL for returning IDENTITY with Sybase. Fixes #95.
|
57
|
-
|
58
56
|
* Compile windows with `--enable-sspi`.
|
59
|
-
|
60
57
|
* Allow MiniPortile to build any FreeTDS version we need. Fixes #76.
|
61
|
-
|
62
58
|
* Always convert password option to string. Fixes #92.
|
63
|
-
|
64
59
|
* Move test system to real MiniTest::Spec. All tests pass on Azure too.
|
65
|
-
|
66
60
|
* Raise and handle encoding errors on DB writes. Fixes #89.
|
67
61
|
|
68
62
|
|
@@ -74,33 +68,23 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
74
68
|
* 0.5.0 *
|
75
69
|
|
76
70
|
* Copy mysql2s handling of Time and Datetime so 64bit systems are leveraged. Fixes #46 and #47. Thanks @lsylvester!
|
77
|
-
|
78
71
|
* Add CFLAGS='-fPIC' for libtool. Fix TDS version configs in our ports file. Document. Fixes #45
|
79
|
-
|
80
72
|
* Update our TDS version constants to reflect changed 8.0/9.0 to 7.1/7.2 DBLIB versions in FreeTDS
|
81
73
|
while making it backward compatible, again like FreeTDS. Even tho you can not configure FreeTDS with
|
82
74
|
TDS version 7.2 or technically even use it, I added tests to prove that we correctly handle both
|
83
75
|
varchar(max) and nvarchar(max) with large amounts of data.
|
84
|
-
|
85
76
|
* FreeTDS 0.91 has been released. Update our port scripts.
|
86
|
-
|
87
77
|
* Add test for 0.91 and higher to handle incorrect syntax in sp_executesql.
|
88
|
-
|
89
78
|
* Returning empty result sets with a command batch that has multiple statements is now the default. Use :empty_sets => false to override.
|
90
|
-
|
91
79
|
* Do not raise a TinyTds::Error with our message handler unless the severity is greater than 10.
|
92
80
|
|
93
81
|
|
94
82
|
* 0.4.5 *
|
95
83
|
|
96
84
|
* Includes precompiled Windows binaries for FreeTDS 0.91rc2 & LibIconv. No precompiled OpenSSL yet for Windows to SQL Azure.
|
97
|
-
|
98
85
|
* Fixed symbolized unicode column names.
|
99
|
-
|
100
86
|
* Use same bigint ruby functions to return identity. Hopefully fixes #19.
|
101
|
-
|
102
87
|
* Release static libs for Windows.
|
103
|
-
|
104
88
|
* Change how :host/:port are implemented. Now sending "host:port" to :dataserver.
|
105
89
|
|
106
90
|
|
@@ -112,9 +96,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
112
96
|
* 0.4.3 *
|
113
97
|
|
114
98
|
* New Client#active? method to check for good connection. Always use this abstract method.
|
115
|
-
|
116
99
|
* Better SYBEWRIT "Write to SQL Server failed." error handling. New Client#dead? check.
|
117
|
-
|
118
100
|
* Azure tested using latest FreeTDS with submitted patch. https://gist.github.com/889190
|
119
101
|
|
120
102
|
|
@@ -123,7 +105,6 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
123
105
|
* Iconv is a dep only when compiling locally. However, left in the ability to configure
|
124
106
|
it for native gem installation but you must use
|
125
107
|
--enable-iconv before using --with-iconv-dir=/some/dir
|
126
|
-
|
127
108
|
* Really fix what 0.4.1 was supposed to do, force SYBDBLIB compile.
|
128
109
|
|
129
110
|
|
@@ -135,15 +116,11 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
135
116
|
* 0.4.0 *
|
136
117
|
|
137
118
|
* Allow SYBEICONVI errors to pass thru so that bad data is converted to ? marks.
|
138
|
-
|
139
119
|
* Build native deps using MiniPortile [Luis Lavena]
|
140
|
-
|
141
120
|
* Allow Result#fields to be called before iterating over the results.
|
142
|
-
|
143
121
|
* Two new client helper methods, #sqlsent? and #canceled?. Possible to use these to determine current
|
144
122
|
state of the client and the need to use Result#cancel to stop processing active results. It is also
|
145
123
|
safe to call Result#cancel over and over again.
|
146
|
-
|
147
124
|
* Look for the syb headers only.
|
148
125
|
|
149
126
|
|
@@ -160,9 +137,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
160
137
|
* 0.3.0 *
|
161
138
|
|
162
139
|
* Access stored procedure return codes.
|
163
|
-
|
164
140
|
* Make sure dead or not enabled connections are handled.
|
165
|
-
|
166
141
|
* Fix bad client after timeout & read from server errors.
|
167
142
|
|
168
143
|
|
@@ -185,13 +160,9 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
|
|
185
160
|
* 0.2.0 *
|
186
161
|
|
187
162
|
* Convert GUID's in a more compatible way. [Klaus Gundermann]
|
188
|
-
|
189
163
|
* Handle multiple result sets in command buffer or stored procs. [Ken Collins]
|
190
|
-
|
191
164
|
* Fixed some compiler warnings. [Erik Bryn]
|
192
|
-
|
193
165
|
* Avoid segfault related to smalldatetime conversion. [Erik Bryn]
|
194
|
-
|
195
166
|
* Properly encode column names in 1.9. [Erik Bryn]
|
196
167
|
|
197
168
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.
|
2
2
|
|
3
|
-
[![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) [![Gem Version](https://img.shields.io/badge/gem-v0.7.0-blue.svg)](https://rubygems.org/gems/tiny_tds)
|
4
|
-
|
3
|
+
[![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) [![Gem Version](https://img.shields.io/badge/gem-v0.7.0-blue.svg)](https://rubygems.org/gems/tiny_tds) [![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)
|
5
4
|
|
6
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.
|
7
6
|
|
@@ -16,7 +15,7 @@ The API is simple and consists of these classes:
|
|
16
15
|
|
17
16
|
## Install
|
18
17
|
|
19
|
-
Installing with rubygems should just work. TinyTDS is currently tested on Ruby version
|
18
|
+
Installing with rubygems should just work. TinyTDS is currently tested on Ruby version 2.0.0 and upward.
|
20
19
|
|
21
20
|
```
|
22
21
|
$ gem install tiny_tds
|
@@ -44,7 +43,7 @@ If you use Windows, we pre-compile TinyTDS with static versions of FreeTDS, libi
|
|
44
43
|
|
45
44
|
## FreeTDS Compatibility & Configuration
|
46
45
|
|
47
|
-
TinyTDS is developed against FreeTDS 0.
|
46
|
+
TinyTDS is developed against FreeTDS 0.91, 0.95, and 0.99 current. Our default and recommended is 0.95. We also test with SQL Server 2008, 2014, and Azure. However, usage of TinyTDS with SQL Server 2000 or 2005 should be just fine. Below are a few QA style notes about installing FreeTDS.
|
48
47
|
|
49
48
|
**NOTE:** Windows users of our pre-compiled native gems need not worry about installing FreeTDS and its dependencies.
|
50
49
|
|
@@ -52,18 +51,20 @@ TinyTDS is developed against FreeTDS 0.82, 0.91 stable, and 0.92 current. Our de
|
|
52
51
|
|
53
52
|
* **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.
|
54
53
|
|
55
|
-
* **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have too. 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,
|
54
|
+
* **Do I need to configure `--with-tdsver` equal to anything?** Most likely! Technically you should not have too. 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.
|
56
55
|
|
57
56
|
* **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
|
58
57
|
|
59
|
-
* **I want to configure FreeTDS using `--enable-msdblib` and/or `--enable-sybase-compat` so it works for my database. Cool?** It's a waste of time and totally moot! Client libraries like TinyTDS define their own C structure names where they diverge from Sybase to SQL Server. Technically we use the
|
58
|
+
* **I want to configure FreeTDS using `--enable-msdblib` and/or `--enable-sybase-compat` so it works for my database. Cool?** It's a waste of time and totally moot! Client libraries like TinyTDS define their own C structure names where they diverge from Sybase to SQL Server. Technically we use the MSDBLIB structures which does not mean we only work with that database vs Sybase. These configs are just a low level default for C libraries that do not define what they want. So I repeat, you do not NEED to use any of these, nor will they hurt anything since we control what C structure names we use internally!
|
60
59
|
|
61
60
|
|
62
61
|
## Data Types
|
63
62
|
|
64
|
-
Our goal is to support every SQL Server data type and covert it to a logical Ruby object. When dates or times are returned, they are instantiated to either `:utc` or `:local` time depending on the query options. All strings are associated the to the connection's encoding and all binary data types are associated to Ruby's `ASCII-8BIT/BINARY` encoding.
|
63
|
+
Our goal is to support every SQL Server data type and covert it to a logical Ruby object. When dates or times are returned, they are instantiated to either `:utc` or `:local` time depending on the query options. Only [datetimeoffset] types are excluded. All strings are associated the to the connection's encoding and all binary data types are associated to Ruby's `ASCII-8BIT/BINARY` encoding.
|
64
|
+
|
65
|
+
Below is a list of the data types we support when using the 7.3 TDS protocol version. You must be using the latest FreeTDS v0.95.74 or higher.
|
65
66
|
|
66
|
-
|
67
|
+
Using a lower protocol version will result in these types being returned as strings.
|
67
68
|
|
68
69
|
* [date]
|
69
70
|
* [datetime2]
|
@@ -88,7 +89,7 @@ Creating a new client takes a hash of options. For valid iconv encoding options,
|
|
88
89
|
* :port - Defaults to 1433. Only used if :host is used.
|
89
90
|
* :database - The default database to use.
|
90
91
|
* :appname - Short string seen in SQL Servers process/activity window.
|
91
|
-
* :tds_version - TDS version. Defaults to "
|
92
|
+
* :tds_version - TDS version. Defaults to "7.3" for FreeTDS 0.95 usage. Please set to "7.1" for FreeTDS 0.91.
|
92
93
|
* :login_timeout - Seconds to wait for login. Default to 60 seconds.
|
93
94
|
* :timeout - Seconds to wait for a response to a SQL command. Default 5 seconds.
|
94
95
|
* :encoding - Any valid iconv value like CP1251 or ISO-8859-1. Default UTF-8.
|
@@ -279,6 +280,13 @@ By default row caching is turned on because the SQL Server adapter for ActiveRec
|
|
279
280
|
TinyTDS takes an opinionated stance on how we handle encoding errors. First, we treat errors differently on reads vs. writes. Our opinion is that if you are reading bad data due to your client's encoding option, you would rather just find `?` marks in your strings vs being blocked with exceptions. This is how things wold work via ODBC or SMS. On the other hand, writes will raise an exception. In this case we raise the SYBEICONVO/2402 error message which has a description of `Error converting characters into server's character set. Some character(s) could not be converted.`. Even though the severity of this message is only a `4` and TinyTDS will automatically strip/ignore unknown characters, we feel you should know that you are inserting bad encodings. In this way, a transaction can be rolled back, etc. Remember, any database write that has bad characters due to the client encoding will still be written to the database, but it is up to you rollback said write if needed. Most ORMs like ActiveRecord handle this scenario just fine.
|
280
281
|
|
281
282
|
|
283
|
+
## Binstubs
|
284
|
+
|
285
|
+
The TinyTDS gem uses binstub wrappers which mirror compiled [FreeTDS Utilities](http://www.freetds.org/userguide/usefreetds.htm) binaries. These native executables are usually installed at the system level when installing FreeTDS. However, when using MiniPortile to install TinyTDS as we do with Windows binaries, these binstubs will find and prefer local gem `exe` directory executables. These are the following binstubs we wrap.
|
286
|
+
|
287
|
+
* tsql - Used to test connections and debug compile time settings.
|
288
|
+
|
289
|
+
|
282
290
|
## Using TinyTDS With Rails & The ActiveRecord SQL Server adapter.
|
283
291
|
|
284
292
|
TinyTDS is the default connection mode for the SQL Server adapter in versions 3.1 or higher. The SQL Server adapter can be found using the links below.
|
@@ -288,7 +296,7 @@ TinyTDS is the default connection mode for the SQL Server adapter in versions 3.
|
|
288
296
|
|
289
297
|
## Using TinyTDS with Azure
|
290
298
|
|
291
|
-
TinyTDS is fully tested with the Azure platform. You must set the `azure: true` connection option when connecting. This is needed to specify the default database name in the login packet since Azure has no notion of `USE [database]`.
|
299
|
+
TinyTDS is fully tested with the Azure platform. You must set the `azure: true` connection option when connecting. This is needed to specify the default database name in the login packet since Azure has no notion of `USE [database]`. FreeTDS must be compiled with OpenSSL too.
|
292
300
|
|
293
301
|
**IMPORTANT**: Do not use `username@server.database.windows.net` for the username connection option! You must use the shorter `username@server` instead!
|
294
302
|
|
@@ -314,9 +322,7 @@ MiniPortile is a minimalistic implementation of a port/recipe system. <https://g
|
|
314
322
|
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.
|
315
323
|
|
316
324
|
```
|
317
|
-
$ rake TINYTDS_FREETDS_VERSION='0.
|
318
|
-
$ rake TINYTDS_FREETDS_VERSION='0.91' -- --disable-system-freetds --disable-system-iconv
|
319
|
-
$ rake TINYTDS_FREETDS_VERSION='0.92' -- --disable-system-freetds --disable-system-iconv
|
325
|
+
$ rake TDSVER='7.1' TINYTDS_FREETDS_VERSION='0.91.112' -- --disable-system-freetds --disable-system-iconv
|
320
326
|
```
|
321
327
|
|
322
328
|
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.
|
@@ -324,7 +330,7 @@ To find out more about the FreeTDS release system [visit this thread](http://lis
|
|
324
330
|
|
325
331
|
## Compiling Gems for Windows
|
326
332
|
|
327
|
-
For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby
|
333
|
+
For the convenience of Windows users, TinyTDS ships pre-compiled gems for Ruby 2.0, 2.1 and 2.2 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.
|
328
334
|
|
329
335
|
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:
|
330
336
|
|
data/Rakefile
CHANGED
@@ -5,6 +5,7 @@ require 'rbconfig'
|
|
5
5
|
require 'rake/testtask'
|
6
6
|
require 'rake/extensiontask'
|
7
7
|
require 'rubygems/package_task'
|
8
|
+
require_relative './ext/tiny_tds/extconsts'
|
8
9
|
|
9
10
|
def test_libs
|
10
11
|
['lib','test']
|
@@ -31,7 +32,6 @@ def gem_build_path(spec)
|
|
31
32
|
File.join 'pkg', spec.full_name
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
35
|
gemspec = Gem::Specification::load(File.expand_path('../tiny_tds.gemspec', __FILE__))
|
36
36
|
|
37
37
|
Rake::TestTask.new do |t|
|
@@ -48,6 +48,7 @@ end
|
|
48
48
|
task :compile
|
49
49
|
|
50
50
|
task :build => [:clean, :compile]
|
51
|
+
task(:build_quietly) { capture_stds { Rake::Task[:build].invoke } }
|
51
52
|
|
52
53
|
task :default => [:build, :test]
|
53
54
|
|
@@ -58,47 +59,51 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
|
|
58
59
|
ext.cross_compile = true
|
59
60
|
ext.cross_platform = ['x86-mingw32', 'x64-mingw32']
|
60
61
|
ext.cross_config_options += %w[ --disable-lookup --enable-cross-build ]
|
61
|
-
|
62
62
|
# Add dependent DLLs to the cross gems
|
63
63
|
ext.cross_compiling do |spec|
|
64
64
|
platform_host_map = {
|
65
65
|
'x86-mingw32' => 'i686-w64-mingw32',
|
66
66
|
'x64-mingw32' => 'x86_64-w64-mingw32'
|
67
67
|
}
|
68
|
-
|
69
68
|
gemplat = spec.platform.to_s
|
70
69
|
host = platform_host_map[gemplat]
|
71
|
-
|
72
70
|
dlls = [
|
73
|
-
"libeay32-1.0.
|
74
|
-
"ssleay32-1.0.
|
71
|
+
"libeay32-1.0.2e-#{host}.dll",
|
72
|
+
"ssleay32-1.0.2e-#{host}.dll",
|
75
73
|
"libiconv-2.dll",
|
76
74
|
"libsybdb-5.dll",
|
77
75
|
]
|
78
|
-
|
79
76
|
# We don't need the sources in a fat binary gem
|
80
77
|
spec.files = spec.files.reject{|f| f=~/^ports\/archives/ }
|
81
78
|
spec.files += dlls.map{|dll| "ports/#{host}/bin/#{File.basename(dll)}" }
|
82
|
-
|
83
79
|
dlls.each do |dll|
|
84
80
|
file "ports/#{host}/bin/#{dll}" do |t|
|
85
81
|
sh "x86_64-w64-mingw32-strip", t.name
|
86
82
|
end
|
87
83
|
end
|
88
84
|
end
|
89
|
-
|
90
85
|
end
|
91
86
|
|
92
|
-
# Bundle the freetds sources to avoid download while gem install
|
87
|
+
# Bundle the freetds sources to avoid download while gem install.
|
93
88
|
task gem_build_path(gemspec) do
|
94
|
-
add_file_to_gem
|
89
|
+
add_file_to_gem gemspec, "ports/archives/freetds-#{FREETDS_VERSION}.tar.bz2"
|
95
90
|
end
|
96
91
|
|
97
92
|
desc "Build the windows binary gems per rake-compiler-dock"
|
98
93
|
task 'gem:windows' do
|
99
94
|
require 'rake_compiler_dock'
|
100
95
|
RakeCompilerDock.sh <<-EOT
|
101
|
-
|
102
|
-
rake cross native gem RUBY_CC_VERSION=1.9.3:2.0.0:2.1.6:2.2.2
|
96
|
+
bundle && rake cross native gem RUBY_CC_VERSION=2.0.0:2.1.6:2.2.2 CFLAGS="-Wall"
|
103
97
|
EOT
|
104
98
|
end
|
99
|
+
|
100
|
+
def capture_stds
|
101
|
+
pstdout, $stdout = $stdout, StringIO.new
|
102
|
+
pstderr, $stderr = $stderr, StringIO.new
|
103
|
+
yield
|
104
|
+
$stdout.string
|
105
|
+
$stderr.string
|
106
|
+
ensure
|
107
|
+
$stdout = pstdout
|
108
|
+
$stderr = pstderr
|
109
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.9.5.beta.1
|
data/appveyor.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
version: 0.7.0.{build}
|
2
1
|
init:
|
3
2
|
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
|
4
3
|
- SET PATH=C:\MinGW\msys\1.0\bin;%PATH%
|
@@ -8,11 +7,15 @@ skip_tags: true
|
|
8
7
|
matrix:
|
9
8
|
fast_finish: true
|
10
9
|
install:
|
10
|
+
- ps: Update-AppveyorBuild -Version "$(Get-Content $env:appveyor_build_folder\VERSION).$env:appveyor_build_number"
|
11
11
|
- ruby --version
|
12
12
|
- gem --version
|
13
13
|
- bundle install
|
14
14
|
- bundle exec rake build
|
15
15
|
build: off
|
16
|
+
branches:
|
17
|
+
except:
|
18
|
+
- /dev.*/
|
16
19
|
test_script:
|
17
20
|
- timeout /t 4 /nobreak > NUL
|
18
21
|
- powershell -File "%APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.ps1"
|
@@ -21,6 +24,7 @@ test_script:
|
|
21
24
|
- timeout /t 4 /nobreak > NUL
|
22
25
|
- sqlcmd -S ".\SQL2014" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
23
26
|
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014
|
27
|
+
- bundle exec rake TINYTDS_UNIT_HOST_TEST=localhost TINYTDS_UNIT_DATASERVER="localhost\SQL2014" TINYTDS_SCHEMA=sqlserver_2014 TDSVER=7.3
|
24
28
|
- ps: Stop-Service 'MSSQL$SQL2014'
|
25
29
|
- ps: Start-Service 'MSSQL$SQL2012SP1'
|
26
30
|
- timeout /t 4 /nobreak > NUL
|
@@ -31,12 +35,19 @@ test_script:
|
|
31
35
|
- timeout /t 4 /nobreak > NUL
|
32
36
|
- sqlcmd -S ".\SQL2008R2SP2" -U sa -P Password12! -i %APPVEYOR_BUILD_FOLDER%\test\appveyor\dbsetup.sql
|
33
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
|
+
- bundle exec rake TINYTDS_UNIT_HOST_TEST=%CI_AZURE_HOST% TINYTDS_UNIT_HOST=%CI_AZURE_HOST% TINYTDS_SCHEMA=sqlserver_azure TDSVER=7.3
|
34
41
|
environment:
|
42
|
+
CI_AZURE_HOST:
|
43
|
+
secure: b7kG0e0O6hPi/7niF3YTGih1WtdO/dmuyg0k+Le+zEE=
|
44
|
+
TINYTDS_UNIT_AZURE_USER:
|
45
|
+
secure: Clk9RCYMZ0vz0IfMMnOtJW/ufcCKW3nQC3BgCipdM+c=
|
46
|
+
TINYTDS_UNIT_AZURE_PASS:
|
47
|
+
secure: D3vsNNzv/Th+RqMNrm3WJw==
|
35
48
|
matrix:
|
36
|
-
- ruby_version: "193"
|
37
49
|
- ruby_version: "200"
|
38
|
-
- ruby_version: "200-x64"
|
39
|
-
- ruby_version: "21"
|
40
|
-
- ruby_version: "21-x64"
|
41
|
-
- ruby_version: "22"
|
42
50
|
- ruby_version: "22-x64"
|
51
|
+
on_failure:
|
52
|
+
- find -name compile.log | xargs cat
|
53
|
+
|
data/bin/tsql
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
BIN = 'tsql'
|
4
|
+
ROOT = File.expand_path(File.join File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__), '..')
|
5
|
+
PATHS = ENV['PATH'].split(File::PATH_SEPARATOR)
|
6
|
+
EXTS = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
7
|
+
SELF = File.join ROOT, 'bin', BIN
|
8
|
+
EXE = File.join ROOT, 'exe', BIN
|
9
|
+
|
10
|
+
def which(cmd)
|
11
|
+
PATHS.each do |path|
|
12
|
+
EXTS.each do |ext|
|
13
|
+
exe = File.expand_path File.join(path, "#{cmd}#{ext}"), ROOT
|
14
|
+
next unless File.executable?(exe)
|
15
|
+
next if exe == SELF
|
16
|
+
return exe
|
17
|
+
end
|
18
|
+
end
|
19
|
+
return nil
|
20
|
+
end
|
21
|
+
|
22
|
+
bin = File.exists?(EXE) ? EXE : which(BIN)
|
23
|
+
puts "[TinyTds] #{BIN}: #{bin}"
|
24
|
+
|
25
|
+
Kernel.system bin, *ARGV
|