Permalink
Browse files

Work with tinytds 0.4.5

This removes the copying of the :host option to the :dataserver
option when using the tinytds adapter.  That worked fine for previous
versions of tiny_tds, but no longer works with 0.4.5.

This breaks backwards compatibility with previous connection urls
where the freetds.conf name was specified as the :host.  To use
an entry in the freetds.conf file, you must now provide the
:dataserver option.

Unfortunately, tinytds 0.4.5 does not work with FreeTDS 0.91rc1, you
have to use FreeTDS 0.91rc2 or an older version of FreeTDS such as
0.82 (and older versions require the use of the freetds.conf file).

Since 0.4.5 is now required, switch to using active? instead of
closed? and dead? to detect disconnects.
  • Loading branch information...
1 parent 41e72f3 commit 2841832938b9734c5e0ff296f727fc70047a5c14 @jeremyevans committed Jun 28, 2011
Showing with 11 additions and 7 deletions.
  1. +2 −0 CHANGELOG
  2. +8 −5 doc/opening_databases.rdoc
  3. +1 −2 lib/sequel/adapters/tinytds.rb
View
@@ -1,5 +1,7 @@
=== HEAD
+* Work with tiny_tds-0.4.5 in the tinytds adapter, older versions are no longer supported (jeremyevans)
+
* Make association_pks plugin typecast provided values to integer if the primary key column type is integer (jeremyevans)
* Model.set_dataset now accepts Identifier, QualifiedIdentifier, and AliasedExpression arguments (jeremyevans)
View
@@ -355,14 +355,17 @@ Examples:
Because the underscore is not a valid character in a URI schema, the adapter
is named tinytds instead of tiny_tds. The connection options are passed directly
-to tiny_tds, except that the tiny_tds :dataserver and :username options are set to
-the Sequel :host and :user options. The :host option should be an entry in the
-freetds.conf file, it's not currently possible to a host not present in the
-freetds.conf file. Some options that you may want to set are
-:login_timeout, :timeout, :appname, and :encoding, see the tiny_tds README for details.
+to tiny_tds, except that the tiny_tds :username option is set to
+the Sequel :user option. If you want to use an entry in the freetds.conf file, you
+should specify the :dataserver option with that name as the value. Some other
+options that you may want to set are :login_timeout, :timeout, :tds_version, :azure,
+:appname, and :encoding, see the tiny_tds README for details.
+
For highest performance, you should disable any identifier output method when
using the tinytds adapter, which probably means disabling any identifier input method
as well. The default for Microsoft SQL Server is to :downcase identifiers on output
and :upcase them on input, so the highest performance will require changing the setting
from the default.
+The Sequel tinytds adapter requires tiny_tds >= 0.4.5, and if you are using FreeTDS
+0.91, you must at least be using 0.91rc2 (0.91rc1 does not work).
@@ -11,7 +11,6 @@ class Database < Sequel::Database
# :dataserver and :username options.
def connect(server)
opts = server_opts(server)
- opts[:dataserver] = opts[:host]
opts[:username] = opts[:user]
set_mssql_unicode_strings
TinyTds::Client.new(opts)
@@ -39,7 +38,7 @@ def execute(sql, opts={})
end
yield(r) if block_given?
rescue TinyTds::Error => e
- raise_error(e, :disconnect=>(c.closed? || (c.respond_to?(:dead?) && c.dead?)))
+ raise_error(e, :disconnect=>!c.active?)
ensure
r.cancel if r && c.sqlsent?
end

0 comments on commit 2841832

Please sign in to comment.