Skip to content

Commit

Permalink
Merge pull request #171 from praveen-db2/master
Browse files Browse the repository at this point in the history
Fix for github issue #167
  • Loading branch information
bimalkjha authored Jul 15, 2024
2 parents e9a9cdc + 167e64b commit 8e33411
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def visit_TableDefinition(o)

statements.concat(o.check_constraints.map { |chk| accept chk }) if supports_check_constraints?

@conn.puts_log "visit_TableDefinition #{@conn.servertype}"
if !@conn.servertype.instance_of? IBM_IDS
statements.concat(o.unique_constraints.map { |exc| accept exc }) if supports_unique_constraints?
end
Expand Down Expand Up @@ -4264,8 +4265,11 @@ def visit_Arel_Nodes_Limit(o, collector)
end

def visit_Arel_Nodes_Offset(o, collector)
collector << ' OFFSET '
visit o.expr, collector
@connection.puts_log "visit_Arel_Nodes_Offset #{@connection.servertype}"
if !@connection.servertype.instance_of? ActiveRecord::ConnectionAdapters::IBM_IDS
collector << ' OFFSET '
visit o.expr, collector
end
end

def visit_Arel_Nodes_ValuesList(o, collector)
Expand All @@ -4289,6 +4293,7 @@ def visit_Arel_Nodes_ValuesList(o, collector)
end

def visit_Arel_Nodes_SelectStatement(o, collector)
@connection.puts_log "visit_Arel_Nodes_SelectStatement #{@connection.servertype}"
if o.with
collector = visit o.with, collector
collector << ' '
Expand All @@ -4311,10 +4316,12 @@ def visit_Arel_Nodes_SelectStatement(o, collector)
visit_Arel_Nodes_Limit(o.limit, collector)
visit_Arel_Nodes_Offset(o.offset, collector)
elsif o.offset && o.limit.nil?
collector << ' OFFSET '
visit o.offset.expr, collector
collector << ' ROWS '
maybe_visit o.lock, collector
if !@connection.servertype.instance_of? ActiveRecord::ConnectionAdapters::IBM_IDS
collector << ' OFFSET '
visit o.offset.expr, collector
collector << ' ROWS '
maybe_visit o.lock, collector
end
else
visit_Arel_Nodes_SelectOptions(o, collector)
end
Expand Down

0 comments on commit 8e33411

Please sign in to comment.