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
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