From 167e64b78ca1fcda9b346785ebd6e25f0bfc9680 Mon Sep 17 00:00:00 2001 From: Praveen Narayanappa Date: Mon, 15 Jul 2024 02:26:03 -0400 Subject: [PATCH] Fix for github issue #167 Signed-off-by: Praveen Narayanappa --- .../connection_adapters/ibm_db_adapter.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/IBM_DB_Adapter/ibm_db/lib/active_record/connection_adapters/ibm_db_adapter.rb b/IBM_DB_Adapter/ibm_db/lib/active_record/connection_adapters/ibm_db_adapter.rb index 0e882a3..01061e1 100644 --- a/IBM_DB_Adapter/ibm_db/lib/active_record/connection_adapters/ibm_db_adapter.rb +++ b/IBM_DB_Adapter/ibm_db/lib/active_record/connection_adapters/ibm_db_adapter.rb @@ -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 @@ -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) @@ -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 << ' ' @@ -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