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.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sequel/adapters/shared/sqlite.rb +3 -1
  3. data/lib/sequel/connection_pool.rb +2 -2
  4. data/lib/sequel/database/schema_methods.rb +2 -0
  5. data/lib/sequel/dataset/actions.rb +9 -1
  6. data/lib/sequel/extensions/dataset_run.rb +41 -0
  7. data/lib/sequel/extensions/pg_json_ops.rb +642 -9
  8. data/lib/sequel/sql.rb +8 -5
  9. data/lib/sequel/version.rb +2 -2
  10. metadata +4 -237
  11. data/CHANGELOG +0 -1397
  12. data/README.rdoc +0 -936
  13. data/doc/advanced_associations.rdoc +0 -884
  14. data/doc/association_basics.rdoc +0 -1859
  15. data/doc/bin_sequel.rdoc +0 -146
  16. data/doc/cheat_sheet.rdoc +0 -255
  17. data/doc/code_order.rdoc +0 -104
  18. data/doc/core_extensions.rdoc +0 -405
  19. data/doc/dataset_basics.rdoc +0 -96
  20. data/doc/dataset_filtering.rdoc +0 -222
  21. data/doc/extensions.rdoc +0 -77
  22. data/doc/fork_safety.rdoc +0 -84
  23. data/doc/mass_assignment.rdoc +0 -98
  24. data/doc/migration.rdoc +0 -660
  25. data/doc/model_dataset_method_design.rdoc +0 -129
  26. data/doc/model_hooks.rdoc +0 -254
  27. data/doc/model_plugins.rdoc +0 -270
  28. data/doc/mssql_stored_procedures.rdoc +0 -43
  29. data/doc/object_model.rdoc +0 -563
  30. data/doc/opening_databases.rdoc +0 -439
  31. data/doc/postgresql.rdoc +0 -611
  32. data/doc/prepared_statements.rdoc +0 -144
  33. data/doc/querying.rdoc +0 -1070
  34. data/doc/reflection.rdoc +0 -120
  35. data/doc/release_notes/5.0.0.txt +0 -159
  36. data/doc/release_notes/5.1.0.txt +0 -31
  37. data/doc/release_notes/5.10.0.txt +0 -84
  38. data/doc/release_notes/5.11.0.txt +0 -83
  39. data/doc/release_notes/5.12.0.txt +0 -141
  40. data/doc/release_notes/5.13.0.txt +0 -27
  41. data/doc/release_notes/5.14.0.txt +0 -63
  42. data/doc/release_notes/5.15.0.txt +0 -39
  43. data/doc/release_notes/5.16.0.txt +0 -110
  44. data/doc/release_notes/5.17.0.txt +0 -31
  45. data/doc/release_notes/5.18.0.txt +0 -69
  46. data/doc/release_notes/5.19.0.txt +0 -28
  47. data/doc/release_notes/5.2.0.txt +0 -33
  48. data/doc/release_notes/5.20.0.txt +0 -89
  49. data/doc/release_notes/5.21.0.txt +0 -87
  50. data/doc/release_notes/5.22.0.txt +0 -48
  51. data/doc/release_notes/5.23.0.txt +0 -56
  52. data/doc/release_notes/5.24.0.txt +0 -56
  53. data/doc/release_notes/5.25.0.txt +0 -32
  54. data/doc/release_notes/5.26.0.txt +0 -35
  55. data/doc/release_notes/5.27.0.txt +0 -21
  56. data/doc/release_notes/5.28.0.txt +0 -16
  57. data/doc/release_notes/5.29.0.txt +0 -22
  58. data/doc/release_notes/5.3.0.txt +0 -121
  59. data/doc/release_notes/5.30.0.txt +0 -20
  60. data/doc/release_notes/5.31.0.txt +0 -148
  61. data/doc/release_notes/5.32.0.txt +0 -46
  62. data/doc/release_notes/5.33.0.txt +0 -24
  63. data/doc/release_notes/5.34.0.txt +0 -40
  64. data/doc/release_notes/5.35.0.txt +0 -56
  65. data/doc/release_notes/5.36.0.txt +0 -60
  66. data/doc/release_notes/5.37.0.txt +0 -30
  67. data/doc/release_notes/5.38.0.txt +0 -28
  68. data/doc/release_notes/5.39.0.txt +0 -19
  69. data/doc/release_notes/5.4.0.txt +0 -80
  70. data/doc/release_notes/5.40.0.txt +0 -40
  71. data/doc/release_notes/5.41.0.txt +0 -25
  72. data/doc/release_notes/5.42.0.txt +0 -136
  73. data/doc/release_notes/5.43.0.txt +0 -98
  74. data/doc/release_notes/5.44.0.txt +0 -32
  75. data/doc/release_notes/5.45.0.txt +0 -34
  76. data/doc/release_notes/5.46.0.txt +0 -87
  77. data/doc/release_notes/5.47.0.txt +0 -59
  78. data/doc/release_notes/5.48.0.txt +0 -14
  79. data/doc/release_notes/5.49.0.txt +0 -59
  80. data/doc/release_notes/5.5.0.txt +0 -61
  81. data/doc/release_notes/5.50.0.txt +0 -78
  82. data/doc/release_notes/5.51.0.txt +0 -47
  83. data/doc/release_notes/5.52.0.txt +0 -87
  84. data/doc/release_notes/5.53.0.txt +0 -23
  85. data/doc/release_notes/5.54.0.txt +0 -27
  86. data/doc/release_notes/5.55.0.txt +0 -21
  87. data/doc/release_notes/5.56.0.txt +0 -51
  88. data/doc/release_notes/5.57.0.txt +0 -23
  89. data/doc/release_notes/5.58.0.txt +0 -31
  90. data/doc/release_notes/5.59.0.txt +0 -73
  91. data/doc/release_notes/5.6.0.txt +0 -31
  92. data/doc/release_notes/5.60.0.txt +0 -22
  93. data/doc/release_notes/5.61.0.txt +0 -43
  94. data/doc/release_notes/5.62.0.txt +0 -132
  95. data/doc/release_notes/5.63.0.txt +0 -33
  96. data/doc/release_notes/5.64.0.txt +0 -50
  97. data/doc/release_notes/5.65.0.txt +0 -21
  98. data/doc/release_notes/5.66.0.txt +0 -24
  99. data/doc/release_notes/5.67.0.txt +0 -32
  100. data/doc/release_notes/5.68.0.txt +0 -61
  101. data/doc/release_notes/5.69.0.txt +0 -26
  102. data/doc/release_notes/5.7.0.txt +0 -108
  103. data/doc/release_notes/5.70.0.txt +0 -35
  104. data/doc/release_notes/5.71.0.txt +0 -21
  105. data/doc/release_notes/5.72.0.txt +0 -33
  106. data/doc/release_notes/5.73.0.txt +0 -66
  107. data/doc/release_notes/5.74.0.txt +0 -45
  108. data/doc/release_notes/5.75.0.txt +0 -35
  109. data/doc/release_notes/5.76.0.txt +0 -86
  110. data/doc/release_notes/5.77.0.txt +0 -63
  111. data/doc/release_notes/5.78.0.txt +0 -67
  112. data/doc/release_notes/5.79.0.txt +0 -28
  113. data/doc/release_notes/5.8.0.txt +0 -170
  114. data/doc/release_notes/5.80.0.txt +0 -40
  115. data/doc/release_notes/5.81.0.txt +0 -31
  116. data/doc/release_notes/5.82.0.txt +0 -61
  117. data/doc/release_notes/5.83.0.txt +0 -56
  118. data/doc/release_notes/5.9.0.txt +0 -99
  119. data/doc/schema_modification.rdoc +0 -679
  120. data/doc/security.rdoc +0 -443
  121. data/doc/sharding.rdoc +0 -286
  122. data/doc/sql.rdoc +0 -648
  123. data/doc/testing.rdoc +0 -204
  124. data/doc/thread_safety.rdoc +0 -15
  125. data/doc/transactions.rdoc +0 -250
  126. data/doc/validations.rdoc +0 -558
  127. data/doc/virtual_rows.rdoc +0 -265
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 892c809f3a378e80b21c29cc1c7f95f4a9fd0b47621a10d314b6177641f1ed4b
4
- data.tar.gz: be68a7d44ecd5af4e7d7d67484ea6fc200e663b8649c250fcfc4be11de9f4c3d
3
+ metadata.gz: ecb752c20a2b59df814e873f04ac143aadd875b503b2400cca8929d9eabff572
4
+ data.tar.gz: d528c6d03626b725f27599c8cf624311517e4f4fe67c12139a2e815278fbb707
5
5
  SHA512:
6
- metadata.gz: ac626e338969ddf7e99b554070b7383e3ce2e712ca2033b1c65dc2181c36636740a4e1858fa6cdb6bede1493a93aeac8299bbc26acfb2ed515a654a2957de7e4
7
- data.tar.gz: 660dc4b4bded4eb08e357d92f093be43ac8613e62f1a8a693d1c6d81b64ddec3081147303ac10cd9153f8d62d2ce3459d8fd871412156fd5342c325ca654371c
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
- # :nocov:
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