Commit Graph

197 Commits

Author SHA1 Message Date
Aaron Patterson
f290d6f516 prepared statements can be disabled 2012-02-22 10:53:01 -08:00
Jon Leighton
24ade58875 Refactor building the update manager 2011-08-15 23:02:59 +01:00
Jon Leighton
044fb8c3e2 Support updates with joins. Fixes #522.
Conflicts:

	activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
	activerecord/test/cases/relations_test.rb
2011-08-15 23:01:58 +01:00
Jon Leighton
dd944cbf58 Make it the responsibility of the connection to hold onto an ARel visitor for generating SQL. This improves the code architecture generally, and solves some problems with marshalling. Adapter authors please take note: you now need to define an Adapter.visitor_for method, but it degrades gracefully with a deprecation warning for now.
Conflicts:

	activerecord/lib/active_record/relation/finder_methods.rb
	activerecord/test/cases/adapter_test.rb
2011-08-08 23:33:31 +01:00
thedarkone
787194ee43 Bring back the ability to provide :order for update_all. 2011-07-25 16:12:58 +02:00
Jon Leighton
ca94acf0be Foo.joins(:bar).includes(:bar) should result in a single query with :bar as a join. Related: #1873. 2011-07-09 11:39:38 +01:00
Dmitriy Kiriyenko
fd8dbfa776 Add require ActiveSupport delegation to ActiveRecord::Relation class. 2011-07-07 17:09:03 +02:00
Aaron Patterson
0abb7b8c39 default create_with_value to a hash so we can eliminate conditionals, add test surrounding create_with(nil) behavior 2011-06-27 14:19:22 -07:00
Brian Mathiyakom
8a4013ddd0 Fix issue #1272
Set reverse_order_value when asked to reverse_order().
Do the actual reversal in build_arel.
2011-06-01 18:30:14 +01:00
Jon Leighton
b519b0cac9 Fix infinite recursion where a lazy default scope references a scope. Fixes #1264. 2011-05-25 00:18:08 +01:00
Jon Leighton
63a659847b Ensure that the surrounding code in Relation#to_a respects the default_scope (as well as having Relation#arel respect the default scope). Fixes #1233. 2011-05-25 00:17:15 +01:00
Aaron Patterson
1d7c0336ef using bind parameters for updates 2011-04-30 17:27:46 -07:00
Aaron Patterson
f1df6b2dce postgresql supports prepare statement deletes 2011-04-29 11:09:37 -07:00
Ken Collins
35d0b6029f Use existing #empty_insert_statement_value for an insert with no columns. 2011-04-24 12:52:28 -04:00
Ken Collins
bc50c1cb02 The #substitute_at gets an ActiveRecord::ConnectionAdapters::Column in #insert to match replacement in #exec_query. 2011-04-23 00:15:33 +08:00
Aaron Patterson
9951af0289 sort insert columns for better cache hits 2011-04-14 14:26:57 -07:00
Aaron Patterson
12ae92216b refactoring inserts to use the same method on the connection 2011-04-14 13:37:40 -07:00
Aaron Patterson
8571facea3 insert statements are prepared, but values are not escaped properly 2011-04-14 13:37:39 -07:00
Jon Leighton
788bd30859 ActiveRecord::Base.scopes hash is not needed 2011-04-12 19:46:04 -07:00
Jon Leighton
8572ae6671 Evaluate default scopes at the last possible moment in order to avoid problems with default scopes getting included into other scopes and then being unable to remove the default part via unscoped. 2011-04-12 19:46:04 -07:00
Jon Leighton
5740d4ec0c Deprecated support for passing hashes and relations to default_scope, in favour of defining a 'default_scope' class method in the model. See the CHANGELOG for more details. 2011-04-12 19:46:04 -07:00
Emilio Tagua
b35617235d Use IM when trying to load records using ID.
Signed-off-by: José Valim <jose.valim@gmail.com>
2011-04-04 10:48:12 +02:00
Andrew White
555d016389 Quote find_in_batches ORDER BY clause [#6620 state:resolved] 2011-03-29 17:24:55 +01:00
Aaron Patterson
15d3cc21f4 pushing id insertion and prefetch primary keys down to Relation#insert 2011-03-22 09:18:01 -07:00
Chris Oliver
015192560b Fixed a bug when empty? was called on a grouped Relation that wasn't loaded
[#5829 state:resolved]

Signed-off-by: Andrew White <andyw@pixeltrix.co.uk>
2011-03-12 22:31:21 +00:00
Jon Leighton
532f915037 Referencing a table via the ON condition in a join should force that table to be eager-loaded via a JOIN rather than via subsequent queries. 2011-03-07 08:51:17 -08:00
Jon Leighton
d90b4e2615 Rewrote AssociationPreload. 2011-02-28 22:12:34 +00:00
Aaron Patterson
8fc54a2e81 only take the limit if there is a limit to take 2011-02-25 14:24:05 -08:00
Aaron Patterson
4bd8d2607c Relation will delegate to AR::Base which already uses the Dynamic finders, so eliminate duplicate calls 2011-02-22 11:07:51 -08:00
Rodrigo Navarro
62fd334684 Adding new examples for update_all method 2011-02-20 22:22:52 -03:00
Rodrigo Navarro
4da0157aaf Adding examples 2011-02-20 22:03:29 -03:00
Emilio Tagua
8ee0b44148 Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/examples/performance.rb
	activerecord/lib/active_record/association_preload.rb
	activerecord/lib/active_record/associations.rb
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/nested_attributes.rb
	activerecord/test/cases/relations_test.rb
2011-02-15 12:01:04 -03:00
Aaron Patterson
1c6f4562d7 primary keys should not be cleared on cache clear, fixing oracle tests 2011-02-08 16:01:16 -08:00
Jon Leighton
2120da7f73 ActiveRecord::Relation#primary_key should return a string, just like ActiveRecord::Base.primary_key does. 2011-01-03 16:24:32 -08:00
Aaron Patterson
23b03baba6 use the sql literal factory method 2010-12-24 16:01:07 -07:00
Aaron Patterson
0fbf829b1e stop the recursive insanity 2010-12-24 15:59:02 -07:00
Aaron Patterson
34d79fad85 setting the primary key on the update manager 2010-12-24 15:59:02 -07:00
Raimonds Simanovskis
2b795050de fixed retrieval of primary key value in Ralation#insert method
previously primary key value was always assigned nil which caused Oracle enhanced adapter failing tests
2010-12-23 23:22:00 +08:00
Emilio Tagua
02fc6fbccd Merge remote branch 'rails/master' into identity_map
Conflicts:
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/persistence.rb
2010-12-20 11:23:07 -03:00
Aaron Patterson
63480d234d stop delegating inserts to ARel, use the INSERT SQL ourselves 2010-12-16 01:49:29 +05:30
Aaron Patterson
b0fc912f1b avoid deprecate api 2010-12-02 15:50:34 -08:00
Aaron Patterson
ead0c6eed3 removing more calls to deprecated methods 2010-12-02 15:07:00 -08:00
Aaron Patterson
39f5fc06cb just call join_sql against the manager object 2010-11-30 16:42:21 -08:00
Aaron Patterson
fe522f79c7 we already know it is already an array, so we do not need to make really really sure it is an array 2010-11-30 15:53:04 -08:00
Aaron Patterson
ae6033331f shorten up scope_for_create 2010-11-30 15:48:15 -08:00
Aaron Patterson
dccf624b64 Ruby 1.8, how does it work? 2010-11-30 15:20:27 -08:00
Aaron Patterson
c856e25b32 removing arel 1.0 compatibility 2010-11-30 14:56:53 -08:00
Aaron Patterson
6c32290bac testing Relation#table_name 2010-11-30 14:29:35 -08:00
Aaron Patterson
b6848b6491 cleaning up where_values_hash 2010-11-30 12:05:02 -08:00
Emilio Tagua
7892543a88 Don't change tests, fix code: if locking is enabled skip IM. 2010-11-19 19:08:57 -03:00