Sha256: fa8da175c5a0835562524eb75184d15c2f20e38e95e8585667ad474f53a55550

Contents?: true

Size: 739 Bytes

Versions: 31

Compression:

Stored size: 739 Bytes

Contents

require 'helper'

module Arel
  module Visitors
    describe 'the ibm_db visitor' do
      before do
        @visitor = IBM_DB.new Table.engine.connection_pool
      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

31 entries across 31 versions & 2 rubygems

Version Path
dirty_history-0.7.3 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.7.2 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.7.1 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.7.0 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.7 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.6 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.5 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.4 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.3 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.2 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.1 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.6.0 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.5.4 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.5.3 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.5.2 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
arel-2.2.3 test/visitors/test_ibm_db.rb
arel-2.2.2 test/visitors/test_ibm_db.rb
dirty_history-0.5.1 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.5.0 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb
dirty_history-0.4.10 dirty_history/ruby/1.9.1/gems/arel-2.2.1/test/visitors/test_ibm_db.rb