Commit graph

24 commits

Author SHA1 Message Date
Ben Woosley 899af1e412 No reason to pull :validate out of the options hash, and it's obfuscatory - remove. 2011-01-10 22:12:34 -05:00
Ben Woosley 18012bbbca More simplicity, once again with #map 2011-01-10 22:12:33 -05:00
Ben Woosley 3756e4f2b4 Refactor remaining supports_import? split to share code in values_sql_for_column_names_and_attributes. This means both with properly support sequences.
Rather than pass a ton of variables (sequence_name, columns, column_names, &c.), move the method out of the connection.  Also, use Column#primary to check primary key status.
2011-01-10 22:12:29 -05:00
Ben Woosley 5f4d9b3290 Extract columns_sql local more generally in #import_without_validations_or_callbacks. This is DRY-er, more consistent between the supports_import? cases and enables us to inline #quote_column_names 2011-01-10 22:11:54 -05:00
Ben Woosley 6b2153a841 Simplify values_sql_for_column_names_and_attributes with #map 2011-01-10 22:11:51 -05:00
Ben Woosley 7aefcf1164 Inline multiple_value_sets_insert_sql because it never changes, isn't particularly well-factored, and for parity with "not supports_import?" 2011-01-10 21:57:41 -05:00
Ben Woosley 2ada56f858 Avoid N << method calls in #import_without_validations_or_callbacks by chaining #map (is simpler, should be more performant, AFAIK) 2011-01-10 21:57:40 -05:00
Ben Woosley fff00af942 Don't initialize options[:on_duplicate_key_update] if the adapter doesn't #supports_on_duplicate_key_update? 2011-01-10 21:57:40 -05:00
Zach Dennis 8fbf841fde Use ActiveRecord Column#type_cast to properly parse fields represented by a string.
Fixed issued reported by Nick Burdick where imported datetime fields was not correctly working with certain string formats for MySQL which doesn't support MM/DD/YYYY format directly.
2011-01-05 19:09:55 -05:00
Zach Dennis cb542a86f4 Updated how activerecord-import loads so it is done after a connection is established in ActiveRecord. This supports loading import for multiple adapters automatically w/o having to have a person require those specifically. 2010-09-26 20:48:14 -04:00
Zach Dennis 163f5c64be Deprecating usage of "require 'activerecord-import/<adapter_name>'" in favor of "require 'activerecord-import'". 2010-09-26 17:07:41 -04:00
Zach Dennis 90057c43eb Renaming ActiveRecord::Extensions to ActiveRecord::Import. 2010-09-26 17:05:02 -04:00
Zach Dennis 948dec0be2 Refactoring to allow for separation of activerecord-import code and activerecord's connection adapters. 2010-09-26 16:51:19 -04:00
Zach Dennis b6c72f8456 Providing support for the Mysql2 adapter. 2010-09-26 16:04:00 -04:00
Zach Dennis e0dff4c055 Moved all adapter specific code into adapters/ directory and updated all adapters to utilize the same "require_adapter" method of loading specific-database adapters.
* Adds back in SQLite3 and PostgreSQL support

issue-url: http://github.com/zdennis/activerecord-import/issues#issue/1 
[contributes #1]
2010-08-10 20:46:32 -04:00
Zach Dennis 4fcfa7fd14 Restructuring directories. 2010-06-26 15:43:34 -04:00
Zach Dennis 5c287f1042 Added back in basic benchmark support. To run:
ruby benchmark/benchmark.rb --adapter mysql --num 1000
  ruby benchmark/benchmark.rb --adapter mysql --num 1000 --to-csv /tmp/results.csv
  ruby benchmark/benchmark.rb --adapter mysql --num 1000 --to-html /tmp/results.html
2010-04-08 23:12:28 -04:00
Zach Dennis 3523138a7a * Added basic import support for PostgreSQL.
* Requiring database adapter is now "require 'ar-extensions/import/<adapter_name>" so it won't conflict with previous versions of ar-extensions or other libraries extracted out of older ar-extensions, which "require 'ar-extensions'"
2010-04-08 20:57:10 -04:00
Zach Dennis 075104a944 Finished porting over MySQL import functionality.
* removed assertions on #num_inserts, that is db-specific and is handled in details by abstract_adapter_test.
2010-03-13 22:30:29 -05:00
Zach Dennis e8271778b7 About 85% through porting over MySQL on duplicate key functionality. 2010-03-13 21:33:03 -05:00
Zach Dennis 5836e449fd Removing unnecessary logger creation. 2010-03-13 20:26:17 -05:00
Zach Dennis d4c120497e Minor refactoring. 2010-03-13 20:20:23 -05:00
Zach Dennis 5c5bd5f716 Implemented tests for #get_value_insert_sets. 2010-03-12 00:04:15 -05:00
Zach Dennis ca5f83e1cf Initial commit of making ar-extensions import Rails 3 friendly 2010-03-11 21:32:56 -05:00