File: 4.44.0.txt

package info (click to toggle)
ruby-sequel 5.63.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,408 kB
  • sloc: ruby: 113,747; makefile: 3
file content (125 lines) | stat: -rw-r--r-- 4,440 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
= New Features

* Model.freeze is now supported and recommended in production and
  during testing.  It freezes all class-level metadata, preventing
  possible thread-safety issues at runtime.

* Model.finalize_associations has been added, speeding up some
  association reflection methods by about 10x.  This method
  should be called after all associated models have been loaded.
  This can speed up the retrieval of associated objects for small
  datasets by 5-10%.

  One advantage of using this is it will raise an exception if it
  recognizes that any of your associations are not defined
  correctly, such as referencing an associated class that doesn't
  exist.

* Model.freeze_descendents has been added to the subclasses plugin.
  This method finalizes associations for all descendent classes,
  then freezes the descendent class.  It's designed to make it
  easy to freeze all model classes in use:

    Sequel::Model.plugin :subclasses
    Dir['./models/*.rb'].each{|f| require f}
    Sequel::Model.freeze_descendents

* An implicit_subquery dataset extension has been added, which
  implicitly uses a subquery if you have a dataset with raw SQL and
  you call a method that would modify the SQL used:

    DB['SELECT * FROM foo'].where(:bar=>1)
    # SELECT * FROM foo

    DB.extension :implicit_subquery
    DB['SELECT * FROM foo'].where(:bar=>1)
    # SELECT * FROM (SELECT * FROM foo) AS t1 WHERE (bar = 1)

* Model datasets now have where_all, where_each, and
  where_single_value methods for returning data:

    class Album < Sequel::Model; end
    Album.where_all(:id=>[1,2,3])
    # => [Album[1], Album[3], Album[2]]

    Album.where_each(:id=>[1,2,3]) do |album|
      # ...
    end

    Album.select(:name).where_single_value(:id=>1)
    # "Album's Name"

  These methods are designed for use by other dataset methods you
  define, and are optimized for frozen datasets if the methods will
  be called multiple times on the same dataset.  where_all and
  where_each can increase performance by up to 40% for small datasets
  compared to where.all and where.each.  where_single_value can be up
  to twice as fast as where.single_value.

* Model.dataset_module now supports an eager method for eager loading:

    class Album < Sequel::Model
      many_to_one :artist

      dataset_module do
        eager :with_artist, :artist
      end
    end

    Album.with_artist.all # eagerly loads artist association

= Other Improvements

* The jdbc adapter now supports Database#freeze.  Possible
  thread-safety issues when initializing multiple jdbc Database
  instances in separate threads at the same time have been fixed.

* The postgres adapter now raises an exception if it recognizes that
  the loaded version of sequel_pg is incompatible.

* Sequel classes that are subclasses of core classes now define
  custom #inspect methods so instances can easily be differentiated from
  core class instances.  For example:

    Sequel::SQL::Blob.new('a')
    # => #<Sequel::SQL::Blob:0xa6f3a3c3710 bytes=1 content="a">
    Sequel::SQLTime.now
    # => #<Sequel::SQLTime 10:03:06>
    Sequel::LiteralString.new("foo")
    # => #<Sequel::LiteralString "foo">
    class Album < Sequel::Model; end
    Album.many_to_one :artist
    # => #<Sequel::Model::Associations::ManyToOneAssociationReflection Album.many_to_one :artist>
    Sequel::SQL::ValueList.new([[1,2]])
    # => #<Sequel::SQL::ValueList [[1, 2]]>

* Dataset#from_self now copies the columns from the current dataset
  if they are present, since wrapping a dataset in a subquery should
  not change the columns returned.

* On PostgreSQL, array type conversion now correctly handles false
  values.

* Another disconnect error is now recognized by the jdbc/as400
  adapter.

* Modifications to Sequel::Model::Associations::ASSOCIATION_TYPES
  are now thread safe, fixing issues if separate threads attempt
  to load separate model plugins that modify this hash.

* The force_encoding plugin no longer modifies the encoding of
  Sequel::SQL::Blob instances.

* Many plugins were updated so they no longer add constants to the
  namespace of the model that loads them.

= Backwards Compatibility

* Maintainers of external model plugins should update their
  code to support Model.freeze.

= Upcoming Deprecation

* Starting in Sequel 4.45.0, Sequel will be adding deprecation
  warnings for features that will be removed or where behavior will
  change in Sequel 5.