aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Refactor AR::Result or inherits. Because we have redundant codes aboutkennyj2012-08-221-8/+1
|
* teaching the mysql adapter how to typecast strings returned from the databaseAaron Patterson2012-07-131-2/+132
|
* Fixing texts; down to three failing tests.Jeremy Cole2012-07-131-14/+23
| | | | | Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
* Only use prepared statements when bind variables are presentJeremy Cole2012-07-131-34/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prepared statements (prepare/execute/close) were being used unnecessarily when no bind variables were present, and disabling prepared statement using prepared_statements:false was principally broken. While bind variables were correctly substituted with prepared_statements:false, the prepared statement interface was still used, costing an extra two round trips per query. In addition to making this behavioral change, I also cleaned up the internals of exec_stmt and exec_without_stmt so that they behave the same (calling log and constructing the ActiveRecord::Result in the same way). Moving the check for binds.empty? to exec_query also will mean that several code paths explicitly calling exec_without_stmt could be cleaned up to once again call exec_query instead. I have also left the check for binds.empty? in exec_stmt, since it is not a private method and could be called directly with an empty binds array. For the sake of clarity in this patch, I have not made those changes. = The previous behavior = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has already been removed and substituted with the value, but the prepared statement interface is used anyway: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit = With this patch applied = When issuing a Foo.find(1) with prepared_statements:true, the bind variable is present in the prepared query, and execute shows a value passed: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Prepare SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = ? LIMIT 1 Execute SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Close stmt Quit When issuing a Foo.find(1) with prepared_statements:false, the bind variable has been removed and substituted with the value, and the query interface is used instead of the prepared statement interface: Connect root@localhost on rails_test Query SET SQL_AUTO_IS_NULL=0 Statistics Query SHOW FULL FIELDS FROM `foos` Query SHOW TABLES LIKE 'foos' Query SHOW CREATE TABLE `foos` Query SELECT `foos`.* FROM `foos` WHERE `foos`.`id` = 1 LIMIT 1 Quit
* Add config option, rdoc, tests for mysql(2) STRICT_ALL_TABLES mode.Michael Pearson2012-05-051-2/+5
|
* Default to 'strict mode' in MySQLMichael Pearson2012-05-051-0/+5
|
* use Process.pid rather than $$Aaron Patterson2012-02-161-1/+1
|
* made the result set object act more like an arrayAaron Patterson2012-01-311-1/+1
|
* Support establishing connection on ActiveRecord::Model.Jon Leighton2011-12-281-1/+1
| | | | | This is the 'top level' connection, inherited by any models that include ActiveRecord::Model or inherit from ActiveRecord::Base.
* remove checks for encodings availabilitySergey Nartimov2011-12-251-46/+42
|
* I herd you like modules.Jon Leighton2011-12-241-2/+2
|
* Only use LOWER for mysql case insensitive uniqueness check when column has a ↵Joseph Palermo2011-10-091-2/+2
| | | | case sensitive collation.
* LRU cache in mysql and sqlite are now per-process caches.Aaron Patterson2011-09-071-11/+16
|
* Database adapters use a statement pool.Aaron Patterson2011-09-061-1/+2
| | | | | | Database adapters use a statement pool for limiting the number of open prepared statments on the database. The limit defaults to 1000, but can be adjusted in your database config by changing 'statement_limit'.
* adding a statement pool for mysql and sqlite3Aaron Patterson2011-09-061-4/+29
|
* Move the bulk alter table code into the abstract mysql adapter, hence it is ↵Jon Leighton2011-08-291-47/+0
| | | | supported for mysql2 as well now.
* Extract simplified_type into the abstract classJon Leighton2011-08-291-7/+3
|
* Create an AbstractMysqlAdapter to abstract the common code between ↵Jon Leighton2011-08-291-569/+98
| | | | MysqlAdapter and Mysql2Adapter.
* prevent sql injection attacks by escaping quotes in column namesAaron Patterson2011-08-161-1/+1
|
* Use new SelectManager#source methodJon Leighton2011-08-151-1/+1
|
* Use new SelectManager#projections= methodJon Leighton2011-08-151-1/+1
|
* use update.key instead of update.ast.key. make better use of select manager.Jon Leighton2011-08-151-12/+8
|
* Use a SelectCore rather than a full SelectManagerJon Leighton2011-08-151-2/+3
|
* Refactor building the update managerJon Leighton2011-08-151-3/+2
|
* Support for multi-table updates with limits, offsets and ordersJon Leighton2011-08-151-1/+22
|
* Support updates with joins. Fixes #522.Jon Leighton2011-08-151-0/+4
|
* Make it the responsibility of the connection to hold onto an ARel visitor ↵Jon Leighton2011-08-081-0/+4
| | | | 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.
* Remove unused 'quoted_column_names' variable.Sebastian Martinez2011-06-081-1/+1
|
* No need to override for just calling superAkira Matsuda2011-05-291-4/+0
|
* Merge branch 'master' of github.com:rails/railsXavier Noria2011-05-251-18/+0
|\
| * removed deprecated methods, and related tests, from ActiveRecordJosh Kalderimis2011-05-251-18/+0
| |
* | Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-251-2/+2
|\ \ | |/ |/| | | | | | | Conflicts: actionmailer/lib/action_mailer/base.rb activesupport/lib/active_support/core_ext/kernel/requires.rb
| * Remove extra white spaces on ActiveRecord docs.Sebastian Martinez2011-05-231-2/+2
| |
* | Remove extra white-space on some exception messages.Sebastian Martinez2011-05-231-1/+1
| |
* | Removed AS core_ext/kernel/requires as it's not used and is bad practice.Josh Kalderimis2011-05-231-1/+0
|/
* Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-041-0/+2
|\
| * Added #recreate_database docsSebastian Martinez2011-05-031-0/+2
| |
* | favor collect over each in mysql* adaptersJosh Kalderimis2011-05-031-4/+2
|/
* Merge branch 'master' of git://github.com/lifo/docrailsXavier Noria2011-05-011-2/+10
|\ | | | | | | | | Conflicts: railties/guides/source/contributing_to_ruby_on_rails.textile
| * Merge branch 'master' of github.com:lifo/docrailsDan Pickett2011-04-291-2/+10
| |\
| | * Added docs for #version on mysql_adapterSebastian Martinez2011-04-221-0/+1
| | |
| | * Make this docs more consistent with the rest of the docs presentSebastian Martinez2011-04-221-2/+3
| | |
| | * Added docs for #rename_table on some adaptersSebastian Martinez2011-04-221-0/+4
| | |
| | * Added docs for #columns on some adaptersSebastian Martinez2011-04-221-0/+1
| | |
| | * Merge branch 'master' of git://github.com/rails/railsXavier Noria2011-04-231-4/+0
| | |\
| | * | Added docs for #indexes on adaptersSebastian Martinez2011-04-221-0/+1
| | | |
* | | | using bind parameters for updatesAaron Patterson2011-04-301-0/+1
|/ / /
* | | lean on rubygems to provide error messages about missing gemsAaron Patterson2011-04-291-9/+2
| | |
* | | refactor exec_delete to reuse the statement cache from exec_queryAaron Patterson2011-04-291-70/+44
| | |
* | | statement cache for deletes working on mysqlAaron Patterson2011-04-291-0/+39
| | |