Sha256: 3db9cb9cb39f2dceab19af11cf6c7b445e0bb03b890a7ca7180388f663c18233

Contents?: true

Size: 680 Bytes

Versions: 25

Compression:

Stored size: 680 Bytes

Contents

require 'arel/visitors/compat'

module Arel
  module Visitors
    class HSQLDB < Arel::Visitors::ToSql
      def visit_Arel_Nodes_SelectStatement o
        [
          limit_offset(o.cores.map { |x| visit_Arel_Nodes_SelectCore x }.join, o),
          ("ORDER BY #{o.orders.map { |x| visit x }.join(', ')}" unless o.orders.empty?),
        ].compact.join ' '
      end

      def limit_offset sql, o
        offset = o.offset || 0
        bef = sql[7..-1]
        if limit = o.limit
          "SELECT LIMIT #{offset} #{limit_for(limit)} #{bef}"
        elsif offset > 0
          "SELECT LIMIT #{offset} 0 #{bef}"
        else
          sql
        end
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 7 rubygems

Version Path
activerecord-jdbc-adapter-1.2.9.1 lib/arel/visitors/hsqldb.rb
cmoran92-activerecord-jdbc-adapter-1.2.1.2 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.3.0.beta1 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.9 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.8 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.5 lib/arel/visitors/hsqldb.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.5 lib/arel/visitors/hsqldb.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.4 lib/arel/visitors/hsqldb.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.3 lib/arel/visitors/hsqldb.rb
tgbyte-activerecord-jdbc-adapter-1.2.2.2 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.2.1 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-onsite-1.2.2 lib/arel/visitors/hsqldb.rb
cmoran92-activerecord-jdbc-adapter-1.2.1.1 lib/arel/visitors/hsqldb.rb
intentmedia-activerecord-jdbc-adapter-1.1.1.1 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.2 lib/arel/visitors/hsqldb.rb
cmoran92-activerecord-jdbc-adapter-1.2.1 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.1 lib/arel/visitors/hsqldb.rb
c3-activerecord-jdbc-adapter-1.1.3.1 lib/arel/visitors/hsqldb.rb
activerecord-jdbc-adapter-1.2.0 lib/arel/visitors/hsqldb.rb
c3-activerecord-jdbc-adapter-1.1.3 lib/arel/visitors/hsqldb.rb