Sha256: 67ee3fc0d89b817bdaf26912e49cd25b7b2fc6af1c2a3e9d0595a4063ab58aae

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

module Sequel
  module ActiveRecordConnection
    module Jdbc
      def self.extended(db)
        if db.timezone == :utc && db.respond_to?(:current_timestamp_utc)
          db.current_timestamp_utc = true
        end
      end

      def statement(conn)
        stmt = activerecord_raw_connection.connection.createStatement
        yield stmt
      rescue ActiveRecord::StatementInvalid => exception
        raise_error(exception.cause, classes: database_error_classes)
      rescue *database_error_classes => e
        raise_error(e, classes: database_error_classes)
      ensure
        stmt.close if stmt
      end

      def execute(sql, opts=OPTS)
        activerecord_connection.send(:log, sql) do
          super
        end
      rescue ActiveRecord::StatementInvalid => exception
        raise_error(exception.cause, classes: database_error_classes)
      end

      def execute_dui(sql, opts=OPTS)
        activerecord_connection.send(:log, sql) do
          super
        end
      rescue ActiveRecord::StatementInvalid => exception
        raise_error(exception.cause, classes: database_error_classes)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sequel-activerecord_connection-0.4.1 lib/sequel/extensions/activerecord_connection/jdbc.rb
sequel-activerecord_connection-0.4.0 lib/sequel/extensions/activerecord_connection/jdbc.rb
sequel-activerecord_connection-0.3.0 lib/sequel/extensions/activerecord_connection/jdbc.rb
sequel-activerecord_connection-0.2.6 lib/sequel/extensions/activerecord_connection/jdbc.rb
sequel-activerecord_connection-0.2.5 lib/sequel/extensions/activerecord_connection/jdbc.rb