sequel 5.83.1 → 5.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sequel/adapters/shared/sqlite.rb +3 -1
- data/lib/sequel/connection_pool.rb +2 -2
- data/lib/sequel/database/schema_methods.rb +2 -0
- data/lib/sequel/dataset/actions.rb +9 -1
- data/lib/sequel/extensions/dataset_run.rb +41 -0
- data/lib/sequel/extensions/pg_json_ops.rb +642 -9
- data/lib/sequel/sql.rb +8 -5
- data/lib/sequel/version.rb +2 -2
- metadata +4 -237
- data/CHANGELOG +0 -1397
- data/README.rdoc +0 -936
- data/doc/advanced_associations.rdoc +0 -884
- data/doc/association_basics.rdoc +0 -1859
- data/doc/bin_sequel.rdoc +0 -146
- data/doc/cheat_sheet.rdoc +0 -255
- data/doc/code_order.rdoc +0 -104
- data/doc/core_extensions.rdoc +0 -405
- data/doc/dataset_basics.rdoc +0 -96
- data/doc/dataset_filtering.rdoc +0 -222
- data/doc/extensions.rdoc +0 -77
- data/doc/fork_safety.rdoc +0 -84
- data/doc/mass_assignment.rdoc +0 -98
- data/doc/migration.rdoc +0 -660
- data/doc/model_dataset_method_design.rdoc +0 -129
- data/doc/model_hooks.rdoc +0 -254
- data/doc/model_plugins.rdoc +0 -270
- data/doc/mssql_stored_procedures.rdoc +0 -43
- data/doc/object_model.rdoc +0 -563
- data/doc/opening_databases.rdoc +0 -439
- data/doc/postgresql.rdoc +0 -611
- data/doc/prepared_statements.rdoc +0 -144
- data/doc/querying.rdoc +0 -1070
- data/doc/reflection.rdoc +0 -120
- data/doc/release_notes/5.0.0.txt +0 -159
- data/doc/release_notes/5.1.0.txt +0 -31
- data/doc/release_notes/5.10.0.txt +0 -84
- data/doc/release_notes/5.11.0.txt +0 -83
- data/doc/release_notes/5.12.0.txt +0 -141
- data/doc/release_notes/5.13.0.txt +0 -27
- data/doc/release_notes/5.14.0.txt +0 -63
- data/doc/release_notes/5.15.0.txt +0 -39
- data/doc/release_notes/5.16.0.txt +0 -110
- data/doc/release_notes/5.17.0.txt +0 -31
- data/doc/release_notes/5.18.0.txt +0 -69
- data/doc/release_notes/5.19.0.txt +0 -28
- data/doc/release_notes/5.2.0.txt +0 -33
- data/doc/release_notes/5.20.0.txt +0 -89
- data/doc/release_notes/5.21.0.txt +0 -87
- data/doc/release_notes/5.22.0.txt +0 -48
- data/doc/release_notes/5.23.0.txt +0 -56
- data/doc/release_notes/5.24.0.txt +0 -56
- data/doc/release_notes/5.25.0.txt +0 -32
- data/doc/release_notes/5.26.0.txt +0 -35
- data/doc/release_notes/5.27.0.txt +0 -21
- data/doc/release_notes/5.28.0.txt +0 -16
- data/doc/release_notes/5.29.0.txt +0 -22
- data/doc/release_notes/5.3.0.txt +0 -121
- data/doc/release_notes/5.30.0.txt +0 -20
- data/doc/release_notes/5.31.0.txt +0 -148
- data/doc/release_notes/5.32.0.txt +0 -46
- data/doc/release_notes/5.33.0.txt +0 -24
- data/doc/release_notes/5.34.0.txt +0 -40
- data/doc/release_notes/5.35.0.txt +0 -56
- data/doc/release_notes/5.36.0.txt +0 -60
- data/doc/release_notes/5.37.0.txt +0 -30
- data/doc/release_notes/5.38.0.txt +0 -28
- data/doc/release_notes/5.39.0.txt +0 -19
- data/doc/release_notes/5.4.0.txt +0 -80
- data/doc/release_notes/5.40.0.txt +0 -40
- data/doc/release_notes/5.41.0.txt +0 -25
- data/doc/release_notes/5.42.0.txt +0 -136
- data/doc/release_notes/5.43.0.txt +0 -98
- data/doc/release_notes/5.44.0.txt +0 -32
- data/doc/release_notes/5.45.0.txt +0 -34
- data/doc/release_notes/5.46.0.txt +0 -87
- data/doc/release_notes/5.47.0.txt +0 -59
- data/doc/release_notes/5.48.0.txt +0 -14
- data/doc/release_notes/5.49.0.txt +0 -59
- data/doc/release_notes/5.5.0.txt +0 -61
- data/doc/release_notes/5.50.0.txt +0 -78
- data/doc/release_notes/5.51.0.txt +0 -47
- data/doc/release_notes/5.52.0.txt +0 -87
- data/doc/release_notes/5.53.0.txt +0 -23
- data/doc/release_notes/5.54.0.txt +0 -27
- data/doc/release_notes/5.55.0.txt +0 -21
- data/doc/release_notes/5.56.0.txt +0 -51
- data/doc/release_notes/5.57.0.txt +0 -23
- data/doc/release_notes/5.58.0.txt +0 -31
- data/doc/release_notes/5.59.0.txt +0 -73
- data/doc/release_notes/5.6.0.txt +0 -31
- data/doc/release_notes/5.60.0.txt +0 -22
- data/doc/release_notes/5.61.0.txt +0 -43
- data/doc/release_notes/5.62.0.txt +0 -132
- data/doc/release_notes/5.63.0.txt +0 -33
- data/doc/release_notes/5.64.0.txt +0 -50
- data/doc/release_notes/5.65.0.txt +0 -21
- data/doc/release_notes/5.66.0.txt +0 -24
- data/doc/release_notes/5.67.0.txt +0 -32
- data/doc/release_notes/5.68.0.txt +0 -61
- data/doc/release_notes/5.69.0.txt +0 -26
- data/doc/release_notes/5.7.0.txt +0 -108
- data/doc/release_notes/5.70.0.txt +0 -35
- data/doc/release_notes/5.71.0.txt +0 -21
- data/doc/release_notes/5.72.0.txt +0 -33
- data/doc/release_notes/5.73.0.txt +0 -66
- data/doc/release_notes/5.74.0.txt +0 -45
- data/doc/release_notes/5.75.0.txt +0 -35
- data/doc/release_notes/5.76.0.txt +0 -86
- data/doc/release_notes/5.77.0.txt +0 -63
- data/doc/release_notes/5.78.0.txt +0 -67
- data/doc/release_notes/5.79.0.txt +0 -28
- data/doc/release_notes/5.8.0.txt +0 -170
- data/doc/release_notes/5.80.0.txt +0 -40
- data/doc/release_notes/5.81.0.txt +0 -31
- data/doc/release_notes/5.82.0.txt +0 -61
- data/doc/release_notes/5.83.0.txt +0 -56
- data/doc/release_notes/5.9.0.txt +0 -99
- data/doc/schema_modification.rdoc +0 -679
- data/doc/security.rdoc +0 -443
- data/doc/sharding.rdoc +0 -286
- data/doc/sql.rdoc +0 -648
- data/doc/testing.rdoc +0 -204
- data/doc/thread_safety.rdoc +0 -15
- data/doc/transactions.rdoc +0 -250
- data/doc/validations.rdoc +0 -558
- data/doc/virtual_rows.rdoc +0 -265
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecb752c20a2b59df814e873f04ac143aadd875b503b2400cca8929d9eabff572
|
|
4
|
+
data.tar.gz: d528c6d03626b725f27599c8cf624311517e4f4fe67c12139a2e815278fbb707
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4fcb91f8acb96a4a57152c9a0f41e78af1b42d6c393f8c90b2099e00d632676096c8ac27b0e31699fd31be0e22912b55e4372353fef93e967e548741dbc6406e
|
|
7
|
+
data.tar.gz: e2545b4dcca9ca1a13f47cbfdf2f38802d2564f7f0766d526e5041b93a94142560517f5d3ef5c9a5d2692e67a482c8044b4812c064fd35c2edf0c19a3df6b25c
|
|
@@ -349,7 +349,7 @@ module Sequel
|
|
|
349
349
|
ps
|
|
350
350
|
end
|
|
351
351
|
|
|
352
|
-
# Support creating STRICT AND/OR WITHOUT ROWID tables via :strict and :without_rowid options
|
|
352
|
+
# Support creating STRICT AND/OR WITHOUT ROWID tables via :strict and :without_rowid options, and VIRTUAL tables with :using option.
|
|
353
353
|
def create_table_sql(name, generator, options)
|
|
354
354
|
if options[:strict] && options[:without_rowid]
|
|
355
355
|
"#{super} STRICT, WITHOUT ROWID"
|
|
@@ -357,6 +357,8 @@ module Sequel
|
|
|
357
357
|
"#{super} STRICT"
|
|
358
358
|
elsif options[:without_rowid]
|
|
359
359
|
"#{super} WITHOUT ROWID"
|
|
360
|
+
elsif options[:using]
|
|
361
|
+
"CREATE VIRTUAL TABLE#{' IF NOT EXISTS' if options[:if_not_exists]} #{create_table_table_name_sql(name, options)} USING #{options[:using]}"
|
|
360
362
|
else
|
|
361
363
|
super
|
|
362
364
|
end
|
|
@@ -70,13 +70,13 @@ class Sequel::ConnectionPool
|
|
|
70
70
|
else
|
|
71
71
|
pc = if opts[:single_threaded]
|
|
72
72
|
opts[:servers] ? :sharded_single : :single
|
|
73
|
-
|
|
74
|
-
elsif RUBY_VERSION >= '3.4' # SEQUEL6 or maybe earlier switch to 3.2
|
|
73
|
+
elsif RUBY_VERSION >= '3.2'
|
|
75
74
|
opts[:servers] ? :sharded_timed_queue : :timed_queue
|
|
76
75
|
# :nocov:
|
|
77
76
|
else
|
|
78
77
|
opts[:servers] ? :sharded_threaded : :threaded
|
|
79
78
|
end
|
|
79
|
+
# :nocov:
|
|
80
80
|
|
|
81
81
|
connection_pool_class(:pool_class=>pc)
|
|
82
82
|
end
|
|
@@ -191,6 +191,8 @@ module Sequel
|
|
|
191
191
|
# The +any+ type is treated like a SQLite column in a non-strict table,
|
|
192
192
|
# allowing any type of data to be stored. This option is supported on
|
|
193
193
|
# SQLite 3.37.0+.
|
|
194
|
+
# :using :: Create a VIRTUAL table with the given USING clause. The value should be
|
|
195
|
+
# a string, as it is used directly in the SQL query.
|
|
194
196
|
# :without_rowid :: Create a WITHOUT ROWID table. Every row in SQLite has a special
|
|
195
197
|
# 'rowid' column, that uniquely identifies that row within the table.
|
|
196
198
|
# If this option is used, the 'rowid' column is omitted, which can
|
|
@@ -217,7 +217,7 @@ module Sequel
|
|
|
217
217
|
case args.length
|
|
218
218
|
when 0
|
|
219
219
|
unless block
|
|
220
|
-
return single_record
|
|
220
|
+
return(@opts[:sql] ? single_record! : single_record)
|
|
221
221
|
end
|
|
222
222
|
when 1
|
|
223
223
|
arg = args[0]
|
|
@@ -282,6 +282,12 @@ module Sequel
|
|
|
282
282
|
#
|
|
283
283
|
# DB[:table].get{[sum(id).as(sum), name]} # SELECT sum(id) AS sum, name FROM table LIMIT 1
|
|
284
284
|
# # => [6, 'foo']
|
|
285
|
+
#
|
|
286
|
+
# If called on a dataset with raw SQL, returns the
|
|
287
|
+
# first value in the dataset without changing the selection or setting a limit:
|
|
288
|
+
#
|
|
289
|
+
# DB["SELECT id FROM table"].get # SELECT id FROM table
|
|
290
|
+
# # => 3
|
|
285
291
|
def get(column=(no_arg=true; nil), &block)
|
|
286
292
|
ds = naked
|
|
287
293
|
if block
|
|
@@ -289,6 +295,8 @@ module Sequel
|
|
|
289
295
|
ds = ds.select(&block)
|
|
290
296
|
column = ds.opts[:select]
|
|
291
297
|
column = nil if column.is_a?(Array) && column.length < 2
|
|
298
|
+
elsif no_arg && opts[:sql]
|
|
299
|
+
return ds.single_value!
|
|
292
300
|
else
|
|
293
301
|
case column
|
|
294
302
|
when Array
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen-string-literal: true
|
|
2
|
+
#
|
|
3
|
+
# The dataset_run extension is designed for cases where you want
|
|
4
|
+
# to use dataset methods to build a query, but want to run that
|
|
5
|
+
# query without returning a result. The most common need would
|
|
6
|
+
# be to easily use placeholders in an SQL string, which Database#run
|
|
7
|
+
# does not support directly.
|
|
8
|
+
#
|
|
9
|
+
# You can load this extension into specific datasets:
|
|
10
|
+
#
|
|
11
|
+
# ds = DB["GRANT SELECT ON ? TO ?", :table, :user]
|
|
12
|
+
# ds = ds.extension(:dataset_run)
|
|
13
|
+
# ds.run
|
|
14
|
+
#
|
|
15
|
+
# Or you can load it into all of a database's datasets, which
|
|
16
|
+
# is probably the desired behavior if you are using this extension:
|
|
17
|
+
#
|
|
18
|
+
# DB.extension(:dataset_run)
|
|
19
|
+
# DB["GRANT SELECT ON ? TO ?", :table, :user].run
|
|
20
|
+
#
|
|
21
|
+
# Related module: Sequel::DatasetRun
|
|
22
|
+
|
|
23
|
+
#
|
|
24
|
+
module Sequel
|
|
25
|
+
module DatasetRun
|
|
26
|
+
# Run the dataset's SQL on the database. Returns NULL. This is
|
|
27
|
+
# useful when you want to run SQL without returning a result.
|
|
28
|
+
#
|
|
29
|
+
# DB["GRANT SELECT ON ? TO ?", :table, :user].run
|
|
30
|
+
# # GRANT SELECT ON "table" TO "user"
|
|
31
|
+
def run
|
|
32
|
+
if server = @opts[:server]
|
|
33
|
+
db.run(sql, :server=>server)
|
|
34
|
+
else
|
|
35
|
+
db.run(sql)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
Dataset.register_extension(:dataset_run, DatasetRun)
|
|
41
|
+
end
|