Commit Graph

1956 Commits

Author SHA1 Message Date
Nick Sieger
8e5e02bdad Collapse connection pool class hierarchy; YAGNI.
- Add connection checkin and checkout callbacks to adapter to allow
  adapter-specific customization of behavior (e.g., JRuby w/ JNDI)
2008-08-29 14:12:12 -05:00
Nick Sieger
d07a6b1a4a Make clear_active_connections! also return stale connections back to the pool
- also clean up some cruft remaining from per-thread connection cache
2008-08-29 14:12:12 -05:00
Nick Sieger
212134dce1 Remove CachedConnectionPerThread per-thread pooling mechanism in favor of a fixed pool with default maximum of 5 connections 2008-08-29 14:12:12 -05:00
Nick Sieger
ca6d71753f Deprecate allow_concurrency and make it have no effect 2008-08-29 14:12:12 -05:00
Nick Sieger
a96b7d4c33 Add connection reset and verification upon each connection checkout 2008-08-29 14:12:12 -05:00
Nick Sieger
d7d2d73d88 Fix typo: was using brackets instead of parens. Must need more sleep. 2008-08-29 14:12:11 -05:00
Nick Sieger
1712e37c90 Favor existing connections over new ones if available 2008-08-29 14:12:11 -05:00
Nick Sieger
817a07b451 More doco and class/method renames. Now have a strategy for integration with ActionPack. 2008-08-29 14:12:11 -05:00
Nick Sieger
3ce64d4f16 Fix checkin method, add a couple more tests 2008-08-29 14:12:11 -05:00
Nick Sieger
fe575dd4a9 Nearing the finish line. Initial fixed-size connection pool implemented, more docs 2008-08-29 14:12:11 -05:00
Nick Sieger
82fcd9d85f Clean up the code, get rid of reserve/release, add some more docs 2008-08-29 14:12:10 -05:00
Nick Sieger
029952edf4 Extract a base class for connection pools, start to flesh out reserve/release API 2008-08-29 14:12:10 -05:00
Nick Sieger
72d959d9b5 Split connection handler into single- and multiple-thread versions. 2008-08-29 14:12:10 -05:00
Nick Sieger
ff97e9d029 Connection handling methods extracted out into separate ConnectionHandler class
- delegating methods left behind
2008-08-29 14:12:10 -05:00
Nick
37b0b36918 Fix failure to retain value of allow_concurrency
- Also carry allow_concurrency value through to connection adapter
  (for postgresql)
2008-08-29 14:12:09 -05:00
Nick
cab76ce6ac Add synchronization to connection pool also 2008-08-29 14:12:09 -05:00
Nick
50cd4bdc99 Introduce synchronization around connection pool access
- use new active support Module#synchronize
- allow_concurrency now switches between a null monitor and a
  regular monitor (defaulting to null monitor to avoid overhead)
2008-08-29 14:12:09 -05:00
Nick
5879b15f23 Rename defined_connections to connection_pools
- Distinguis meaning of "active_connections" to always mean connections
  associated with the current thread
2008-08-29 14:12:08 -05:00
Nick
6edaa26717 Initial conversion to connection pool
So far so good, tests still run clean. Next steps: synchronize connection pool access
and modification, and change allow_concurrency to simply switch a real lock for a
null lock.
2008-08-29 14:12:08 -05:00
Eugene Pimenov
743f0e7114 Make case insensitive validates_uniqueness_of use unicode aware downcase method.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-29 20:24:20 +02:00
Nick Sieger
a9086b3daa Make query-cache thread-local
Signed-off-by: Joshua Peek <josh@joshpeek.com>
2008-08-29 10:21:39 -05:00
Jan De Poorter
db116a2ed6 Fix NamedScope regex so methods containing "an" get delegated to proxy_found. [#901 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
2008-08-29 14:06:37 +01:00
Andrew White
db22c89543 Merge scoped :joins together instead of overwriting them. May expose scoping bugs in your code!
[#501 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 12:07:15 -07:00
Ernie Miller
44af2efa2c Refactored AssociationCollection#count for uniformity and Ruby 1.8.7 support.
[#831 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-28 11:58:25 -07:00
Tarmo Tänav
96c6fe0842 Implement count limit/offset support for has_many associations
[#348 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:32:21 -07:00
Tarmo Tänav
13671cc565 Alias included associations if needed when doing a count
[#302 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:29:29 -07:00
Tom Lea
ad562c58ea Dirty: treat two changes resulting in the original value as being unchanged.
[#798 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-27 23:13:41 -07:00
Lars Kanis
c2068d14d2 PostgreSQL: fix quote_string for certain old pg drivers. [#94 state:resolved] 2008-08-27 22:51:10 -07:00
Jeremy Kemper
a444c78212 respond_to? passes along splat args to avoid introducing the second arg if it was omitted 2008-08-27 21:32:51 -07:00
Jeremy Kemper
657898c821 Merge commit 'sven/i18n'
Conflicts:
	activesupport/lib/active_support.rb
2008-08-27 12:31:07 -07:00
pivotal
9dbde4f5cb Fix two has_one :through errors
* Set the association target on assignment;
* Reset target to nil on reset, rather than empty array.

Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#895 state:committed]
2008-08-27 11:22:15 +02:00
Marko Seppae
0fcd5b5466 I18n: removed call to #populate from main library files 2008-08-27 10:36:00 +02:00
Joshua Peek
8756dd75b2 Performance: reduce garbage created by ActiveRecord::Calculations#column_alias_for 2008-08-26 14:24:52 -05:00
Tarmo Tänav
3dfecfe773 Print the queries that were executed if assert_queries fails 2008-08-26 12:45:04 +02:00
Jeremy Kemper
e06878c22b Merge branch 'master' of git@github.com:rails/rails 2008-08-26 03:04:14 -07:00
Tarmo Tänav
00d2165f74 Back to fetching all versions in ruby instead of letting SQL do it as it's difficult to get all databases to convert the text value to a number with the same SQL
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-26 03:00:36 -07:00
Jeremy Kemper
b319e69ecb PostgreSQL: pg driver expects nil instead of empty string for missing user/pass 2008-08-26 01:54:14 -07:00
Josh Susser
1092c181b5 add dynamic finder bang version to raise RecordNotFound
[#905 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 23:33:16 -07:00
Josh Susser
143f5fbb21 refactor dynamic finder name matching into its own class
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 23:32:20 -07:00
Tarmo Tänav
77b003fb61 Use DECIMAL instead of INTEGER when casting as mysql doesn't work with just "INTEGER" and other databases don't like "UNSIGNED" which mysql requires
And don't mask exceptions.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 23:23:34 -07:00
Tarmo Tänav
3d2ac918b9 Cache migrated versions list in Migrator and use it to fetch the latest migrated version name [#845 state:resolved]
Also optimized Migrator#current_version class method to fetch
only the latest version number and not all of them.

With this change no matter how many migrations there are the
schema_migrations table is only SELECTed from once.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 22:03:47 -07:00
Tarmo Tänav
a445cdd884 Load the first and not the last has_one result when doing join-based eager loading
This matters when the has_one is defined with an order in which case
there is an expectation that the first one will be loaded.

[#904 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 21:23:35 -07:00
Frederick Cheung
2dbda11945 Implement old-skool eagerloading for has_one :through
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 21:23:15 -07:00
Jeremy Kemper
172606e21f Harmonize framework require strategy. Don't add self to load path since Rails initializer and RubyGems handle it. 2008-08-25 21:22:34 -07:00
Frederick Cheung
b7a37b742c Fix preloading of has_one through associations
[#903 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2008-08-25 20:49:55 -07:00
Michael Koziarski
33ed19f428 Merge branch 'patches' 2008-08-24 14:34:47 +02:00
Xavier Noria
e02f0dcc24 Rollback the transaction when a before_* callback returns false.
Previously this would have committed the transaction but not carried out save or destroy operation.

[#891 state:committed]
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-08-24 14:34:24 +02:00
Jeremy Kemper
c471f13db6 Ruby 1.9 compat: Hash is now flattenable, so explicitly exclude it 2008-08-23 21:26:14 -07:00
Tarmo Tänav
74c3c701f7 Don't set "NULL" as a constraint on nullable columns [#398 state:resolved]
This is already the default and adding it breaks SQL standards compatibility.
2008-08-23 19:51:09 +03:00
Tarmo Tänav
cf28109158 Always require activesupport, even if its constant already exists
This is needed because the existance of the ActiveSupport
constant by itself does not guarantee that the whole library
has been loaded.

Also load the StringInquirer in the Rails#env method as
the it might be called inside the initializer block
before activesupport itself has been loaded.
2008-08-23 18:05:52 +03:00