Sha256: fddf4d95f5806af71b59d376f1536a6b6c672477c1da290c28c1a36f52ec5c86

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module Sequel
  module ActiveRecordConnection
    module Postgres
      def execute(sql, opts=OPTS)
        result = activerecord_connection.execute(sql)

        if block_given?
          yield result
        else
          result.cmd_tuples
        end
      rescue ActiveRecord::PreparedStatementCacheExpired
        raise # ActiveRecord's transaction manager needs to handle this exception
      rescue ActiveRecord::StatementInvalid => exception
        raise_error(exception.cause, classes: database_error_classes)
      ensure
        result.clear if result
      end

      def transaction(options = {})
        %i[deferrable read_only synchronous].each do |key|
          fail Error, "#{key.inspect} transaction option is currently not supported" if options.key?(key)
        end

        super
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sequel-activerecord_connection-0.4.1 lib/sequel/extensions/activerecord_connection/postgres.rb
sequel-activerecord_connection-0.4.0 lib/sequel/extensions/activerecord_connection/postgres.rb
sequel-activerecord_connection-0.3.0 lib/sequel/extensions/activerecord_connection/postgres.rb