aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add three new rubocop rulesRafael Mendonça França2016-08-161-5/+5
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-3/+3
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-6/+6
|
* applies new string literal convention in activerecord/libXavier Noria2016-08-061-40/+40
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #25523 from kamipo/extract_quoted_binds_type_casted_bindsSean Griffin2016-07-261-3/+3
|\ | | | | Extract `type_casted_binds` method
| * Extract `type_casted_binds` methodRyuta Kamizono2016-07-261-3/+3
| | | | | | | | | | Because `type_cast` against `binds` always requires `attr.value_for_database` and this pattern appears frequently.
* | systematic revision of =~ usage in ARXavier Noria2016-07-231-1/+1
|/ | | | | Where appropriatei, prefer the more concise Regexp#match?, String#include?, String#start_with?, or String#end_with?
* Pass `type_casted_binds` to log subscriber for logging bind values properlyRyuta Kamizono2016-07-191-1/+1
| | | | Address to https://github.com/rails/rails/commit/5a302bf553af0e6fedfc63299fc5cd6e79599ef3#commitcomment-18288388.
* rails -> Rails [ci skip]Santosh Wadghule2016-07-121-1/+1
|
* Fix some typos in comments.Joe Rafaniello2016-05-041-1/+1
| | | | [ci skip]
* Dont simply assume a type is a valid database type. This is only always true ↵Vipul A M2016-04-251-0/+4
| | | | | | | in the case of sqlite. Others adapters need to perform a check for validity. Add coverage for mysql2 db type validation
* Follow up of #23461Vipul A M2016-04-241-1/+1
| | | | | | | | - Rename max to statement_limit - Remove magic number 1000 from everywhere - Defined StatementPool::DEFAULT_STATEMENT_LIMIT and started using it everywhere Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Include the Savepoints module in all adapters.Vipul A M2016-04-241-1/+0
| | | | | Adapters override `#supports_savepoints?` to return `true` if they support transaction savepoints. Defaults to `false`.
* Move `select_rows` implementation to super classRyuta Kamizono2016-04-241-4/+0
|
* https://github.com/rails/rails/commit/42dd2336b31a8d98776d039a2b9fd7f834156a ↵Vipul A M2016-04-231-0/+4
| | | | | | | | | 78 changed INSERT INTO versions to run in 1 single query. This breaks for sqlite versions < 3.7.11, which is especially the case on Ubuntu 12.04 LTS, that has SQLite version 3.7.9 as default. So we check for support for multi insert, before performing single query inserts, else fallback to older version of running multiple queries. [Vipul A M & Yasuo Honda]
* Define `arel_visitor` method on all adaptersRyuta Kamizono2016-04-201-0/+4
| | | | `Arel::Visitors::VISITORS` was removed at https://github.com/rails/arel/pull/412.
* Merge pull request #23515 from kamipo/extract_arel_visitorJeremy Daer2016-04-191-9/+0
|\ | | | | | | Extract `arel_visitor` and move up to the abstract adapter
| * Extract `arel_visitor` and move up to the abstract adapterRyuta Kamizono2016-04-041-9/+0
| |
* | Move `quoted_date`, `quote_string` and `quote_table_name_for_assignment` ↵Ryuta Kamizono2016-04-051-10/+0
|/ | | | methods to `Quoting` module
* Move `@quoted_{column|table}_names` cache up to the abstract adapterRyuta Kamizono2016-03-311-5/+0
|
* Make to private the visibility of `_quote` and `_type_cast`Ryuta Kamizono2016-03-301-24/+3
|
* Passing `table_name` to `Column#initialize` to avoid `instance_variable_set`Ryuta Kamizono2016-03-081-3/+1
|
* Initialize `column.table_name` immediately for `column.serial?` correctly ↵Ryuta Kamizono2016-03-081-2/+5
| | | | | | | | working Currently the results of `column.serial?` is not correct. For `column.serial?` correctly working, initialize `column.table_name` immediately.
* SQLite 2 support has been dropped [ci skip]Ryuta Kamizono2016-02-041-1/+0
|
* Extract `ExplainPrettyPrinter` to appropriate filesRyuta Kamizono2016-02-011-15/+2
|
* `{update|delete}_sql` are almost the same as `{update|delete}`Ryuta Kamizono2016-01-081-5/+0
| | | | Simply `{update|delete}_sql` aliases to `{update|delete}`.
* Remove `delete_sql` in sqlite3 adapterRyuta Kamizono2016-01-071-5/+0
| | | | | `sql += " WHERE 1=1"` was introduced in 69cb942. But it is not needed. ref https://www.sqlite.org/lang_delete.html
* Refactor `connection.insert_sql`Ryuta Kamizono2016-01-071-5/+0
| | | | `connection.insert_sql` is almost the same as `connection.insert`.
* Fix `connection#create` in PG adapterRyuta Kamizono2016-01-051-1/+0
| | | | | | Originally `connection#create` had aliased to `connection#insert` in PG adapter. But it was broken by #7447. Re-alias `create` to `insert` for fixing it.
* Support supports_datetime_with_precision? for sqlite3Yasuo Honda2015-11-301-0/+4
|
* Refactor `AbstractAdapter#initialize`Ryuta Kamizono2015-11-301-2/+1
| | | | `pool` in args is unused anymore. And `config` is used in all adapters.
* Deprecate `#table_exists?`, `#tables` and passing arguments to `#talbes`yui-knk2015-11-091-2/+26
| | | | | | | | | | Reported on #21509, how views is treated by `#tables` are differ by each adapters. To fix this different behavior, after Rails 5.0 is released, deprecate `#tables`. And `#table_exists?` would check both tables and views. To make their behavior consistent with `#tables`, after Rails 5.0 is released, deprecate `#table_exists?`.
* Deprecate exception#original_exception in favor of exception#causeYuki Nishijima2015-11-031-2/+2
|
* Remove `#tables` extra args againRyuta Kamizono2015-10-221-12/+8
| | | | | | This issue was resolved by #21687 already. But re-add args by #18856. `#tables` extra args was only using by `#table_exists?`. This is for internal API. This commit will remove these extra args again.
* Do not cache prepared statements that are unlikely to have cache hitsSean Griffin2015-10-201-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this commit, Rails makes no differentiation between whether a query uses bind parameters, and whether or not we cache that query as a prepared statement. This leads to the cache populating extremely fast in some cases, with the statements never being reused. In particular, the two problematic cases are `where(foo: [1, 2, 3])` and `where("foo = ?", 1)`. In both cases we'll end up quoting the values rather than using a bind param, causing a cache entry for every value ever used in that query. It was noted that we can probably eventually change `where("foo = ?", 1)` to use a bind param, which would resolve that case. Additionally, on PG we can change our generated query to be `WHERE foo = ANY($1)`, and pass an array for the bind param. I hope to accomplish both in the future. For SQLite and MySQL, we still end up preparing the statements anyway, we just don't cache it. The statement will be cleaned up after it is executed. On postgres, we skip the prepare step entirely, as an API is provided to execute with bind params without preparing the statement. I'm not 100% happy on the way this ended up being structured. I was hoping to use a decorator on the visitor, rather than mixing a module into the object, but the way Arel has it's visitor pattern set up makes it very difficult to extend without inheritance. I'd like to remove the duplication from the various places that are extending it, but that'll require a larger restructuring of that initialization logic. I'm going to take another look at the structure of it soon. This changes the signature of one of the adapter's internals, and will require downstream changes from third party adapters. I'm not too worried about this, as worst case they can simply add the parameter and always ignore it, and just keep their previous behavior. Fixes #21992.
* Wrong usage of 'a' in docs fixed [ci skip]Mehmet Emin İNAÇ2015-10-031-1/+1
|
* introduce `conn.data_source_exists?` and `conn.data_sources`.Yves Senn2015-09-221-0/+2
| | | | | | | | | | | | | | | | | These new methods are used from the Active Record model layer to determine which relations are viable to back a model. These new methods allow us to change `conn.tables` in the future to only return tables and no views. Same for `conn.table_exists?`. The goal is to provide the following introspection methods on the connection: * `tables` * `table_exists?` * `views` * `view_exists?` * `data_sources` (views + tables) * `data_source_exists?` (views + tables)
* Merge pull request #21609 from kamipo/do_not_dump_view_as_tableJeremy Daer2015-09-191-0/+13
|\ | | | | | | Do not dump a view as a table in sqlite3, mysql and mysql2 adapters
| * Add `#views` and `#view_exists?` methods on connection adaptersRyuta Kamizono2015-09-131-0/+13
| |
* | Merge pull request #21614 from kamipo/correctly_dump_composite_primary_keyJeremy Daer (Kemper)2015-09-191-3/+2
|\ \ | | | | | | Correctly dump composite primary key
| * | Correctly dump composite primary keyRyuta Kamizono2015-09-201-3/+2
| |/ | | | | | | | | | | | | | | | | Example: create_table :barcodes, primary_key: ["region", "code"] do |t| t.string :region t.integer :code end
* / Remove `@connection` in `StatementPool`Ryuta Kamizono2015-09-201-2/+1
|/ | | | | `@connection` in `StatementPool` is only used for PG adapter. No need for abstract `StatementPool` class.
* Support dropping indexes concurrently in PostgresGrey Baker2015-09-051-1/+2
| | | | | See http://www.postgresql.org/docs/9.4/static/sql-dropindex.html for more details.
* Ensure that microsecond precision is only used for version of mysql that ↵Jori Hardman2015-07-201-12/+0
| | | | support it. Fixes #19711
* Add reversible syntax for change_column_defaultPrem Sichanugrist2015-06-261-1/+3
| | | | | | | | | | | | | Passing `:from` and `:to` to `change_column_default` makes this command reversible as user has defined its previous state. So, instead of having the migration command as: change_column_default(:posts, :state, "draft") They can write it as: change_column_default(:posts, :state, from: nil, to: "draft")
* Add collation support for string and text columns in SQLite3Akshay Vishnoi2015-05-281-4/+51
|
* Remove `require 'arel/visitors/bind_visitor'`Ryuta Kamizono2015-05-191-1/+0
| | | | | This line introduced by the commit fd398475 for using `Arel::Visitors::BindVisitor`. Currently it is not used.
* Eliminate the duplication code of `StatementPool`Ryuta Kamizono2015-05-191-28/+1
|
* :nodoc: change_column_null in the implmenting adaptersTony Miller2015-05-031-1/+1
| | | | | | `change_column_null` is doc'ed only in ActiveRecord::ConnectionAdapters::SchemaStatements, so it would make sense to :nodoc: it elsewhere.
* cache quoted column names in SQLite3Aaron Patterson2015-02-241-1/+2
| | | | we do this in other adapters, and it's a nice speed improvement