Skip to content

Commit

Permalink
Make #options_include_default? master again
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton committed Feb 3, 2017
1 parent cc2b47c commit 4c8b91f
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions lib/odbc_adapter/adapters/mysql_odbc_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ def indexes(table_name, name = nil)
super(table_name, name).reject { |i| i.unique && i.name =~ /^PRIMARY$/ }
end

protected

def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
super
id_value || last_inserted_id(nil)
end

def last_inserted_id(_result)
select_value('SELECT LAST_INSERT_ID()').to_i
end

private

# MySQL 5.x doesn't allow DEFAULT NULL for first timestamp column in a
# table
def options_include_default?(options)
Expand All @@ -152,6 +139,17 @@ def options_include_default?(options)
end
super(options)
end

protected

def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)
super
id_value || last_inserted_id(nil)
end

def last_inserted_id(_result)
select_value('SELECT LAST_INSERT_ID()').to_i
end
end
end
end

0 comments on commit 4c8b91f

Please sign in to comment.