diff options
author | Ken Collins <ken@metaskills.net> | 2011-04-24 12:52:28 -0400 |
---|---|---|
committer | Ken Collins <ken@metaskills.net> | 2011-04-24 12:52:28 -0400 |
commit | 35d0b6029fe499254d74a3cd5dc4c0397d3a50ee (patch) | |
tree | 7005227dfafe73ef6127d54362e2b2f8ed83cbdb /activerecord/lib | |
parent | bf40c729c6930ffc711760948701e5edf3edb25b (diff) | |
download | rails-35d0b6029fe499254d74a3cd5dc4c0397d3a50ee.tar.gz rails-35d0b6029fe499254d74a3cd5dc4c0397d3a50ee.tar.bz2 rails-35d0b6029fe499254d74a3cd5dc4c0397d3a50ee.zip |
Use existing #empty_insert_statement_value for an insert with no columns.
Diffstat (limited to 'activerecord/lib')
3 files changed, 1 insertions, 9 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb index 5ff81aa023..70da9d5f1e 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb @@ -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 diff --git a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb index e1518f9a0f..ed5006dcec 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb @@ -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 diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 45a7000cce..8e5f66ec1d 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -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 |