File: 2.8.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 (171 lines) | stat: -rw-r--r-- 6,392 bytes parent folder | download | duplicates (8)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
New Features
------------

* Sequel now supports database stored procedures similar to its
  support for prepared statements.  The API is as follows:

    DB[:table].call_sproc(:select, :mysp, 'param1', 'param2')
    # or
    sp = DB[:table].prepare_sproc(:select, :mysp)
    sp.call('param1', 'param2')
    sp.call('param3', 'param4')

  This works with Model datasets as well, allowing them to return
  model objects:

    Album.call_sproc(:select, :new_albums)
    #=> [#<Album ...>, #<Album ...>]

  You can call a stored procedure directly on the Database object
  if you want to, but the results and API are adapter dependent,
  and you definitely shouldn't do it if the stored procedure returns
  rows:

    DB.call_sproc(:mysp, :args=>['param1', 'param2'])

  Currently, the MySQL and JDBC adapters support stored procedures.
  Other adapters may support them in a future version.

* The connection pool code can now remove connections if the
  adapter raises a Sequel::DatabaseDisconnectError indicating that
  the connection has been lost.  When a query is attempted and
  the adapter raises this error, the connection pool removes the
  connection from the pool, and reraises the error.  The Oracle and
  PostgreSQL adapters currently support this, and other adapters may
  support it in a future version.

* Whether to upcase or quote identifiers can now be set separately.
  Previously, upcasing was done when quoting except when using SQLite,
  PostgreSQL, or MySQL.  Now, you can turn upcasing off while still
  quoting.  This may be necessary if you are using a MSSQL database
  that has lower case table names that conflict with reserved words.
  It also allows you to uppercase identifiers when using SQLite,
  PostgreSQL, or MySQL, which may be beneficial in certain cases.

  To turn upcasing on or off:

    # Global
    Sequel.upcase_identifiers = true
    # Database
    DB = Sequel.connect("postgres://...", :upcase_identifiers=>true)
    DB.upcase_identifiers = false
    # Dataset
    ds = DB[:items]
    ds.upcase_identifiers = true

* Options are now supported when altering a columns type:

    DB.alter_table(:items) do
      set_column_type :score, :integer, :unsigned=>true
      set_column_type :score, :varchar, :size=>30
      set_column_type :score, :enum, :elements=>['a', 'b']
    end

* Standard conforming strings are now turned on by default in the
  PostgreSQL adapter.  This makes PostgreSQL not interpret backslash
  escapes.  This is the PostgreSQL recommended setting, which will be
  the default setting in a future version of PostgreSQL.  If you
  don't want for force the use of standard strings, use:

    Sequel::Postgres.force_standard_strings = false

  You need to do that after you call Sequel.connect but before you
  use the database for anything, since that setting is set on
  initial connection.

* Sequel now raises an error if you attempt to use EXCEPT [ALL] or
  INTERSECT [ALL] on a database that doesn't support it.

* Sequel now raises an error if you attempt to use DISTINCT ON with
  MySQL or Oracle, which don't support it.

* A subadapter for the Progress RDBMS was added to the ODBC adapter.
  To connect to a Progress database, use the :db_type=>'progress'
  option.  This adapter targets Progress 9.

* The ODBC adapter now supports transactions.

* The MSSQL shared adapter now supports multi_insert (for inserting
  multiple rows at once), and unicode string literals.

Other Improvements
------------------

* There were many improvements related to using schemas in databases.
  Using schema-qualified tables should work in most if not all cases
  now.  Model associations, getting the schema, joins, and many other
  parts of Sequel were modified to allow the use of schema-qualifed
  tables.

* You can now use literal strings with placeholders as well as
  subselects when using prepared statements.  For example, the
  following all work now:

    DB[:items].filter("id = ?", :$i).call(:select, :i=>1)
    DB[:items].filter(:id=>DB[:items].select(:id)\
      .filter(:id=>:$i)).call(:select, :i=>1)
    DB["SELECT * FROM items WHERE id = ?", :$i].call(:select, :i=>1)

* Model#initialize received a few more micro-optimizations.

* Model#refresh now clears the changed columns as well as the
  associations.

* You can now drop columns inside a transaction when using SQLite.

* You can now submit multiple SQL queries at once in the MySQL
  adapter:

    DB['SELECT 1; SELECT 2'].all
    #=> [{:"1"=>1, :"2"=>2}]

  This may fix issues if you've seen a MySQL "commands out of sync"
  message.  Note that this doesn't work if you are connecting to
  MySQL via JDBC.

* You can now use AliasedExpressions directly in table names given
  to join_table:

    DB.from(:i.as(:j)).join(:k.as(:l), :a=>:b)
    #=> ... FROM i AS j INNER JOIN k AS l ON (l.a = j.b)

* Database#rename_table once again works on PostgreSQL.  It was
  broken in 2.7.0.

* The interval type is now treated as it's own type. It was
  previously treated as an integer type.

* Subselects are now aliased correctly when using Oracle.

* UNION, INTERSECT, and EXCEPT statements now appear before ORDER
  and LIMIT on most databases.  If you use these constructs, please
  test and make sure that they work correctly with your database.

* SQL EXCEPT clause now works on Oracle, which uses MINUS instead.

* Dataset#exists now returns a LiteralString, to make it easier to
  use.

* The Sequel.odbc_mssql method was removed, as the odbc_mssql adapter
  was removed in a previous version.  Instead, use:

    Sequel.odbc(..., :db_type=>'mssql')

Backwards Compatibilty
----------------------

* The hash returned by Database#schema when no table name is provided
  uses quoted strings instead of symbols as keys.  The hash has a
  default proc, so using the symbol will return the same value as
  before, but if you use each to iterate through the hash, the keys
  will be different.  This was necessary to handle schema-qualified
  tables.

* Database#table_exists? no longer checks the output of
  Database#tables.  If the table exists in the schema, it returns
  true, otherwise, it does a query.  This was necessary because
  table_exists? accepts multiple formats for table names and
  Database#tables is an array of symbols.

* When getting the schema on PostgreSQL, the default schema is now
  used even if the :schema=>nil option is used.