aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #15802 from sgrif/sg-column-quotingRafael Mendonça França2014-06-192-6/+6
|\ | | | | Don't use column object for type casting in `quoting`
| * Don't use column object for type casting in `quoting`Sean Griffin2014-06-182-6/+6
| | | | | | | | | | | | | | | | | | We're never going to be able to use the attribute object here, however, so let's just accept the ugly demeter violation here for now. Remove test cases which were either redundant with other tests in the file, or were actually testing the type objects (which are tested elsewhere)
* | this method is no longer being usedJosh Sharpe2014-06-191-4/+0
|/
* Merge pull request #15782 from sgrif/sg-column-defaultsMatthew Draper2014-06-183-15/+19
|\ | | | | Don't type cast the default on the column
| * Don't type cast the default on the columnSean Griffin2014-06-173-15/+19
| | | | | | | | | | | | | | If we want to have type decorators mess with the attribute, but not the column, we need to stop type casting on the column. Where possible, we changed the tests to test the value of `column_defaults`, which is public API. `Column#default` is not.
* | Detect in-place changes on point typesSean Griffin2014-06-172-3/+20
| |
* | Detect mutations of arrays and array membersSean Griffin2014-06-171-12/+14
| |
* | Ensure `OID::Array#type_cast_for_database` matches PG's quoting behaviorSean Griffin2014-06-172-7/+21
| | | | | | | | | | | | Also takes a step towards supporting types which use a character other than ',' for the delimiter (`box` is the only built in type for which this is the case)
* | Merge pull request #15778 from sgrif/sg-pg-mutable-arraysMatthew Draper2014-06-183-38/+52
|\ \ | |/ |/| Move pg array database type casting to the Array type
| * Move array database type casting to the Array typeSean Griffin2014-06-173-38/+52
| | | | | | | | | | | | | | | | | | The case where we have a column object, but don't have a type cast method involves type casting the default value when changing the schema. We get one of the column definition structs instead. That is a case that I'm trying to remove overall, but in the short term, we can achieve the same behavior without needing to pass the adapter to the array type by creating a fake type that proxies to the adapter.
* | Don't assume that Hstore columns have always changedSean Griffin2014-06-171-1/+1
|/ | | | | | | | | HStore columns come back from the database separated by a comma and a space, not just a comma. We need to mirror that behavior since we compare the two values. Also adds a regression test against JSON to ensure we don't have the same bug there.
* /mysql/i -> MySQL, Spell correct in continuation to #15555Akshay Vishnoi2014-06-144-7/+7
|
* Parsing DATABASE_URI, use URI#hostname: it's smarter about IPv6Matthew Draper2014-06-141-1/+1
| | | | Fixes #15705.
* Remove `serialized?` from the type interfaceSean Griffin2014-06-131-1/+1
|
* Merge pull request #15674 from sgrif/sg-mutable-attributesMatthew Draper2014-06-142-8/+4
|\ | | | | Detect in-place changes on mutable AR attributes
| * Detect in-place changes on mutable AR attributesSean Griffin2014-06-132-8/+4
| | | | | | | | | | | | We have several mutable types on Active Record now. (Serialized, JSON, HStore). We need to be able to detect if these have been modified in place.
* | Merge pull request #15593 from sgrif/sg-attributeRafael Mendonça França2014-06-131-2/+3
|\ \ | | | | | | Introduce an Attribute object to handle the type casting dance
| * | Introduce an Attribute object to handle the type casting danceSean Griffin2014-06-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's a lot more that can be moved to these, but this felt like a good place to introduce the object. Plans are: - Remove all knowledge of type casting from the columns, beyond a reference to the cast_type - Move type_cast_for_database to these objects - Potentially make them mutable, introduce a state machine, and have dirty checking handled here as well - Move `attribute`, `decorate_attribute`, and anything else that modifies types to mess with this object, not the columns hash - Introduce a collection object to manage these, reduce allocations, and not require serializing the types
* | | PG arrays should type cast user inputSean Griffin2014-06-131-4/+8
| |/ |/| | | | | | | | | We guarantee that `model.value` does not change after `model.save && model.reload`. This requires type casting user input for non-string types.
* | Remove unused requireSean Griffin2014-06-111-2/+0
|/ | | | We're not longer using `ipaddr` in schema dumper
* Remove YAML serialization workaround for columnsSean Griffin2014-06-111-6/+2
| | | | | We are no longer including column objects in YAML serialization, thanks to https://github.com/rails/rails/pull/15621
* Keep the types of virtual columns after yaml serializationSean Griffin2014-06-101-2/+6
| | | | | On MySQL and PostgreSQL, the adapter does not type cast virtual columns for us.
* Inline PG array type casting helperSean Griffin2014-06-103-34/+28
|
* Rename `type_cast` to `type_cast_from_database`Sean Griffin2014-06-096-16/+16
| | | | | | | | In some cases there is a difference between the two, we should always be doing one or the other. For convenience, `type_cast` is still a private method on type, so new types that do not need different behavior don't need to implement two methods, but it has been moved to private so it cannot be used accidentally.
* Make `_before_type_cast` actually be before type castSean Griffin2014-06-093-3/+11
| | | | | | | | | | | | | - The following is now true for all types, all the time - `model.attribute_before_type_cast == given_value` - `model.attribute == model.save_and_reload.attribute` - `model.attribute == model.dup.attribute` - `model.attribute == YAML.load(YAML.dump(model)).attribute` - Removes the remaining types implementing `type_cast_for_write` - Simplifies the implementation of time zone aware attributes - Brings tz aware attributes closer to being implemented as an attribute decorator - Adds additional point of control for custom types
* Merge pull request #15546 from sgrif/sg-lazy-decoratorsRafael Mendonça França2014-06-072-12/+22
|\ | | | | Don't query the database schema when calling `serialize`
| * Don't query the database schema when calling `serialize`Sean Griffin2014-06-072-12/+22
| | | | | | | | | | | | We need to decorate the types lazily. This is extracted to a separate API, as there are other refactorings that will be able to make use of it, and to allow unit testing the finer points more granularly.
* | Don't mess with `_before_type_cast` for numeric typesSean Griffin2014-06-061-2/+1
|/
* Merge pull request #15503 from sgrif/sg-json-hstore-storageYves Senn2014-06-062-12/+0
|\ | | | | Bring type casting behavior of hstore/json in line with serialized
| * Bring type casting behavior of hstore/json in line with serializedSean Griffin2014-06-042-12/+0
| | | | | | | | | | `@raw_attributes` should not contain the type-cast, mutable version of the value.
* | Remove optimization that was required with whiny nilsSean Griffin2014-06-051-8/+0
| | | | | | | | Whiny nils is no longer a thing, so we no longer need this optimization
* | Fix behavior of handling BC era dates.edogawaconan2014-06-052-3/+5
| | | | | | | | BC era year is (astronomical year + 1) and starts from 1 BC.
* | have an actual `NullColumn` object and update docs accordingly.Yves Senn2014-06-042-1/+10
| | | | | | | | | | | | Follow up to #15438 and #15502. /cc @sgrif
* | Collapse PG default extractoin of most types to single regexSean Griffin2014-06-041-48/+6
|/ | | | | | | For any type that is represented as a string and then type cast, we do not need separate regular expressions for the various types. No function will match this regex. User defined types *should* match this, so that the type object can decide what to do with the value.
* Change wording of explanation about precision & scale of decimal numbers [ci ↵Prathamesh Sonpatki2014-06-041-2/+2
| | | | skip]
* Merge pull request #15492 from sgrif/sg-dirty-defaultsRafael Mendonça França2014-06-031-1/+1
|\ | | | | Keep column defaults in type cast form
| * Keep column defaults in type cast formSean Griffin2014-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | The contract of `_field_changed?` assumes that the old value is always type cast. That is not the case for the value in `Column#default` as things are today. It appears there are other public methods that assume that `Column#default` is type cast, as well. The reason for this change originally was because the value gets put into `@raw_attributes` in initialize. This reverts to the old behavior on `Column`, and updates `initialize` to make sure that the values are in the right format.
* | Merge pull request #15486 from sgrif/sg-binary-quotingMatthew Draper2014-06-044-47/+65
|\ \ | | | | | | Refactor quoting of binary data to not be based on the column type
| * | Refactor quoting of binary data to not be based on the column typeSean Griffin2014-06-034-47/+65
| |/
* | pg, preserve money type when dumping schema and extract money default.Yves Senn2014-06-033-0/+11
| |
* | Merge pull request #15487 from sgrif/sg-bit-limitYves Senn2014-06-032-24/+24
|\ \ | | | | | | Respect limit for PG bit strings
| * | Respect limit for PG bit stringsSean Griffin2014-06-032-24/+24
| | |
* | | Merge pull request #15442 from sgrif/sg-refactor-field-changedYves Senn2014-06-031-1/+1
|\ \ \ | |/ / |/| | Refactor determination of whether the field has changed
| * | Refactor determination of whether the field has changedSean Griffin2014-06-031-1/+1
| |/ | | | | | | | | The types know more about what is going on than the dirty module. Let's ask them!
* / pg, preserve type when schema dumping bit and bit varying columns.Yves Senn2014-06-035-3/+31
|/
* pg, preserve point type when schema dumping.Yves Senn2014-06-033-2/+11
|
* pg, inline casting methods into `OID::Type` objects.Yves Senn2014-06-024-44/+25
| | | | | | | | This inlines casting for the most obvious types. The rest will follow eventually. I need to put some tests in place, to make sure that the inlining is not causing regressions. /cc @sgrif
* Remove most code related to serialized propertiesSean Griffin2014-06-011-2/+2
| | | | | | | | | | | Nearly completely implemented in terms of custom properties. `_before_type_cast` now stores the raw serialized string consistently, which removes the need to keep track of "state". The following is now consistently true: - `model.serialized == model.reload.serialized` - A model can be dumped and loaded infinitely without changing - A model can be saved and reloaded infinitely without changing
* refactor, introduce `Type#type_cast_for_schema` to cast for schema.rbYves Senn2014-05-304-26/+17
| | | | | | | This removes the case statement in `SchemaDumper` and gives every `Type` the possibility to control the SchemaDumper default value output. /cc @sgrif
* pg, support default values for enum types. Closes #7814.Yves Senn2014-05-302-2/+9
| | | | | This is an intermediate solution. It is related to the refactoring @sgrif is making and will change in the future.