# File lib/jdbc_adapter/jdbc_db2.rb, line 60 def add_limit_offset!(sql, options) if limit = options[:limit] offset = options[:offset] || 0 sql.gsub!(/SELECT/, 'SELECT B.* FROM (SELECT A.*, row_number() over () AS internal$rownum FROM (SELECT') sql << ") A ) B WHERE B.internal$rownum > #{offset} AND B.internal$rownum <= #{limit + offset}" end end
# File lib/jdbc_adapter/jdbc_db2.rb, line 124 def add_quotes(name) return name unless name %{"#{name}"} end
This method makes tests pass without understanding why. Don't use this in production.
# File lib/jdbc_adapter/jdbc_db2.rb, line 117 def columns(table_name, name = nil) super.select do |col| # strip out "magic" columns from DB2 (?) !/rolename|roleid|create_time|auditpolicyname|auditpolicyid|remarks/.match(col.name) end end
# File lib/jdbc_adapter/jdbc_db2.rb, line 179 def dump_schema_information begin if (current_schema = ActiveRecord::Migrator.current_version) > 0 #TODO: Find a way to get the DB2 instace name to properly form the statement return "INSERT INTO DB2INST2.SCHEMA_INFO (version) VALUES (#{current_schema})" end rescue ActiveRecord::StatementInvalid # No Schema Info end end
# File lib/jdbc_adapter/jdbc_db2.rb, line 135 def expand_double_quotes(name) return name unless name && name['"'] name.gsub(/"/,'""') end
# File lib/jdbc_adapter/jdbc_db2.rb, line 52 def modify_types(tp) tp[:primary_key] = 'int not null generated by default as identity (start with 1) primary key' tp[:string][:limit] = 255 tp[:integer][:limit] = nil tp[:boolean][:limit] = nil tp end
# File lib/jdbc_adapter/jdbc_db2.rb, line 68 def quote_column_name(column_name) column_name end
# File lib/jdbc_adapter/jdbc_db2.rb, line 90 def quote_string(string) string.gsub(/'/, "''") # ' (for ruby-mode) end
# File lib/jdbc_adapter/jdbc_db2.rb, line 98 def quoted_false '0' end
# File lib/jdbc_adapter/jdbc_db2.rb, line 94 def quoted_true '1' end
# File lib/jdbc_adapter/jdbc_db2.rb, line 102 def recreate_database(name) do_not_drop = ["stmg_dbsize_info","hmon_atm_info","hmon_collection","policy"] tables.each do |table| unless do_not_drop.include?(table) drop_table(table) end end end
Generated with the Darkfish Rdoc Generator 2.