1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merged pull request #302 from metaskills/empty_inserts.

Use existing #empty_insert_statement_value for an insert with no columns.
This commit is contained in:
Aaron Patterson 2011-04-25 09:18:39 -07:00
commit 2fc8d7ea90
3 changed files with 1 additions and 9 deletions

View file

@ -287,10 +287,6 @@ module ActiveRecord
execute "INSERT INTO #{quote_table_name(table_name)} (#{key_list.join(', ')}) VALUES (#{value_list.join(', ')})", 'Fixture Insert'
end
def null_insert_value
Arel.sql 'DEFAULT'
end
def empty_insert_statement_value
"VALUES(DEFAULT)"
end

View file

@ -346,10 +346,6 @@ module ActiveRecord
alter_table(table_name, :rename => {column_name.to_s => new_column_name.to_s})
end
def null_insert_value
Arel.sql 'NULL'
end
def empty_insert_statement_value
"VALUES(NULL)"
end

View file

@ -60,7 +60,7 @@ module ActiveRecord
end
if values.empty? # empty insert
im.values = im.create_values [connection.null_insert_value], []
im.values = Arel.sql(connection.empty_insert_statement_value)
else
im.insert substitutes
end