| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|\
| |
| | |
Make `name` and `binds` to optional args for `exec_{insert,update,delete}`
|
| |
| |
| |
| |
| |
| | |
`insert`, `update`, `delete`, and `exec_query` have a default value
against `name` and `binds`. But `exec_insert`, `exec_update`, and
`exec_delete` not have. It is an inconvenience and inconsistent.
|
| | |
|
|/ |
|
|\
| |
| |
| |
| |
| | |
Introduce new ActiveRecord transaction error classes
Closes #26018
|
| | |
|
| | |
|
|\ \ |
|
| | |
| | |
| | |
| | | |
- Followup of https://github.com/rails/rails/pull/23179.
|
|\ \ \
| | | |
| | | | |
Remove `prepare_binds_for_database` internal method
|
| | | |
| | | |
| | | |
| | | | |
To avoid relying on the connection adapter for type casting binds.
|
|\ \ \ \
| | | | |
| | | | | |
Prevent `table_comment` query if a table doesn't have a comment
|
| | | | | |
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
kamipo/avoid_calling_current_database_in_table_comment
Avoid calling `current_database` in `table_comment`
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | | |
`current_database` executes a query and `table_comment` is called to all
tables even if a table does not have a comment. Using `current_database`
increases extra queries.
|
|/ / / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Caching a mutable string causes the following issue.
```
Loading development environment (Rails 5.1.0.alpha)
irb(main):001:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!"
irb(main):002:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!!!"
irb(main):003:0> ActiveRecord::Base.connection.quote_table_name('foo') << '!!'
=> "`foo`!!!!!!"
```
|
| | | |
| | | |
| | | | |
[Rafael Mendonça França + Takeshi AKIMA]
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/decouple_statement_cache_from_connection_adapter
Decouple statement cache from connection adapter
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
`StatementCache` is hard-coded in `cacheable_query` and be passed
`visitor` and `collector` from connection adapter. Simply it is
enough to pass a collected value.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Quoting booleans should return a frozen string
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
If reuse `QUOTED_TRUE` and `QUOTED_FALSE` without frozen, causing the
following issue.
```
Loading development environment (Rails 5.1.0.alpha)
irb(main):001:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo"
irb(main):002:0> ActiveRecord::Base.connection.quote(true) << ' foo'
=> "1 foo foo"
irb(main):003:0> type = ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString.new
=> #<ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::MysqlString:0x007fd40c15e018 @precision=nil, @scale=nil, @limit=nil>
irb(main):004:0> type.serialize(true) << ' bar'
=> "1 foo foo bar"
irb(main):005:0> type.cast(true) << ' bar'
=> "1 foo foo bar bar"
```
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
Extract `type_casted_binds` method
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Because `type_cast` against `binds` always requires
`attr.value_for_database` and this pattern appears frequently.
|
| |/ / / /
|/| | | | |
|
|/ / / /
| | | |
| | | |
| | | |
| | | | |
Where appropriatei, prefer the more concise Regexp#match?,
String#include?, String#start_with?, or String#end_with?
|
|\ \ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
kamipo/move_warning_about_composite_primary_key_to_attribute_methods_primary_key
Move the warning about composite primary key to `AttributeMethods::PrimaryKey`
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Actually schema dumper/creation supports composite primary key (#21614).
Therefore it should not show the warning about composite primary key in
connection adapter.
This change moves the warning to `AttributeMethods::PrimaryKey` and
suppress the warning for habtm join table.
Fixes #25388.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Do not `binds.dup` in `connection#to_sql`
|
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Because `connection#to_sql` does not mutate `binds`.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Refactored method `ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`. Refactored test `HasManyAssociationsTest#test_do_not_call_callbacks_for_delete_all`.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
`ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#default_sequence_name`
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
`specificiation_id` was renamed to `spec_name`
|
| |/ / / / / / |
|
|\ \ \ \ \ \ \
| |_|/ / / / /
|/| | | | | | |
Fix `payload[:class_name]` to `payload[:spec_name]`
|
| |/ / / / /
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Follow up to #20818.
`retrieve_connection` is passed `spec_name` instead of `klass` since #24844.
|
|/ / / / /
| | | | |
| | | | |
| | | | | |
Address to https://github.com/rails/rails/commit/5a302bf553af0e6fedfc63299fc5cd6e79599ef3#commitcomment-18288388.
|
|\ \ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
jeremywadsack/use_transactional_fixtures_all_databases
Use notification to ensure that lazy-loaded model classes have transactions
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
loaded model classes have their connections wrapped in transactions.
See #17776
In Rails 4 config.eager_load was changed to false in the test environment. This
means that model classes that connect to alternate databases with
establish_connection are not loaded at start up. If use_transactional_fixtures
is enabled, transactions are wrapped around the connections that have been
established only at the start of the test suite. So model classes loaded later
don't have transactions causing data created in the alternate database not to
be removed.
This change resolves that by creating a new connection.active_record
notification that gets fired whenever a connection is established. I then added
a subscriber after we set up transactions in the test environment to listen for
additional connections and wrap those in transactions as well.
|
|/ / / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Keeps schema migration inserts as a single commit, so we still get all of the
benefits of https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a78,
but allows for easier git diff-ing. Fixes #25504.
|
| |_|/ /
|/| | | |
|
| | | |
| | | |
| | | |
| | | | |
This includes minor grammar fixes throughout the file.
|
|\ \ \ \
| | | | |
| | | | | |
Don't reap connections that have already been reassigned
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This way, we aren't racing other threads, so we don't need to re-check
the conditional. And we no longer need to hold the lock while calling
remove (which can choose to make a new connection while we wait).
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
A concurrent thread may have also detected it to be stale, and already
released (or even reassigned) it by now.
Fixes #25585
|
| |/ / /
| | | |
| | | |
| | | |
| | | | |
A thread can only release a connection if it owns it, or it's owned by a
thread that has died.
|
|/ / / |
|
|\ \ \
| | | |
| | | |
| | | |
| | | | |
bquorning/optimize-for-first-result-and-remove-mysql-select_one
Remove #select_one from Mysql2Adapter
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The implementation from abstract/database_statements.rb seems to work just fine.
And with ActiveRecord::Result now implementing an optimized #first method, the
performance concerns previously addressed in
https://github.com/rails/rails/commit/bf79aa4fc14aeb2646331e767038acf0b77e9e7f
should not be an issue.
|