blob: db5e52b8a4e458831b423bb6acb7b34dc8953776 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
require 'helper'
module Arel
module Visitors
describe 'the informix visitor' do
before do
@visitor = Informix.new Table.engine
end
it 'uses LIMIT n to limit results' do
stmt = Nodes::SelectStatement.new
stmt.limit = Nodes::Limit.new(1)
sql = @visitor.accept(stmt)
sql.must_be_like "SELECT LIMIT 1"
end
it 'uses LIMIT n 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 LIMIT 1 'id')"
end
it 'uses SKIP n to jump results' do
stmt = Nodes::SelectStatement.new
stmt.offset = Nodes::Offset.new(10)
sql = @visitor.accept(stmt)
sql.must_be_like "SELECT SKIP 10"
end
end
end
end
|