tiny_tds 0.6.2 → 0.6.3.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- Mzk0MTAzZTg1NTc3NTVjODlkZDg1ZmI5YzA1OWFlMzNhOTIzYzBmYQ==
5
- data.tar.gz: !binary |-
6
- MDlkMTUxMjVjNmM0ZjMxMDJmZjE2YmE1MTExYzY1MDA4NDAzZTJhMQ==
2
+ SHA1:
3
+ metadata.gz: 74cf755ff3bd0cfe314ff8df7630ff974787c009
4
+ data.tar.gz: 25bab39df87ed93bbbc708e0ae7eae13c032396d
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTZkZGQ5ZDg1MzA5YzFiN2QxMmIxOGEyNGZhZmIzODI5YjM5MDA1NGM4Yjhi
10
- MGM4MzE0OGZlODE4NzIxZjMzMmE0Njc1ZjBiNzczZDI5MjJmMGMxMzdmODFk
11
- NzNkYWJlOGFhMjE0ZGQxYTlmZDExN2UxNTVkMzllNmRkYjAwMjA=
12
- data.tar.gz: !binary |-
13
- YWZjYmU0NzQxYzIxMTlkZjJkNjNkNTYyNzU1NTk3ZjYxNmIyNTI0YzZkZGE0
14
- ZmQ1ZGZmZDNmODA0NTFlMDQyZGUxMWFiYjJjNTAzYzMwNWY1ZDhhZWNkNTI5
15
- NjY5NGZlYmE5NTFhMTc4NmM5YzJkNDViMjYyNmU4NjYwNTJiMDA=
6
+ metadata.gz: 2cff679d4e28c193b6e1eb3228039c7175ba72dd531f4bc78c2f71ff94c117dd873c8b7a512ac7a07f13360ae43053748cfe1b4c35789ccefc8812f903b9014b
7
+ data.tar.gz: af9e12104d0bcbd6c6a9e603452db52727186fa7d15d6c8b0b7e900a44cc2858767b087e04af8117d3f886de9e996b3ee10cda1d8d070c916b1972c4a0befa8d
data/CHANGELOG CHANGED
@@ -1,4 +1,17 @@
1
1
 
2
+ * 0.6.3.rc1 *
3
+
4
+ * Remove `sspi_w_kerberos.diff` patch. Not needed anymore.
5
+
6
+ * Tested again on Azure. Added notes to README on recommended settings.
7
+
8
+ * Replace `rb_thread_blocking_region` (removed in Ruby 2.2.0) w/`rb_thread_call_without_gvl`. Fixes #182.
9
+
10
+ * Remove 30 char password warning. Fixes #172.
11
+
12
+ * Remove Ruby 1.8.6 support. We always use Time vs edge case DateTime.
13
+
14
+
2
15
  * 0.6.2 *
3
16
 
4
17
  * Support an optional environment variable to find FreeTDS. Fixes #128.
@@ -58,7 +71,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
58
71
 
59
72
  * Add CFLAGS='-fPIC' for libtool. Fix TDS version configs in our ports file. Document. Fixes #45
60
73
 
61
- * Update our TDS version constants to reflect changed 8.0/9.0 to 7.1/7.2 DBLIB versions in FreeTDS
74
+ * Update our TDS version constants to reflect changed 8.0/9.0 to 7.1/7.2 DBLIB versions in FreeTDS
62
75
  while making it backward compatible, again like FreeTDS. Even tho you can not configure FreeTDS with
63
76
  TDS version 7.2 or technically even use it, I added tests to prove that we correctly handle both
64
77
  varchar(max) and nvarchar(max) with large amounts of data.
@@ -101,7 +114,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
101
114
 
102
115
  * 0.4.2 *
103
116
 
104
- * Iconv is a dep only when compiling locally. However, left in the ability to configure
117
+ * Iconv is a dep only when compiling locally. However, left in the ability to configure
105
118
  it for native gem installation but you must use
106
119
  --enable-iconv before using --with-iconv-dir=/some/dir
107
120
 
@@ -121,8 +134,8 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
121
134
 
122
135
  * Allow Result#fields to be called before iterating over the results.
123
136
 
124
- * Two new client helper methods, #sqlsent? and #canceled?. Possible to use these to determine current
125
- state of the client and the need to use Result#cancel to stop processing active results. It is also
137
+ * Two new client helper methods, #sqlsent? and #canceled?. Possible to use these to determine current
138
+ state of the client and the need to use Result#cancel to stop processing active results. It is also
126
139
  safe to call Result#cancel over and over again.
127
140
 
128
141
  * Look for the syb headers only.
@@ -154,7 +167,7 @@ Use both dbsetversion() vs. dbsetlversion. Partially reverts #62.
154
167
 
155
168
  * 0.2.2 *
156
169
 
157
- * Fixed failing test in Ruby 1.8.6. DateTime doesn't support fractional seconds greater than 59.
170
+ * Fixed failing test in Ruby 1.8.6. DateTime doesn't support fractional seconds greater than 59.
158
171
  See: http://redmine.ruby-lang.org/issues/show/1490 [Erik Bryn]
159
172
 
160
173
 
data/Gemfile CHANGED
@@ -1,3 +1,2 @@
1
1
  source 'https://rubygems.org'
2
-
3
2
  gemspec
data/README.md CHANGED
@@ -24,7 +24,7 @@ Although we search for FreeTDS's libraries and headers, you may have to specify
24
24
 
25
25
  ## FreeTDS Compatibility & Configuration
26
26
 
27
- TinyTDS is developed against FreeTDS 0.82 & 0.91, and 0.92 currents, the latest is recommended. It is tested with SQL Server 2000, 2005, 2008 and Azure. Below are a few QA style notes about installing FreeTDS.
27
+ TinyTDS is developed against FreeTDS 0.82 & 0.91, and 0.92 currents, the latest is recommended. It is tested with SQL Server 2000, 2005, 2008, 2014, and Azure. Below are a few QA style notes about installing FreeTDS.
28
28
 
29
29
  * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against. You can avoid installing FreeTDS on your system by using our projects usage of rake-compiler and mini_portile to compile and package a native gem just for you. See the "Using MiniPortile" section below.
30
30
 
@@ -41,7 +41,7 @@ TinyTDS is developed against FreeTDS 0.82 & 0.91, and 0.92 currents, the latest
41
41
 
42
42
  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. Under ruby 1.9, all strings are encoded to the connection's encoding and all binary data types are associated to ruby's `ASCII-8BIT/BINARY` encoding.
43
43
 
44
- Below is a list of the data types we plan to support using future versions of FreeTDS. They are associated with SQL Server 2008. All unsupported data types are returned as properly encoded strings.
44
+ Below is a list of the data types we plan to support using future versions of FreeTDS. They are associated with SQL Server 2008 and up. All unsupported data types are returned as properly encoded strings.
45
45
 
46
46
  * [date]
47
47
  * [datetime2]
@@ -54,7 +54,7 @@ Below is a list of the data types we plan to support using future versions of Fr
54
54
  Connect to a database.
55
55
 
56
56
  ```ruby
57
- client = TinyTds::Client.new(:username => 'sa', :password => 'secret', :host => 'mydb.host.net')
57
+ client = TinyTds::Client.new username: 'sa', password: 'secret', host: 'mydb.host.net'
58
58
  ```
59
59
 
60
60
  Creating a new client takes a hash of options. For valid iconv encoding options, see the output of `iconv -l`. Only a few have been tested and highly recommended to leave blank for the UTF-8 default.
@@ -267,9 +267,23 @@ As of version 2.3.11 & 3.0.3 of the adapter, you can specify a `:dblib` mode in
267
267
 
268
268
  ## Using TinyTDS with Azure
269
269
 
270
- 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]`. You must use the latest FreeTDS 0.91. FreeTDS must be compiled with OpenSSL too.
270
+ 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]`. You must use the latest FreeTDS 0.91. FreeTDS must be compiled with OpenSSL too.
271
271
 
272
- IMPORTANT: Do not use `username@server.database.windows.net` for the username connection option! You must use the shorter `username@server` instead!
272
+ **IMPORTANT**: Do not use `username@server.database.windows.net` for the username connection option! You must use the shorter `username@server` instead!
273
+
274
+ We recommend the following settings when using TinyTDS with Azure. These are the same settings used in the ActiveRecord SQL Server adapter.
275
+
276
+ ```sql
277
+ SET ANSI_NULLS ON
278
+ SET CURSOR_CLOSE_ON_COMMIT OFF
279
+ SET ANSI_NULL_DFLT_ON ON
280
+ SET IMPLICIT_TRANSACTIONS OFF
281
+ SET ANSI_PADDING ON
282
+ SET QUOTED_IDENTIFIER ON
283
+ SET ANSI_WARNINGS ON
284
+ ```
285
+
286
+ 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!
273
287
 
274
288
 
275
289
  ## Using MiniPortile
@@ -329,9 +343,11 @@ $ rake cross-compile:clean
329
343
 
330
344
  ## Development & Testing
331
345
 
332
- We use bundler for development. Simply run `bundle install` then `rake` to build the gem and run the unit tests. The tests assume you have created a database named `tinytdstest` accessible by a database owner named `tinytds`. Before running the test rake task, you may need to define a pair of environment variables that help the client connect to your specific FreeTDS database server name and which schema (2000, 2005, 2008, Azure or Sybase ASE) to use. For example:
346
+ We use bundler for development. Simply run `bundle install` then `rake` to build the gem and run the unit tests. The tests assume you have created a database named `tinytdstest` accessible by a database owner named `tinytds`. Before running the test rake task, you may need to define a pair of environment variables that help the client connect to your specific FreeTDS database server name and which schema (2000, 2005, 2008, 2014, Azure or Sybase ASE) to use. For example:
333
347
 
334
348
  ```
349
+ $ rake TINYTDS_UNIT_DATASERVER=mydbserver
350
+ or
335
351
  $ rake TINYTDS_UNIT_DATASERVER=mydbserver TINYTDS_SCHEMA=sqlserver_2008
336
352
  or
337
353
  $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_SCHEMA=sqlserver_azure
@@ -342,7 +358,7 @@ $ rake TINYTDS_UNIT_HOST=mydb.host.net TINYTDS_UNIT_PORT=5000 TINYTDS_SCHEMA=syb
342
358
  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.
343
359
 
344
360
  ```
345
- $ rake TINYTDS_SKIP_PORTS=true
361
+ $ rake TINYTDS_SKIP_PORTS=1
346
362
  ```
347
363
 
348
364
 
@@ -363,7 +379,7 @@ $ rake TINYTDS_SKIP_PORTS=true
363
379
 
364
380
  ## About Me
365
381
 
366
- My name is Ken Collins and I currently maintain the SQL Server adapter for ActiveRecord and wrote this library as my first cut into learning ruby C extensions. Hopefully it will help promote the power of ruby and the Rails framework to those that have not yet discovered it. My blog is http://metaskills.net and I can be found on twitter as @metaskills. Enjoy!
382
+ My name is Ken Collins and I currently maintain the SQL Server adapter for ActiveRecord and wrote this library as my first cut into learning ruby C extensions. Hopefully it will help promote the power of ruby and the Rails framework to those that have not yet discovered it. My blog is [metaskills.net](http://metaskills.net/) and I can be found on twitter as @metaskills. Enjoy!
367
383
 
368
384
 
369
385
  ## Special Thanks
@@ -374,12 +390,7 @@ My name is Ken Collins and I currently maintain the SQL Server adapter for Activ
374
390
  * Josh Clayton of Thoughtbot for writing about ruby C extensions. - http://robots.thoughtbot.com/post/1037240922/get-your-c-on
375
391
 
376
392
 
377
- ## Donators
378
-
379
- I am trying to save up for a Happy Hacking pro keyboard. Help me out via GitTip! https://www.gittip.com/metaskills/
380
-
381
-
382
393
  ## License
383
394
 
384
- TinyTDS is Copyright (c) 2010-2014 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows binaries contain precompiled versions of FreeTDS <http://www.freetds.org/> which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>
395
+ TinyTDS is Copyright (c) 2010-2015 Ken Collins, <ken@metaskills.net> and Will Bond (Veracross LLC) <wbond@breuer.com>. It is distributed under the MIT license. Windows binaries contain precompiled versions of FreeTDS <http://www.freetds.org/> which is licensed under the GNU LGPL license at <http://www.gnu.org/licenses/lgpl-2.0.html>
385
396
 
data/Rakefile CHANGED
@@ -11,7 +11,11 @@ def test_libs
11
11
  end
12
12
 
13
13
  def test_files
14
- Dir.glob("test/**/*_test.rb").sort
14
+ if ENV['TEST_FILES']
15
+ ENV['TEST_FILES'].split(',').map{ |f| f.strip }.sort
16
+ else
17
+ Dir.glob("test/**/*_test.rb").sort
18
+ end
15
19
  end
16
20
 
17
21
  gemspec = Gem::Specification::load(File.expand_path('../tiny_tds.gemspec', __FILE__))
@@ -46,22 +50,18 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
46
50
  ext.cross_platform = []
47
51
  ext.cross_config_options << "--disable-lookup"
48
52
  config_opts = {}
49
-
50
53
  platform_host_map = {
51
54
  'x86-mingw32' => 'i586-mingw32msvc',
52
55
  'x64-mingw32' => 'x86_64-w64-mingw32'
53
56
  }
54
-
55
57
  # This section ensures we setup up rake dependencies and that libiconv
56
58
  # and freetds are compiled using the cross-compiler and then passed to
57
59
  # extconf.rb in such a way that library detection works.
58
60
  platform_host_map.each do |plat, host|
59
61
  ext.cross_platform << plat
60
-
61
62
  libiconv = define_libiconv_recipe(plat, host)
62
63
  freetds = define_freetds_recipe(plat, host, libiconv)
63
64
  task "native:#{plat}" => ["ports:freetds:#{plat}"] unless ENV['TINYTDS_SKIP_PORTS']
64
-
65
65
  # For some reason --with-freetds-dir and --with-iconv-dir would not work.
66
66
  # It seems the default params that extconf.rb constructs include
67
67
  # --without-freetds-include, --without-freetds-lib, --without-iconv-lib
@@ -71,7 +71,6 @@ Rake::ExtensionTask.new('tiny_tds', gemspec) do |ext|
71
71
  config_opts[plat] += " --with-iconv-include=#{libiconv.path}/include"
72
72
  config_opts[plat] += " --with-iconv-lib=#{libiconv.path}/lib"
73
73
  end
74
-
75
74
  ext.cross_config_options << config_opts
76
75
  end
77
76
  end
@@ -81,7 +80,6 @@ task 'cross-compile:setup' do
81
80
  # Make sure we have the command-line programs we need
82
81
  sh 'git', '--version'
83
82
  sh 'vagrant', '-v'
84
-
85
83
  if Dir.exists? 'rake-compiler-dev-box'
86
84
  Dir.chdir 'rake-compiler-dev-box'
87
85
  else
@@ -89,7 +87,6 @@ task 'cross-compile:setup' do
89
87
  Dir.chdir 'rake-compiler-dev-box'
90
88
  sh 'patch -p1 < ../compile/rake-compiler-dev-box.patch'
91
89
  end
92
-
93
90
  sh 'vagrant', 'up'
94
91
  end
95
92
 
@@ -73,9 +73,9 @@ int tinytds_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, c
73
73
  /*
74
74
  SYBETIME is the only error that can send INT_TIMEOUT or INT_CONTINUE,
75
75
  but we don't ever want to automatically retry. Instead have the app
76
- decide what to do. We would use INT_TIMEOUT, however it seems tdserror()
77
- in tds/util.c converts INT_TIMEOUT to INT_CONTINUE.
76
+ decide what to do.
78
77
  */
78
+ return_value = INT_TIMEOUT;
79
79
  cancel = 1;
80
80
  break;
81
81
 
@@ -2,23 +2,12 @@
2
2
  #include <tiny_tds_ext.h>
3
3
  #include <stdint.h>
4
4
 
5
- // TINY_TDS_MAX_TIME
6
-
7
- #define TINY_TDS_MAX_TIME 315607276799ULL
8
-
9
-
10
- // TINY_TDS_MIN_TIME
11
-
12
- #define TINY_TDS_MIN_TIME 2678400ULL
13
-
14
-
15
5
  // File Types/Vars
16
6
 
17
7
  VALUE cTinyTdsResult;
18
8
  extern VALUE mTinyTds, cTinyTdsClient, cTinyTdsError;
19
- VALUE cBigDecimal, cDate, cDateTime;
9
+ VALUE cBigDecimal, cDate;
20
10
  VALUE opt_decimal_zero, opt_float_zero, opt_one, opt_zero, opt_four, opt_19hdr, opt_tenk, opt_onemil;
21
- int opt_ruby_186;
22
11
  static ID intern_new, intern_utc, intern_local, intern_localtime, intern_merge,
23
12
  intern_civil, intern_new_offset, intern_plus, intern_divide, intern_Rational;
24
13
  static ID sym_symbolize_keys, sym_as, sym_array, sym_cache_rows, sym_first, sym_timezone, sym_local, sym_utc, sym_empty_sets;
@@ -78,7 +67,7 @@ VALUE rb_tinytds_new_result_obj(tinytds_client_wrapper *cwrap) {
78
67
  // No GVL Helpers
79
68
 
80
69
  #define NOGVL_DBCALL(_dbfunction, _client) ( \
81
- (RETCODE)rb_thread_blocking_region( \
70
+ (RETCODE)rb_thread_call_without_gvl( \
82
71
  (rb_blocking_function_t*)_dbfunction, _client, \
83
72
  (rb_unblock_function_t*)dbcancel_ubf, _client ) \
84
73
  )
@@ -293,25 +282,7 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
293
282
  if (year+month+day+hour+min+sec+msec != 0) {
294
283
  VALUE offset = (timezone == intern_local) ? rwrap->local_offset : opt_zero;
295
284
  uint64_t seconds = (year*31557600ULL) + (month*2592000ULL) + (day*86400ULL) + (hour*3600ULL) + (min*60ULL) + sec;
296
- /* Use DateTime */
297
- if (seconds < TINY_TDS_MIN_TIME || seconds > TINY_TDS_MAX_TIME) {
298
- VALUE datetime_sec = INT2NUM(sec);
299
- if (msec != 0) {
300
- if ((opt_ruby_186 == 1 && sec < 59) || (opt_ruby_186 != 1)) {
301
- #ifdef HAVE_RUBY_ENCODING_H
302
- VALUE rational_msec = rb_Rational2(INT2NUM(msec*1000), opt_onemil);
303
- #else
304
- VALUE rational_msec = rb_funcall(rb_cObject, intern_Rational, 2, INT2NUM(msec*1000), opt_onemil);
305
- #endif
306
- datetime_sec = rb_funcall(datetime_sec, intern_plus, 1, rational_msec);
307
- }
308
- }
309
- val = rb_funcall(cDateTime, intern_civil, 7, INT2NUM(year), INT2NUM(month), INT2NUM(day), INT2NUM(hour), INT2NUM(min), datetime_sec, offset);
310
- val = rb_funcall(val, intern_new_offset, 1, offset);
311
- /* Use Time */
312
- } else {
313
- val = rb_funcall(rb_cTime, timezone, 7, INT2NUM(year), INT2NUM(month), INT2NUM(day), INT2NUM(hour), INT2NUM(min), INT2NUM(sec), INT2NUM(msec*1000));
314
- }
285
+ val = rb_funcall(rb_cTime, timezone, 7, INT2NUM(year), INT2NUM(month), INT2NUM(day), INT2NUM(hour), INT2NUM(min), INT2NUM(sec), INT2NUM(msec*1000));
315
286
  }
316
287
  break;
317
288
  }
@@ -547,7 +518,6 @@ void init_tinytds_result() {
547
518
  /* Data Classes */
548
519
  cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
549
520
  cDate = rb_const_get(rb_cObject, rb_intern("Date"));
550
- cDateTime = rb_const_get(rb_cObject, rb_intern("DateTime"));
551
521
  /* Define TinyTds::Result */
552
522
  cTinyTdsResult = rb_define_class_under(mTinyTds, "Result", rb_cObject);
553
523
  /* Define TinyTds::Result Public Methods */
@@ -590,8 +560,6 @@ void init_tinytds_result() {
590
560
  opt_19hdr = INT2NUM(1900);
591
561
  opt_tenk = INT2NUM(10000);
592
562
  opt_onemil = INT2NUM(1000000);
593
- /* Ruby version flags */
594
- opt_ruby_186 = (rb_eval_string("RUBY_VERSION == '1.8.6'") == Qtrue) ? 1 : 0;
595
563
  /* Encoding */
596
564
  #ifdef HAVE_RUBY_ENCODING_H
597
565
  binaryEncoding = rb_enc_find("binary");
@@ -1,9 +1,9 @@
1
1
  module TinyTds
2
2
  class Client
3
-
3
+
4
4
  # From sybdb.h comments:
5
5
  # DBVERSION_xxx are used with dbsetversion()
6
- #
6
+ #
7
7
  TDS_VERSIONS_SETTERS = {
8
8
  'unknown' => 0,
9
9
  '46' => 1,
@@ -19,7 +19,7 @@ module TinyTds
19
19
  # From sybdb.h comments:
20
20
  # DBTDS_xxx are returned by DBTDS()
21
21
  # The integer values of the constants are poorly chosen.
22
- #
22
+ #
23
23
  TDS_VERSIONS_GETTERS = {
24
24
  0 => {:name => 'DBTDS_UNKNOWN', :description => 'Unknown'},
25
25
  1 => {:name => 'DBTDS_2_0', :description => 'Pre 4.0 SQL Server'},
@@ -33,7 +33,7 @@ module TinyTds
33
33
  9 => {:name => 'DBTDS_7_1/DBTDS_8_0', :description => 'Microsoft SQL Server 2000'},
34
34
  10 => {:name => 'DBTDS_7_2/DBTDS_9_0', :description => 'Microsoft SQL Server 2005'}
35
35
  }.freeze
36
-
36
+
37
37
  @@default_query_options = {
38
38
  :as => :hash,
39
39
  :symbolize_keys => false,
@@ -41,32 +41,29 @@ module TinyTds
41
41
  :timezone => :local,
42
42
  :empty_sets => true
43
43
  }
44
-
44
+
45
45
  attr_reader :query_options
46
-
46
+
47
47
  class << self
48
-
48
+
49
49
  def default_query_options
50
50
  @@default_query_options
51
51
  end
52
52
 
53
- # Most, if not all, iconv encoding names can be found by ruby. Just in case, you can
54
- # overide this method to return a string name that Encoding.find would work with. Default
53
+ # Most, if not all, iconv encoding names can be found by ruby. Just in case, you can
54
+ # overide this method to return a string name that Encoding.find would work with. Default
55
55
  # is to return the passed encoding.
56
56
  def transpose_iconv_encoding(encoding)
57
57
  encoding
58
58
  end
59
-
59
+
60
60
  end
61
61
 
62
62
 
63
63
  def initialize(opts={})
64
- if opts[:password] && opts[:password].to_s.strip != ''
65
- opts[:password] = opts[:password].to_s
66
- warn 'FreeTDS may have issues with passwords longer than 30 characters!' if opts[:password].length > 30
67
- end
68
64
  raise ArgumentError, 'missing :host option if no :dataserver given' if opts[:dataserver].to_s.empty? && opts[:host].to_s.empty?
69
65
  @query_options = @@default_query_options.dup
66
+ opts[:password] = opts[:password].to_s if opts[:password] && opts[:password].to_s.strip != ''
70
67
  opts[:appname] ||= 'TinyTds'
71
68
  opts[:tds_version] = TDS_VERSIONS_SETTERS[opts[:tds_version].to_s] || TDS_VERSIONS_SETTERS['71']
72
69
  opts[:login_timeout] ||= 60
@@ -76,7 +73,7 @@ module TinyTds
76
73
  opts[:dataserver] = "#{opts[:host]}:#{opts[:port]}" if opts[:dataserver].to_s.empty?
77
74
  connect(opts)
78
75
  end
79
-
76
+
80
77
  def tds_version_info
81
78
  info = TDS_VERSIONS_GETTERS[tds_version]
82
79
  "#{info[:name]} - #{info[:description]}" if info
@@ -86,11 +83,12 @@ module TinyTds
86
83
  !closed? && !dead?
87
84
  end
88
85
 
86
+
89
87
  private
90
-
88
+
91
89
  def self.local_offset
92
90
  ::Time.local(2010).utc_offset.to_r / 86400
93
91
  end
94
-
92
+
95
93
  end
96
94
  end
@@ -1,3 +1,3 @@
1
1
  module TinyTds
2
- VERSION = '0.6.2'
3
- end
2
+ VERSION = '0.6.3.rc1'
3
+ end
@@ -5,11 +5,11 @@ require 'mini_portile'
5
5
  ICONV_VERSION = "1.14"
6
6
  FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "0.91"
7
7
  FREETDS_VERSION_INFO = Hash.new { |h,k|
8
- h[k] = {:files => "ftp://ftp.astron.com/pub/freetds/stable/freetds-#{k}.tar.gz"}
8
+ h[k] = {:files => "ftp://ftp.freetds.org/pub/freetds/stable/freetds-#{k}.tar.gz"}
9
9
  }.merge({
10
- "0.82" => {:files => "ftp://ftp.astron.com/pub/freetds/old/0.82/freetds-0.82.tar.gz"},
11
- "0.91" => {:files => "ftp://ftp.astron.com/pub/freetds/stable/freetds-0.91.tar.gz"},
12
- "current" => {:files => "ftp://ftp.astron.com/pub/freetds/current/freetds-current.tgz"}
10
+ "0.82" => {:files => "ftp://ftp.freetds.org/pub/freetds/old/0.82/freetds-0.82.tar.gz"},
11
+ "0.91" => {:files => "ftp://ftp.freetds.org/pub/freetds/stable/freetds-0.91.112.tar.gz"},
12
+ "current" => {:files => "ftp://ftp.freetds.org/pub/freetds/current/freetds-current.tgz"}
13
13
  })
14
14
 
15
15
  # all ports depends on this directory to exist
@@ -19,19 +19,17 @@ def define_libiconv_recipe(platform, host)
19
19
  recipe = MiniPortile.new "libiconv", ICONV_VERSION
20
20
  recipe.files << "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-#{ICONV_VERSION}.tar.gz"
21
21
  recipe.host = host
22
-
23
22
  desc "Compile libiconv for '#{platform}' (#{host})"
24
23
  task "ports:libiconv:#{platform}" => ["ports"] do
25
24
  checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
26
-
27
25
  unless File.exist?(checkpoint)
28
26
  # always produce position independent code
29
27
  recipe.configure_options << "CFLAGS='-fPIC'"
30
28
  recipe.cook
31
29
  touch checkpoint
30
+ recipe.activate
32
31
  end
33
32
  end
34
-
35
33
  recipe
36
34
  end
37
35
 
@@ -39,19 +37,15 @@ def define_freetds_recipe(platform, host, libiconv)
39
37
  recipe = MiniPortile.new "freetds", FREETDS_VERSION
40
38
  recipe.files << FREETDS_VERSION_INFO[FREETDS_VERSION][:files]
41
39
  recipe.host = host
42
-
43
40
  if recipe.respond_to?(:patch_files) && FREETDS_VERSION == "0.91"
44
- recipe.patch_files << File.expand_path(File.join('..', '..', 'ext', 'patch', 'sspi_w_kerberos.diff'), __FILE__)
45
41
  recipe.patch_files << File.expand_path(File.join('..', '..', 'ext', 'patch', 'dblib-30-char-username.diff'), __FILE__)
46
42
  unless RUBY_PLATFORM =~ /mswin|mingw/
47
43
  recipe.patch_files << File.expand_path(File.join('..', '..', 'ext', 'patch', 'Makefile.in.diff'), __FILE__)
48
44
  end
49
45
  end
50
-
51
46
  desc "Compile freetds for '#{platform}' (#{host})"
52
47
  task "ports:freetds:#{platform}" => ["ports", "ports:libiconv:#{platform}"] do
53
48
  checkpoint = "ports/.#{recipe.name}-#{recipe.version}-#{recipe.host}.installed"
54
-
55
49
  unless File.exist?(checkpoint)
56
50
  with_tdsver = ENV['TINYTDS_FREETDS_VERSION'] =~ /0\.8/ ? "--with-tdsver=8.0" : "--with-tdsver=7.1"
57
51
  for_windows = recipe.host =~ /mswin|mingw/i
@@ -63,9 +57,9 @@ def define_freetds_recipe(platform, host, libiconv)
63
57
  recipe.configure_options << with_tdsver
64
58
  recipe.cook
65
59
  touch checkpoint
60
+ recipe.activate
66
61
  end
67
62
  end
68
-
69
63
  recipe
70
64
  end
71
65