Class: Arel::SqlCompiler::IBM_DBCompiler

Inherits:
GenericCompiler show all
Defined in:
lib/arel/engines/sql/compilers/ibm_db_compiler.rb

Instance Attribute Summary

Attributes inherited from GenericCompiler

#relation

Instance Method Summary collapse

Methods inherited from GenericCompiler

#delete_sql, #initialize, #insert_sql, #select_sql, #supports_insert_with_returning?, #update_sql

Constructor Details

This class inherits a constructor from Arel::SqlCompiler::GenericCompiler

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Arel::SqlCompiler::GenericCompiler

Instance Method Details

#add_limit_on_delete(taken) ⇒ Object



42
43
44
# File 'lib/arel/engines/sql/compilers/ibm_db_compiler.rb', line 42

def add_limit_on_delete(taken)
  raise "IBM_DB does not support limit on deletion" # Limiting the number of rows to be deleted is not supported by IBM_DB
end

#limited_update_conditions(conditions, taken) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/arel/engines/sql/compilers/ibm_db_compiler.rb', line 34

def limited_update_conditions(conditions, taken)
  quoted_primary_key = engine.quote_table_name(primary_key)
  update_conditions = "WHERE #{quoted_primary_key} IN (SELECT #{quoted_primary_key} FROM #{engine.connection.quote_table_name table.name} #{conditions} " #Note: - ')' not added, limit segment is to be appended
  engine.add_limit_offset!(update_conditions,{:limit=>taken,:offset=>nil})
  update_conditions << ")" # Close the sql segment
  update_conditions
end