aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
Commit message (Collapse)AuthorAgeFilesLines
* Refactor `quoted_date`Ryuta Kamizono2014-12-111-10/+0
| | | | Move microseconds formatting to `AbstractAdapter`.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-5/+5
|
* Mark comments that should not be in the docsclaudiob2014-11-241-0/+2
| | | | | | | | | | | Some comments that are meant to separate blocks of code in a file show up on http://api.rubyonrails.org as though they were part of the documentation. This commit hides those comments from the documentation. Stems from the discussion with @zzak at https://github.com/voloko/sdoc/issues/79#issuecomment-64158738 [ci skip]
* tiny code improvement in sqlite3 adapter:Andrey Deryabin2014-11-101-6/+2
| | | | | - remove unused method `supports_add_column?` - change additional restriction method to `valid_alter_table_type?` - fix code style
* Avoid unnecessary allocations/callsPablo Herrero2014-11-021-1/+1
|
* Remove duplicate 'select' database statementclaudiob2014-10-201-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `select` method has the same definition in almost all database adapters, so it can be moved from the database-specific adapters (PostgreSQl, MySQL, SQLite) to the abstract `database_statement`: ```ruby def select(sql, name = nil, binds = []) exec_query(sql, name, binds) end ``` --- More details about this commit: the only two DB-specific adapters that have a different definition of `select` are MySQLAdapter and MySQL2Adapter. In MySQLAdapter, `select` invokes `exec_query(sql, name, binds)`, so calling `super` achieves the same goal with less repetition. In MySQL2Adapter, `select` invokes `exec_query(sql, name)`, that is, it does not pass the `binds` parameter like other methods do. However, [MySQL2Adapter's `exec_query`](https://github.com/rails/rails/blob/74a527cc63ef56f3d0a42cf638299958dc7cb08c/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb#L228L231) works exactly the same whether this parameters is passed or not, so the output does not change: ```ruby def exec_query(sql, name = 'SQL', binds = []) result = execute(sql, name) ActiveRecord::Result.new(result.fields, result.to_a) end ```
* Merge pull request #14056 from girishso/14041Yves Senn2014-09-091-1/+1
|\ | | | | | | | | | | | | SQLite3Adapter now checks for views in table_exists? fixes: 14041 Conflicts: activerecord/CHANGELOG.md
| * SQLite3Adapter now checks for views in table_exists? fixes: 14041Girish S2014-02-141-1/+1
| |
* | introduce `connection.supports_views?` and basic view tests.Yves Senn2014-09-091-0/+4
| | | | | | | | | | | | | | `AbstractAdapter#supports_views?` defaults to `false` so we have to turn it on in adapter subclasses. Currently the flag only controls test execution. /cc @yahonda
* | Freeze ADAPTER_NAME in adaptersAbdelkader Boudih2014-09-051-4/+1
| |
* | Fix documentation of SQlite3Adapter.columnsa3gis2014-07-251-1/+1
| | | | | | As of https://github.com/rails/rails/commit/e781aa31fc52a7c696115302ef4d4e02bfd1533b SQLite3Column has been dropped.
* | Merge pull request #16055 from sgrif/sg-refactor-sqlite3-stringsMatthew Draper2014-07-121-14/+22
|\ \ | | | | | | Use a type object for type casting behavior on SQLite3
| * | Use a type object for type casting behavior on SQLite3Sean Griffin2014-07-111-14/+22
| | |
* | | Change back occurrences of SQLite(3) to sqlite3 when referring to theZachary Scott2014-07-061-4/+4
| | | | | | | | | | | | adapter, fixed from #16057 [ci skip]
* | | [ci skip] /sqlite/i --> SQLiteAkshay Vishnoi2014-07-061-2/+2
|/ /
* | Refactor quoting of binary data to not be based on the column typeSean Griffin2014-06-031-4/+3
| |
* | Ensure we always use instances of the adapter specific column classSean Griffin2014-05-281-1/+1
| | | | | | | | | | | | - Create a consistent API across adapters for building new columns - Use it for custom properties so we don't get `UndefinedMethodError`s in stuff I'm implementing elsewhere.
* | Replace `type_cast` case statement with delegationSean Griffin2014-05-201-11/+1
| | | | | | | | | | | | | | | | All subclasses of column were now delegating `type_cast` to their injected type object. We can remove the overriding methods, and generalize it on the `Column` class itself. This also enabled us to remove several column classes completely, as they no longer had any meaningful behavior of their own.
* | Delegate `#type_cast` to injected type objects on SQLite3Sean Griffin2014-05-201-6/+20
| |
* | Remove :timestamp column typeSean Griffin2014-05-191-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | The `:timestamp` type for columns is unused. All database adapters treat them as the same database type. All code in `ActiveRecord` which changes its behavior based on the column's type acts the same in both cases. However, when the type is passed to code that checks for the `:datetime` type, but not `:timestamp` (such as XML serialization), the result is unexpected behavior. Existing schema definitions will continue to work, and the `timestamp` type is transparently aliased to `datetime`.
* | Add a type object to Column constructorSean Griffin2014-05-171-1/+3
| | | | | | | | | | | | Part of #15134. In order to perform typecasting polymorphically, we need to add another argument to the constructor. The order was chosen to match the `oid_type` on `PostgreSQLColumn`.
* | refactor, move `column_for` to `AbstractAdapter` for better reuse.Yves Senn2014-05-041-5/+3
| |
* | Merge pull request #13640 from maginatics/fix_sqlite3_ensure_masterRafael Mendonça França2014-05-011-3/+6
|\ \ | | | | | | | | | | | | | | | | | | SQLite3: Always close statements. Conflicts: activerecord/CHANGELOG.md
| * | SQLite3: Always close statements.Timur Alperovich2014-01-151-3/+6
| | | | | | | | | | | | | | | | | | SQLite3 adapter must make sure to close statements after queries. Fixes: #13631
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-201-2/+2
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (74 commits) [ci skip] builtin -> built-in Fix code indentation and improve formatting Grammar fix in Getting Started Guide Make URL escaping more consistent Optimize URI escaping Always escape string passed to url helper. Remove statement assuming coffee shop/public space wifi is inherently insecure Don't rely on Arel master in bug report template [ci skip] wrap methods in backticks [ci skip] "subhash" --> "sub-hash" multibyte_conformance.rb --> multibyte_conformance_test.rb Fix inconsistent behavior from String#first/#last `@destroyed` should always be set to `false` when an object is duped. remove warning `warning: ambiguous first argument; put parentheses or even spaces` :uglify -> :uglifier Regression test for irregular inflection on has_many Singularize association names before camelization Fix spelling and proper nouns Optimize select_value, select_values, select_rows and dry up checking whether to exec with cache for Postgresql adapter Include default rails protect_from_forgery with: :exception ... Conflicts: activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
| * | | Bring SQLite3Adpter init API closer to othersArthur Neves2014-04-171-2/+2
| | | |
* | | | push the collectors up to the abstract adapterAaron Patterson2014-04-091-20/+0
| | | |
* | | | sqlite3 tests passing againAaron Patterson2014-04-091-7/+8
| | | |
* | | | add a bind collector, remove the bind visitorAaron Patterson2014-04-091-6/+22
| | | |
* | | | Merge branch 'master' into adequaterecordAaron Patterson2014-04-071-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (122 commits) Rails.application should be set inside before_configuration hook remove check for present? from delete_all Remove useless begin..end Build the reverse_order on its proper method. Use connection-specific bytea escaping Ignore order when doing count. make enums distinct per class Remove unused `subclass_controller_with_flash_type_bar` var from flash test. fix CollectionProxy delete_all documentation Added OS X specific commands to installation guide [ci skip] Recommended using homebrew for installing MySQL and PostgreSQL Fix setup of adding _flash_types test. Use SVG version of travis build status badge [skip ci] W3C CSP document moved to gihub.io URL [ci skip] sprockets-rails was released Fix the test defining the models in the right place Add CHANGELOG entry for #11650 [ci skip] Declare the assets dependency Use sass-rails 4.0.3 Make possible to use sprockets-rails 2.1 add missing parentheses to validates_with documentation [skip ci] ...
| * | | PostgreSQL and SQLite, remove varchar limit. [Vladimir Sazhin & Toms Mikoss ↵Yves Senn2014-04-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | & Yves Senn] There is no reason for the PG adapter to have a default limit of 255 on :string columns. See this snippet from the PG docs: Tip: There is no performance difference among these three types, apart from increased storage space when using the blank-padded type, and a few extra CPU cycles to check the length when storing into a length-constrained column. While character(n) has performance advantages in some other database systems, there is no such advantage in PostgreSQL; in fact character(n) is usually the slowest of the three because of its additional storage costs. In most situations text or character varying should be used instead.
| * | | Clarify 'database does not exist' message and implementation.Jeremy Kemper2014-04-011-2/+2
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Clarify what the situation is and what to do. * Advise loading schema using `rake db:setup` instead of migrating. * Use a rescue in the initializer rather than extending the error message in-place. * Preserve the original backtrace of other errors by using `raise` rather than raising again with `raise error`. References 0ec45cd15d0a2f5aebc75e23d841b6c12f3ba763
* | | Merge branch 'master' into adequaterecordAaron Patterson2014-02-171-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (311 commits) Add a missing changelog entry for #13981 and #14035 Revert "Fixed plugin_generator test" implements new option :month_format_string for date select helpers [Closes #13618] add factory methods for empty alias trackers guarantee a list in the alias tracker so we can remove a conditional stop exposing table_joins make most parameters to the AliasTracker required make a singleton for AssociationScope pass the association and connection to the scope method pass the tracker down the stack and construct it in the scope method clean up add_constraints signature remove the reflection delegate remove klass delegator remove railties changes. fixes #14054 remove chain delegate remove scope_chain delegate Add verb to sanitization note fix path shown in mailer's templates updated Travis build status image url fix guide active_support_core_extensions. add Note to String#indent [ci skip] ... Conflicts: activerecord/lib/active_record/associations/join_dependency.rb activerecord/test/cases/associations/association_scope_test.rb
| * | Fix regression on `.select_*` methods.Arthur Neves2014-01-301-2/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a common pattern: ``` query = author.posts.select(:title) connection.select_one(query) ``` However `.select` returns a ActiveRecord::AssociationRelation, which has the bind information, so we can use that to get the right sql query. Also fix select_rows on postgress and sqlite3 that were not using the binds [fixes #7538] [fixes #12017] [related #13731] [related #12056]
* | remove dead codeAaron Patterson2014-01-171-7/+0
| |
* | comment out the sqlite3 debug code (for now)Aaron Patterson2014-01-141-0/+7
| |
* | Merge branch 'master' into set_bindsAaron Patterson2014-01-141-1/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | * master: don't establish a new connection when testing with `sqlite3_mem`. sqlite >= 3.8.0 supports partial indexes Don't try to get the subclass if the inheritance column doesn't exist Enum mappings are now exposed via class methods instead of constants. Fix fields_for documentation with index option [ci skip] quick pass through Active Record CHANGELOG. [ci skip] [ci skip] Grammar correction single quotes for controller generated routes [ci skip] Added alias to CSRF Set NameError#name
| * sqlite >= 3.8.0 supports partial indexesCody Cutrer2014-01-141-1/+17
| |
* | explains for prepared statements should never have binds in SQLite3Aaron Patterson2014-01-131-1/+1
|/
* Raise NoDatabaseError when db does not existschneems2013-12-241-0/+6
| | | Building on the work of #13427 this PR adds a helpful error message to the adapters: mysql, mysql2, and sqlite3
* Merge pull request #13291 from strzibny/new_unique_constraintYves Senn2013-12-121-1/+5
|\ | | | | Translate new unique constraint error message for sqlite >= 3.8.2
| * Translate new unique constraint for sqlite >= 3.8.2Josef Stribny2013-12-121-1/+5
| |
* | Remove the unused, undocumented SQLite3Adapter#supports_count_distinct?Ben Woosley2013-11-121-5/+0
| | | | | | | | This has returned true since 3cc9b5f1, and is not used internally.
* | Drop a sqlite_version check because we only support SQLite 3.6.16 or newer.Ben Woosley2013-11-121-6/+1
| | | | | | Drop some comments that document the implementation rather than the interface.
* | Don't use Active Support where we don't need toRafael Mendonça França2013-11-091-1/+1
| |
* | log bind variables after they were type casted.Yves Senn2013-11-091-4/+5
|/ | | | | | | | | | | | | | | The log output used to be confusing in situation where type casting has "unexpected" effects. For example when finding records with a `String`. BEFORE: irb(main):002:0> Event.find("im-no-integer") D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- : Event Load (4.5ms) SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1 [["id", "im-no-integer"]] AFTER: irb(main):002:0> Event.find("im-no-integer") D, [2013-11-09T11:10:28.998857 #1706] DEBUG -- : Event Load (4.5ms) SELECT "events".* FROM "events" WHERE "events"."id" = $1 LIMIT 1 [["id", 0]]
* Remove `default_primary_key_type` and extract contains of ↵Vipul A M2013-10-141-18/+16
| | | | `native_database_types` to a constant since they aren't conditional now in SQLite3Adapter. Makes it more like other adapters.
* Merge pull request #11833 from vipulnsward/remove_autoincrementRafael Mendonça França2013-10-141-10/+1
|\ | | | | Remove sqlite specific`supports_autoincrement?` which defaults to true
| * Remove sqlite specific`supports_autoincrement?` which always defaults to trueVipul A M2013-08-101-10/+1
| |
* | extract adapter savepoint implementations into `abstract/savepoints.rb`.Yves Senn2013-09-301-12/+2
| |