From 237e580c4920b2414ef1bb72c14250688b479b9e Mon Sep 17 00:00:00 2001 From: Raimonds Simanovskis Date: Tue, 16 Nov 2010 12:45:29 +0200 Subject: fix one more time order_hacks method for Oracle correctly split order string by commas ignoring commas which separate function arguments --- test/visitors/test_oracle.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb index d2a73ea8c5..2c9bba15d8 100644 --- a/test/visitors/test_oracle.rb +++ b/test/visitors/test_oracle.rb @@ -43,6 +43,18 @@ module Arel } end + it 'splits orders with commas and function calls' do + # *sigh* + select = "DISTINCT foo.id, FIRST_VALUE(projects.name) OVER (foo) AS alias_0__" + stmt = Nodes::SelectStatement.new + stmt.cores.first.projections << Nodes::SqlLiteral.new(select) + stmt.orders << Nodes::SqlLiteral.new('NVL(LOWER(bar, foo), foo) DESC, UPPER(baz)') + sql = @visitor.accept(stmt) + sql.must_be_like %{ + SELECT #{select} ORDER BY alias_0__ DESC, alias_1__ + } + end + describe 'Nodes::SelectStatement' do describe 'limit' do it 'adds a rownum clause' do -- cgit v1.2.3