Sha256: 242e073653abfa8f856d9e9d0ff12b91f331738a43b7f550cd81edc28f27d6e5

Contents?: true

Size: 1.38 KB

Versions: 13

Compression:

Stored size: 1.38 KB

Contents

# frozen-string-literal: true

Sequel::JDBC.load_driver('Java::net.sourceforge.jtds.jdbc.Driver', :JTDS)
Sequel.require 'adapters/jdbc/mssql'

module Sequel
  module JDBC
    Sequel.synchronize do
      DATABASE_SETUP[:jtds] = proc do |db|
        db.extend(Sequel::JDBC::JTDS::DatabaseMethods)
        db.dataset_class = Sequel::JDBC::JTDS::Dataset
        db.send(:set_mssql_unicode_strings)
        Java::net.sourceforge.jtds.jdbc.Driver
      end
    end

    # Database and Dataset instance methods for JTDS specific
    # support via JDBC.
    module JTDS
      module DatabaseMethods
        extend Sequel::Database::ResetIdentifierMangling
        include Sequel::JDBC::MSSQL::DatabaseMethods

        private

        # JTDS exception handling with SQLState is less accurate than with regexps.
        def database_exception_use_sqlstates?
          false
        end

        def disconnect_error?(exception, opts)
          super || exception.message =~ /\AInvalid state, the Connection object is closed\.\z/
        end

        # Handle nil values by using setNull with the correct parameter type.
        def set_ps_arg_nil(cps, i)
          cps.setNull(i, cps.getParameterMetaData.getParameterType(i))
        end
      end

      # Dataset class for JTDS datasets accessed via JDBC.
      class Dataset < JDBC::Dataset
        include Sequel::MSSQL::DatasetMethods
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
sequel-4.41.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.40.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.39.0 lib/sequel/adapters/jdbc/jtds.rb
tdiary-5.0.2 vendor/bundle/gems/sequel-4.37.0/lib/sequel/adapters/jdbc/jtds.rb
sequel-4.38.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.37.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.36.0 lib/sequel/adapters/jdbc/jtds.rb
tdiary-5.0.1 vendor/bundle/gems/sequel-4.35.0/lib/sequel/adapters/jdbc/jtds.rb
sequel-4.35.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.34.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.33.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.32.0 lib/sequel/adapters/jdbc/jtds.rb
sequel-4.31.0 lib/sequel/adapters/jdbc/jtds.rb