Sha256: 1c90c684d582c3e62f5cbe39bb2befb19684c20a047e17a95626b0913fd65b1c

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

# rubocop:disable Naming/MethodName
# rubocop:disable Naming/UncommunicativeMethodParamName
# rubocop:disable Metrics/CyclomaticComplexity
# rubocop:disable Metrics/AbcSize

module Arel
  module Nodes
    # https://www.postgresql.org/docs/8.3/tutorial-transactions.html
    class Transaction < Arel::Nodes::Binary
      alias type left
      alias options right
    end
  end

  module Visitors
    class ToSql
      def visit_Arel_Nodes_Transaction(o, collector)
        case o.type
        when 0
          collector << 'BEGIN'
        when 2
          collector << 'COMMIT'
        when 3
          collector << 'ROLLBACK'
        when 4
          collector << 'SAVEPOINT '
          collector << o.options.join(' ')
        when 5
          collector << 'RELEASE SAVEPOINT '
          collector << o.options.join(' ')
        when 6
          collector << 'ROLLBACK TO '
          collector << o.options.join(' ')
        else
          raise "Unknown transaction type `#{o.type}`"
        end
      end
    end
  end
end

# rubocop:enable Naming/MethodName
# rubocop:enable Naming/UncommunicativeMethodParamName
# rubocop:enable Metrics/CyclomaticComplexity
# rubocop:enable Metrics/AbcSize

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arel_toolkit-0.4.5 lib/arel/extensions/transaction.rb
arel_toolkit-0.4.4 lib/arel/extensions/transaction.rb
arel_toolkit-0.4.3 lib/arel/extensions/transaction.rb
arel_toolkit-0.4.2 lib/arel/extensions/transaction.rb
arel_toolkit-0.4.1 lib/arel/extensions/transaction.rb
arel_toolkit-0.4.0 lib/arel/extensions/transaction.rb