Commit graph

80 commits

Author SHA1 Message Date
Jamie Cobbett 6555fd70ba Correctly obey MySQL MAX PACKET
Use String's bytesize instead of size, because we're talking about byte length,
not string length. This resolves a problem on Ruby 1.9 with multi-byte
characters.
2011-05-08 21:35:47 +00:00
Zach Dennis 5b3740e0f2 Updating import_test to be Ruby 1.9.2 compatible. Ruby 1.9.1 changed the Date.parse capabilities to no longer support MM/DD/YYYY functionality so we only test against YYYY/MM/DD.
[fixes https://github.com/zdennis/activerecord-import/issues/19]
2011-05-04 19:55:46 -04:00
Zach Dennis e079e19a29 Version bump to 0.2.7 2011-04-29 00:13:40 -04:00
Zach Dennis 5aefbb2989 Do not use ActiveRecord::Base.new(hsh) when instantiating AR models. Use form of instantiation that allows protected attributes to be set. 2011-04-29 00:13:26 -04:00
Zach Dennis 71184b2903 Version bump to 0.2.6 2011-04-06 14:42:56 -04:00
Zach Dennis 574ce5c76b Version bump to 0.3.0 2011-04-06 14:42:33 -04:00
Zach Dennis 89662a67c2 Updating documentation for synchronize.
https://github.com/zdennis/activerecord-import/issues/16
2011-04-06 14:41:42 -04:00
Zach Dennis 58b144b6bf Updating documentation for synchronizing unsaved/new instances with import.
https://github.com/zdennis/activerecord-import/issues/16
2011-04-06 14:23:13 -04:00
Zach Dennis 7958ed18c2 Added :synchronize_keys to the import options so importing can synchronize on fields beside the primary key.
https://github.com/zdennis/activerecord-import/issues/16
2011-04-06 14:20:53 -04:00
Zach Dennis e00e9d7d59 Adding in support for :synchronization option for #import. Pulled in from ar-extensions. Currently only works with MySQL since that is the only database that supports on duplicate key update functionality.
https://github.com/zdennis/activerecord-import/issues#issue/6
2011-03-19 15:49:26 -04:00
Zach Dennis 319c52d80f Pulled in ActiveRecord synchronize functionality from the old ar-extensions code base.
https://github.com/zdennis/activerecord-import/issues#issue/6
2011-03-19 15:38:24 -04:00
Zach Dennis 9e6866fd29 Turning off warnings because FactoryGirl spews out crap and it makes it impossible to see anything useful. 2011-03-19 15:21:04 -04:00
Zach Dennis 32a2fe3bce Adding a test to ensure that specified ids are being saved when imported.
https://github.com/zdennis/activerecord-import/issues#issue/4
2011-03-19 15:20:44 -04:00
Franck Verrot d901a7c60f Importing an empty array of objects/values should be supported 2011-03-19 15:11:28 -04:00
Zach Dennis 2517770a38 Updating .gitignore with more entries 2011-03-19 15:04:54 -04:00
Zach Dennis c77f0ffad3 Turning warnings on in rake test. 2011-03-19 15:03:39 -04:00
Zach Dennis 0efb8f21e2 Updating gemfile to use spermy operator where appropriate. 2011-03-19 15:03:27 -04:00
Zach Dennis 5218b384de Version bump to 0.2.5 2011-01-11 21:02:07 -05:00
Zach Dennis cb6b726eac Ensure the #max_allowed_packet method exists for the MysqlAdapters.
https://github.com/zdennis/activerecord-import/issues#issue/12
2011-01-11 21:01:34 -05:00
Zach Dennis 1175bafe0e Adding test file pattern to ensure connection adapter tests are included. 2011-01-11 20:57:00 -05:00
Zach Dennis 161cf017f9 Renamed #values_sql_for_column_names_and_attributes to #values_sql_for_columns_and_attributes and cleaned up how it dealt with columns.
* added back in the support for type-casting based on the database column
* removed unused method in ActiveRecord::Import::AbstractAdapter

https://github.com/zdennis/activerecord-import/issues#issue/5
2011-01-10 22:36:52 -05:00
Ben Woosley 1a8082444b Simplify validations_arry_for_column_names_and_attributes with map, each_with_index and Hash.
Hash[column_names.zip(attributes)] would be much clearer, but would leave nil values for missing attributes which doesn't match the existing behavior.
2011-01-10 22:27:24 -05:00
Ben Woosley c9f246f4e2 Consolidate insert_sql between supports_import? cases so both make use of options[:ignore] 2011-01-10 22:27:23 -05:00
Ben Woosley 9727a04362 Reinstate the deleting of the :validate option - not because it was causing trouble, but to be a bit paranoid (reverts 63d6faeccee14b6e571a25b6f51f340d5da325f5) 2011-01-10 22:27:23 -05:00
Ben Woosley a3e9b4f040 Enable ImportSupport on Postgresql - the test suite now passes in full 2011-01-10 22:27:23 -05:00
Ben Woosley 7bd0e2693a Fix that values_sql_for_attributes wasn't accessing the columns with the same indexes as the array_of_attributes, and so was sometime mismatched.
Also return to the column_names[j] == primary_key style of testing, as the column itself is not always present
2011-01-10 22:27:22 -05:00
Ben Woosley df75eea4db Go more direct in the columns lookup 2011-01-10 22:26:39 -05:00
Ben Woosley 35786fef17 Codify import results in a Struct rather than OpenStruct, as it's a faster, more rigid structure 2011-01-10 22:12:34 -05:00
Ben Woosley 876546c584 #dup array_of_attributes a bit earlier - there's no point in duping the primary_key nulls we might put in next 2011-01-10 22:12:34 -05:00
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
Ben Woosley b3dda82c10 :check_dependencies task isn't provided by Jeweler when a Gemfile is around. See: https://github.com/technicalpickles/jeweler/blob/master/lib/jeweler/tasks.rb 2011-01-10 21:57:40 -05:00
Ben Woosley 0bbc24ba38 Keep test/database.yml out of the project so others can keep their own around 2011-01-10 21:57:40 -05:00
Ben Woosley b1c73ffac2 Update test/database.yml.sample from test/database.yml 2011-01-10 21:57:40 -05:00
Ben Woosley 7f1e4b4a4b Discriminate between ruby 1.9 and 1.8 in the bundle so we don't blow up on ruby-debug 2011-01-10 21:57:40 -05:00
Zach Dennis 3a91f37c2a Updating Gemfile to include rake so it works with rvm and bundler without complaint 2011-01-05 19:12:48 -05:00
Zach Dennis f8a30f4665 Version bump to 0.2.4 2011-01-05 19:11:09 -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 8e266f74f7 Version bump to 0.2.3 2010-11-03 10:55:36 -04:00
Zach Dennis e873a4aea2 No longer support 3.0.0rc, force rails ~> 3.0.0. Resolves dependency issue where gem was installing activesupport and activemodel 3.0.0rc versions even when 3.0.0 or 3.0.1 were installed 2010-11-03 10:55:36 -04:00
Zach Dennis fdb3dc9578 Version bump to 0.2.2 2010-10-05 22:38:31 -04:00
Zach Dennis 6c9cbc096c Updatin to not depend on Rails 3, only ActiveRecord, both in gem file and in tests 2010-10-05 22:38:18 -04:00
Zach Dennis 142a61aaa9 Version bump to 0.2.1 2010-10-05 11:28:48 -04:00
Zach Dennis 6783a34902 Updating Gemfile to work with Rails 3.0.0rc and 3.0.0 or higher.
resolves http://github.com/zdennis/activerecord-import/issues#issue/2
2010-10-05 11:28:26 -04:00