Ken Collins
ed2820d6ec
Move #exec_insert to abstract adapter's database statements.
2011-04-22 22:32:55 +08:00
Aaron Patterson
724a786677
stop using distinct on for the unique id queries. [ #6450 state:resolved]
2011-04-21 22:47:13 -05:00
José Valim
30472d4244
Avoid define_method if possible.
2011-04-19 17:58:06 +02:00
Jon Leighton
019cd51a3f
Bring back support for passing a callable object to the default_scope macro. You can also just use a block.
2011-04-18 23:35:22 +01:00
Jon Leighton
6f84c73dc4
Un-deprecate using 'default_scope' as a macro, but if you are calling the macro multiple times that will give deprecation warnings, and in 3.2 we will simply overwrite the default scope when you call the macro multiple times.
2011-04-18 23:15:38 +01:00
Jon Leighton
b839d40933
Fix test_load_save in test/cases/binary_test.rb (thanks @tenderlove for actually working out how to fix it)
2011-04-17 22:30:27 +01:00
Jon Leighton
2a5e317951
Fix test_associate_existing in has_many_through_associations_test on mysql and postgresql
2011-04-17 21:58:47 +01:00
Jon Leighton
28146378d3
Bring back some bits of documentation for scopes which were removed as part of the reversion in 256b363
2011-04-17 20:55:24 +01:00
Jon Leighton
256b363eee
Revert "Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead."
...
This reverts commit f0e198bfa1 .
Conflicts:
activerecord/test/models/post.rb
2011-04-17 20:47:52 +01:00
Jason Weathered
0fd0d68962
Bypass IdentityMap in PostgreSQL geometric tests.
...
The identity map cache prevents us from seeing the DB formatted strings.
2011-04-17 23:51:20 +10:00
Jon Leighton
65469a6e5e
Return nil from read_attribute(:foo) if 'foo' is not present in the @attributes hash, but the _foo method has been defined. This brings the behaviour into line with the 3-0-stable branch and the master branch before 93641ed6c8 (there were previously no assertions about this which is why the change slipped through). Note that actually calling the 'foo' method will still raise an error if the attribute is not present.
2011-04-15 13:27:08 +01:00
Jon Leighton
e01dfb27fc
Undo performances regressions I introduced in bbe0a507f2 and add test for an edge case. Add comments to explain the intent of the code.
2011-04-15 13:09:12 +01:00
Jon Leighton
e68a83c9ec
Refactor test to avoid hackery
2011-04-15 02:19:11 +01:00
Jon Leighton
bbe0a507f2
Remove unnecessary code from define_read_method and add assertion to make sure the underscored version is actually generated
2011-04-15 01:44:27 +01: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
0268eac963
mimic prepared statements in the exec_insert for mysql2
2011-04-14 13:37:40 -07:00
Aaron Patterson
a22ceaeefa
mysql type cast should return integers when typecasting true / false
2011-04-14 13:37:39 -07:00
Aaron Patterson
a0d4c8d1bf
using the database adapter to typecast before executing prepared statement
2011-04-14 13:37:39 -07:00
Aaron Patterson
27f8c57f5f
inserting big decimals as strings works consistently among dbs, so use string form
2011-04-14 13:37:39 -07:00
Aaron Patterson
8571facea3
insert statements are prepared, but values are not escaped properly
2011-04-14 13:37:39 -07:00
Aaron Patterson
4893170da2
adding a type cast method for prepared statements
2011-04-14 13:37:38 -07:00
Jon Leighton
6b6ecbefad
Extract the constraint-building for joins in JoinAssociation into a separate method to make it easy to change/override (requested by Ernie Miller so that MetaWhere can add to it easily)
2011-04-14 19:34:19 +01:00
Stian Grytøyr
93641ed6c8
Fixes performance issue introduced in 3.0.6 (issue #6695 )
2011-04-14 08:56:02 -07:00
Aaron Patterson
1f4dae9daa
do not depend on to_yaml being called, but rather depend on YAML being dumped
2011-04-13 11:41:42 -07:00
Aaron Patterson
eebb19c954
use index based substitution for bind parameters
2011-04-13 09:42:51 -07:00
Prem Sichanugrist
733bfa63f5
Remove #among? from Active Support
...
After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now.
It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
2011-04-13 20:25:28 +08:00
Aaron Patterson
1b5b53da5e
common @jonleighton 💣
2011-04-12 20:29:35 -07:00
Jon Leighton
f0e198bfa1
Deprecate defining scopes with a callable (lambda, proc, etc) via the scope class method. Just define a class method yourself instead.
2011-04-12 19:46:05 -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
Jon Leighton
fc9a04b6a6
Removing the scope-caching which happens on association proxies, because the query is already cached by the query cacher. For formalised proof see http://www.youtube.com/watch?v=wDefXLb-FDs
2011-04-12 19:46:04 -07:00
Aaron Patterson
b53ffb35e0
stop using deprecated methods in arel
2011-04-11 15:50:05 -07:00
David Heinemeier Hansson
d1575ae1b9
Change Object#either? to Object#among? -- thanks to @jamesarosen for the suggestion!
2011-04-12 00:23:07 +02:00
Aaron Patterson
5918b868b2
remove so many nested if statements
2011-04-11 15:19:10 -07:00
Aaron Patterson
622f23b604
wrap the pg_get_serial_sequence function and reuse it for the default sequence name
2011-04-11 14:38:42 -07:00
Aaron Patterson
75dc9fbac7
cache table exists queries in prepared statement cache
2011-04-11 14:12:31 -07:00
Aaron Patterson
f6c0c8ff61
only use the primary_key method, refactor schema and table name parsing
2011-04-11 14:08:27 -07:00
Aaron Patterson
a9e8554b46
use prepared statements for primary key queries
2011-04-11 13:57:00 -07:00
Aaron Patterson
5df072d64b
last insert id can never be called, so remove that code path
2011-04-11 13:10:20 -07:00
Aaron Patterson
9ba94c8fc4
we know the table and pk, so we can calculate a default sequence name
2011-04-11 10:54:08 -07:00
Aaron Patterson
cbb65de1a6
always look up pk and sequence unless both are provided
2011-04-11 10:37:23 -07:00
Aaron Patterson
302b6f3f73
pg does not know the insert_id in advance, so super will never return true
2011-04-11 10:31:13 -07:00
Aaron Patterson
4c30304e15
updating the docco for ActiveRecord::Result
2011-04-11 10:10:01 -07:00
Aaron Patterson
269cd1b3c5
implement exec_query on mysql2 adapter
2011-04-11 10:10:01 -07:00
Aaron Patterson
8a11799a47
make sqlite insert_sql more consistent with other adapters
2011-04-11 10:10:01 -07:00
Aaron Patterson
58259bbf29
adding exec_insert for postgresql
2011-04-11 10:10:01 -07:00
Aaron Patterson
b1ba04b32b
fixing variable name in mysql test
2011-04-11 10:10:01 -07:00
Aaron Patterson
90a371496a
properly name schema queries for the logger
2011-04-11 10:10:01 -07:00