Skip to content

Commit 0bbced2

Browse files
fix db2 = null issue
1 parent abe8b92 commit 0bbced2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/arjdbc/db2/adapter.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ def runstats_for_table(tablename, priority = 10)
428428
@connection.execute_update "call sysproc.admin_cmd('RUNSTATS ON TABLE #{tablename} WITH DISTRIBUTION AND DETAILED INDEXES ALL UTIL_IMPACT_PRIORITY #{priority}')"
429429
end
430430

431+
def select(sql, name, binds)
432+
# DB2 does not like "= NULL", "!= NULL", or "<> NULL".
433+
exec_query(to_sql(sql.gsub(/(!=|<>)\s*null/i, "IS NOT NULL").gsub(/=\s*null/i, "IS NULL"), binds), name, binds)
434+
end
435+
431436
def add_index(table_name, column_name, options = {})
432437
if ! zos? || ( table_name.to_s == ActiveRecord::Migrator.schema_migrations_table_name.to_s )
433438
column_name = column_name.to_s if column_name.is_a?(Symbol)

0 commit comments

Comments
 (0)