Sha256: ddfa9eb63196c446d3b95072d6512210331e0a293d4357b3f77a2b76256f95f2

Contents?: true

Size: 723 Bytes

Versions: 5

Compression:

Stored size: 723 Bytes

Contents

require 'helper'

module Arel
  module Visitors
    describe 'the ibm_db visitor' do
      before do
        @visitor = IBM_DB.new Table.engine
      end

      it 'uses FETCH FIRST n ROWS to limit results' do
        stmt = Nodes::SelectStatement.new
        stmt.limit = Nodes::Limit.new(1)
        sql = @visitor.accept(stmt)
        sql.must_be_like "SELECT FETCH FIRST 1 ROWS ONLY"
      end

      it 'uses FETCH FIRST n ROWS in updates with a limit' do
        stmt = Nodes::UpdateStatement.new
        stmt.limit = Nodes::Limit.new(1)
        stmt.key = 'id'
        sql = @visitor.accept(stmt)
        sql.must_be_like "UPDATE NULL WHERE 'id' IN (SELECT 'id' FETCH FIRST 1 ROWS ONLY)"
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
arel-2.1.4 test/visitors/test_ibm_db.rb
arel-2.1.3 test/visitors/test_ibm_db.rb
arel-2.1.2 test/visitors/test_ibm_db.rb
arel-2.1.1 test/visitors/test_ibm_db.rb
arel-2.1.0 test/visitors/test_ibm_db.rb