sequel 4.38.0 → 4.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +28 -0
  3. data/doc/association_basics.rdoc +1 -1
  4. data/doc/core_extensions.rdoc +8 -8
  5. data/doc/object_model.rdoc +7 -8
  6. data/doc/querying.rdoc +2 -2
  7. data/doc/release_notes/4.39.0.txt +127 -0
  8. data/doc/sql.rdoc +31 -31
  9. data/doc/transactions.rdoc +1 -1
  10. data/doc/virtual_rows.rdoc +1 -1
  11. data/lib/sequel/adapters/mock.rb +22 -66
  12. data/lib/sequel/adapters/shared/access.rb +2 -0
  13. data/lib/sequel/adapters/shared/cubrid.rb +2 -0
  14. data/lib/sequel/adapters/shared/db2.rb +2 -0
  15. data/lib/sequel/adapters/shared/firebird.rb +2 -0
  16. data/lib/sequel/adapters/shared/informix.rb +2 -0
  17. data/lib/sequel/adapters/shared/mssql.rb +10 -2
  18. data/lib/sequel/adapters/shared/mysql.rb +17 -4
  19. data/lib/sequel/adapters/shared/oracle.rb +9 -0
  20. data/lib/sequel/adapters/shared/postgres.rb +34 -1
  21. data/lib/sequel/adapters/shared/sqlanywhere.rb +1 -0
  22. data/lib/sequel/adapters/shared/sqlite.rb +8 -0
  23. data/lib/sequel/core.rb +10 -0
  24. data/lib/sequel/database.rb +5 -0
  25. data/lib/sequel/database/connecting.rb +28 -0
  26. data/lib/sequel/database/misc.rb +0 -51
  27. data/lib/sequel/database/query.rb +1 -1
  28. data/lib/sequel/database/schema_generator.rb +9 -0
  29. data/lib/sequel/database/transactions.rb +65 -0
  30. data/lib/sequel/dataset/actions.rb +1 -1
  31. data/lib/sequel/extensions/constraint_validations.rb +1 -1
  32. data/lib/sequel/extensions/core_extensions.rb +1 -1
  33. data/lib/sequel/extensions/core_refinements.rb +1 -1
  34. data/lib/sequel/extensions/migration.rb +17 -1
  35. data/lib/sequel/extensions/no_auto_literal_strings.rb +1 -1
  36. data/lib/sequel/extensions/pg_array_ops.rb +1 -1
  37. data/lib/sequel/extensions/pg_hstore_ops.rb +1 -1
  38. data/lib/sequel/extensions/pg_inet_ops.rb +1 -1
  39. data/lib/sequel/extensions/pg_interval.rb +1 -1
  40. data/lib/sequel/extensions/pg_json_ops.rb +28 -15
  41. data/lib/sequel/extensions/pg_range_ops.rb +1 -1
  42. data/lib/sequel/extensions/pg_row_ops.rb +1 -1
  43. data/lib/sequel/extensions/select_remove.rb +1 -1
  44. data/lib/sequel/extensions/sql_expr.rb +1 -1
  45. data/lib/sequel/model/associations.rb +1 -1
  46. data/lib/sequel/plugins/active_model.rb +19 -8
  47. data/lib/sequel/plugins/dataset_associations.rb +1 -1
  48. data/lib/sequel/plugins/hook_class_methods.rb +38 -2
  49. data/lib/sequel/plugins/list.rb +1 -1
  50. data/lib/sequel/plugins/pg_array_associations.rb +3 -3
  51. data/lib/sequel/plugins/timestamps.rb +15 -2
  52. data/lib/sequel/plugins/touch.rb +6 -0
  53. data/lib/sequel/sql.rb +15 -11
  54. data/lib/sequel/version.rb +1 -1
  55. data/spec/adapters/mysql_spec.rb +18 -0
  56. data/spec/adapters/postgres_spec.rb +30 -1
  57. data/spec/core/database_spec.rb +29 -0
  58. data/spec/core/mock_adapter_spec.rb +32 -1
  59. data/spec/extensions/migration_spec.rb +46 -0
  60. data/spec/extensions/pg_interval_spec.rb +1 -0
  61. data/spec/extensions/pg_json_ops_spec.rb +13 -0
  62. data/spec/extensions/timestamps_spec.rb +11 -0
  63. data/spec/extensions/touch_spec.rb +8 -0
  64. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbbe9aec719ae1c6ace4c686bf0e02f352b1283a
4
- data.tar.gz: 347e71c258109c785c11b55e354fd4f616060cdc
3
+ metadata.gz: faeae955d80275ae969500515f7a62f6db3ee1d2
4
+ data.tar.gz: 69e8bed296f9a6044bdbecfb29317562f2890bb8
5
5
  SHA512:
6
- metadata.gz: 3e8ef32de9f9efb9ae6b03598ca6a2809409b51a60fe2759fcd2c1556d8376c08fe31366db86f7016ea25745b16f6323428838f6ebd72c96ef4a7036514cf8ce
7
- data.tar.gz: 986105b21db0f6ffa3455e4cb8972a0b4af165026455d888bdec4054d3b31c71b8118e036c8f201934e99070ce11b3b88b32908a4d405225a11d97383fa0fd3b
6
+ metadata.gz: 6f87b9f699854635a13c664b49e0a9be073a6f1daf1dc00ccfa7c352d211939d514a39b5a057f4fd90a5f8ed7737ea8afc2f54afcbd68d0b8ca07babeed88e22
7
+ data.tar.gz: 9ff3136d2113273d89d4dd1552aa5ba30bea4e39edbfc4535f2762d35e6c21badfd5131e1f726be4d534b9f2f5960e498f9d7e3944e858716b7180c2a23c06ba
data/CHANGELOG CHANGED
@@ -1,3 +1,31 @@
1
+ === 4.39.0 (2016-10-01)
2
+
3
+ * Make active_model plugin use rollback_checker instead of after_rollback hook (jeremyevans)
4
+
5
+ * Add Database#rollback_checker, which returns a proc that returns whether the in progress transaction is rolled back (jeremyevans)
6
+
7
+ * Add Sequel::Database.set_shared_adapter_scheme to allow external adapters to support the mock adapter (jeremyevans)
8
+
9
+ * Make hook_class_methods plugin not use after commit/rollback model hooks (jeremyevans)
10
+
11
+ * Support add_column :after and :first options on MySQL (AnthonyBobsin, jeremyevans) (#1234)
12
+
13
+ * Support ActiveSupport 5 in pg_interval extension when weeks/hours are used in ActiveSupport::Duration objects (chanks) (#1233)
14
+
15
+ * Support IntegerMigrator :relative option, for running only the specified number of migrations up or down (jeremyevans)
16
+
17
+ * Make the touch plugin also touch associations on create in addition to update and delete (jeremyevans)
18
+
19
+ * Add :allow_manual_update timestamps plugin option for not overriding a manually set update timestamp (jeremyevans)
20
+
21
+ * Add Sequel.[] as an alias to Sequel.expr, for easier expression creation (jeremyevans)
22
+
23
+ * Add PostgreSQL full_text_search :to_tsquery=>:phrase option, for using PostgreSQL 9.6+ full text search phrase searching (jeremyevans)
24
+
25
+ * Add JSONBOp#insert in pg_json_ops extension, for jsonb_insert support on PostgreSQL 9.6+ (jeremyevans)
26
+
27
+ * Support add_column :if_not_exists option on PostgreSQL 9.6+ (jeremyevans)
28
+
1
29
  === 4.38.0 (2016-09-01)
2
30
 
3
31
  * Support :driver_options option when using the postgres adapter with pg driver (jeremyevans)
@@ -993,7 +993,7 @@ columns that have the same name in both the join table and the associated
993
993
  table. Example:
994
994
 
995
995
  Artist.one_to_many :albums, :select=>[:id, :name]
996
- Album.many_to_many :tags, :select=>[Sequel.expr(:tags).*, :albums_tags__number]
996
+ Album.many_to_many :tags, :select=>[Sequel[:tags].*, :albums_tags__number]
997
997
 
998
998
  ==== :limit
999
999
 
@@ -160,9 +160,9 @@ The * operator is overloaded on Symbol such that if it is called with no argumen
160
160
 
161
161
  :a.* # SQL: a.*
162
162
 
163
- Alternative: Sequel.expr.*:
163
+ Alternative: Sequel.[].*:
164
164
 
165
- Sequel.expr(:a).*
165
+ Sequel[:a].*
166
166
 
167
167
  ==== qualify
168
168
 
@@ -226,11 +226,11 @@ These Symbol methods are used to force the treating of the object as a specific
226
226
  :a.sql_number << 1 # SQL: a << 1
227
227
  :a.sql_string + 'a' # SQL: a || 'a'
228
228
 
229
- Alternative: Sequel.expr:
229
+ Alternative: Sequel.[]:
230
230
 
231
- Sequel.expr(:a).sql_boolean
232
- Sequel.expr(:a).sql_number
233
- Sequel.expr(:a).sql_string
231
+ Sequel[:a].sql_boolean
232
+ Sequel[:a].sql_number
233
+ Sequel[:a].sql_string
234
234
 
235
235
  ==== sql_function
236
236
 
@@ -300,9 +300,9 @@ Array#sql_expr and Hash#sql_expr treat the receiver as a conditions specifier, m
300
300
  {:a=>1, :b=>[2, 3]}.sql_expr # SQL: a = 1 AND b IN (2, 3)
301
301
  [[:a, 1], [:b, [2, 3]]].sql_expr # SQL: a = 1 AND b IN (2, 3)
302
302
 
303
- Alternative: Sequel.expr:
303
+ Alternative: Sequel.[]:
304
304
 
305
- Sequel.expr(:a=>1, :b=>[2, 3])
305
+ Sequel[:a=>1, :b=>[2, 3]]
306
306
 
307
307
  ==== sql_negate
308
308
 
@@ -160,7 +160,7 @@ Sequel generally uses hash objects to represent equality:
160
160
 
161
161
  {:column => 1} # ("column" = 1)
162
162
 
163
- However, if you use in array as the hash value, it will usually be used to represent inclusion:
163
+ However, if you use an array as the hash value, it will usually be used to represent inclusion:
164
164
 
165
165
  {:column => [1, 2, 3]} # ("column" IN (1, 2, 3))
166
166
 
@@ -270,7 +270,7 @@ automatic qualification or aliasing happens for them:
270
270
 
271
271
  The following shortcuts exist for creating Sequel::SQL::Identifier objects:
272
272
 
273
- Sequel.expr(:column)
273
+ Sequel[:column]
274
274
  Sequel.identifier(:col__umn)
275
275
  :col__umn.identifier # core_extensions extension
276
276
 
@@ -282,7 +282,7 @@ Sequel::SQL::QualifiedIdentifier objects represent qualified identifiers:
282
282
 
283
283
  The following shortcuts exist for creating Sequel::SQL::QualifiedIdentifier objects:
284
284
 
285
- Sequel.expr(:table__column)
285
+ Sequel[:table__column]
286
286
  Sequel.qualify(:table, :column)
287
287
  :column.qualify(:table) # core_extensions extension
288
288
 
@@ -299,7 +299,7 @@ is treated as an identifier, but the expression can be an arbitrary Sequel expre
299
299
 
300
300
  The following shortcuts exist for creating Sequel::SQL::AliasedExpression objects:
301
301
 
302
- Sequel.expr(:column___alias)
302
+ Sequel[:column___alias]
303
303
  Sequel.as(:column, :alias)
304
304
  Sequel.as(:column, :alias, [:column_alias1, :column_alias2])
305
305
  :column.as(:alias) # core_extensions extension
@@ -384,7 +384,7 @@ take arguments. Still, it's possible they are still useful in some code:
384
384
 
385
385
  The following shortcut exists for creating Sequel::SQL::ColumnAll objects:
386
386
 
387
- Sequel.expr(:table).*
387
+ Sequel[:table].*
388
388
  :table.* # core_extensions extension
389
389
 
390
390
  === Sequel::SQL::Constant
@@ -563,11 +563,10 @@ on the wrapper that would not be defined on the object itself:
563
563
 
564
564
  Sequel::SQL::Wrapper.new(o) + 1 # (foo + 1)
565
565
 
566
- You can use the Sequel.expr method to wrap any object:
566
+ You can use the Sequel.[] method to wrap any object:
567
567
 
568
- Sequel.expr(o)
568
+ Sequel[o]
569
569
 
570
570
  However, note that that does not necessarily return a Sequel::SQL::Wrapper
571
571
  object, it may return a different class of object, such as a
572
572
  Sequel::SQL::ComplexExpression subclass object.
573
-
@@ -416,11 +416,11 @@ which is used directly in the filter.
416
416
 
417
417
  You can use the DSL to create arbitrarily complex expressions. SQL::Expression
418
418
  objects can be created via singleton methods on the Sequel module. The most common
419
- method is Sequel.expr, which takes any object and wraps it in a SQL::Expression
419
+ method is Sequel.[], which takes any object and wraps it in a SQL::Expression
420
420
  object. In most cases, the SQL::Expression returned supports the & operator for
421
421
  +AND+, the | operator for +OR+, and the ~ operator for inversion:
422
422
 
423
- Artist.where(Sequel.like(:name, 'Y%') & (Sequel.expr(:b=>1) | Sequel.~(:c=>3)))
423
+ Artist.where(Sequel.like(:name, 'Y%') & (Sequel[:b=>1] | Sequel.~(:c=>3)))
424
424
  # SELECT * FROM artists WHERE name LIKE 'Y%' ESCAPE '\' AND (b = 1 OR c != 3)
425
425
 
426
426
  You can combine these expression operators with the virtual row support:
@@ -0,0 +1,127 @@
1
+ = New Features
2
+
3
+ * Sequel.[] has been added as an alias to Sequel.expr. This makes it
4
+ a little easier to get Sequel-specific objects:
5
+
6
+ Sequel[:table].* # "table".*
7
+ Sequel[:table__column].as(:alias) # "table"."column" AS "alias"
8
+ Sequel[:column] + 1 # ("column" + 1)
9
+
10
+ * The timestamps plugin now supports an :allow_manual_update option.
11
+ If this option is used, the timestamps plugin will not override the
12
+ update timestamp when saving if the user has modified it since
13
+ retrieving the object.
14
+
15
+ * The touch plugin now also touches associations on create in addition
16
+ to update and delete.
17
+
18
+ * The IntegerMigrator now supports a :relative option, which will
19
+ migrate that many migrations up (for positive numbers) or down (for
20
+ negative numbers).
21
+
22
+ * Database#rollback_checker has been added, which returns a callable
23
+ that can be called later to determine whether the transaction ended
24
+ up committing or rolling back. So if you may need to check
25
+ transaction status at some future point, and don't need immediate
26
+ action on rollback/commit, it is better to use a rollback checker
27
+ than to add an after commit/rollback hook.
28
+
29
+ rbc = nil
30
+ DB.transaction do
31
+ rbc = DB.rollback_checker
32
+ rbc.call #=> nil
33
+ end
34
+ rbc.call # => false
35
+
36
+ DB.transaction(:rollback=>:always) do
37
+ rbc = DB.rollback_checker
38
+ end
39
+ rbc.call # => true
40
+
41
+ * The add_column schema method now supports an :if_not_exists option
42
+ on PostgreSQL 9.6+, which will only add the column if it does not
43
+ already exist:
44
+
45
+ DB.add_column :t, :c, Integer, :if_not_exists=>true
46
+ # ALTER TABLE "t" ADD COLUMN IF NOT EXISTS "c" integer
47
+
48
+ * The add_column schema method now supports an :after and :first
49
+ option on MySQL to add the column after an existing column or as
50
+ the first column:
51
+
52
+ DB.add_column :t, :c, Integer, :first=>true
53
+ # ALTER TABLE `t` ADD COLUMN `c` integer FIRST
54
+ DB.add_column :t, :c1, Integer, :after=>:c2
55
+ # ALTER TABLE `t` ADD COLUMN `c1` integer AFTER `c2`
56
+
57
+ * JSONBOp#insert has been added to the pg_json_ops extension, which
58
+ supports the new jsonb_insert function added in PostgreSQL 9.6+:
59
+
60
+ Sequel.pg_jsonb_op(:c).insert(%w'0 a', 'a'=>1)
61
+ # jsonb_insert("c", ARRAY['0','a'], '{"a":1}'::jsonb, false)
62
+
63
+ * Dataset#full_text_search on PostgreSQL now supports a
64
+ :to_tsquery=>:phrase option, to enable the native phrase searching
65
+ added in PostgreSQL 9.6+:
66
+
67
+ DB[:t].full_text_search(:c, 'foo bar', :to_tsquery=>:phrase)
68
+ # SELECT * FROM "t"
69
+ # WHERE
70
+ # (to_tsvector(CAST('simple' AS regconfig), (COALESCE("c", '')))
71
+ # @@ phraseto_tsquery(CAST('simple' AS regconfig), 'foo bar'))
72
+
73
+ * Sequel::Database.set_shared_adapter_scheme has been added, allowing
74
+ external adapters to add support for Sequel's mock adapter.
75
+ External adapters should have a shared adapter requirable at
76
+ sequel/adapters/shared/adapter_name, that uses the following
77
+ format:
78
+
79
+ # in sequel/adapters/shared/mydb
80
+ module Sequel::MyDB
81
+ Sequel::Database.set_shared_adapter_scheme :mydb, self
82
+
83
+ def self.mock_adapter_setup(db)
84
+ # Any mock-adapter specific setup to perform on the
85
+ # given Database instance
86
+ end
87
+
88
+ module DatabaseMethods
89
+ # methods for all Database objects using this adapter
90
+ end
91
+
92
+ module DatasetMethods
93
+ # methods for all Dataset objects using this adapter
94
+ end
95
+ end
96
+
97
+
98
+ = Other Improvements
99
+
100
+ * The hook_class_methods plugin only adds a Database transaction
101
+ hook if one of the after commit/rollback hook class methods is
102
+ actually used. This means that loading the plugin no longer
103
+ keeps all saved/deleted objects in memory until transaction
104
+ commit.
105
+
106
+ * The active_model plugin now uses a rollback checker instead of
107
+ an after_rollback hook, so models that use the active_model plugin
108
+ no longer store all saved model instances in memory until
109
+ transaction commit.
110
+
111
+ * When using the IntegerMigrator, attempting to migrate to a
112
+ migration number above the maximum will now migrate to the lastest
113
+ version, and attempting to migrate to a migration number below 0
114
+ will now migrate all the way down.
115
+
116
+ * The pg_interval extension now supports ActiveSupport::Duration
117
+ objects that use week and hour parts (new in ActiveSupport 5).
118
+
119
+ = Backwards Compatibility
120
+
121
+ * The change to the touch plugin to touch associations on create could
122
+ possibly affect existing behavior, so if you are using this plugin,
123
+ you should test that this does not cause any problems.
124
+
125
+ * External adapters that tried to add support for the mock adapter
126
+ now need to update their code to use the new
127
+ Sequel::Database.set_shared_adapter_scheme method.
@@ -352,9 +352,9 @@ Sequel defines the inequality operators directly on most Sequel-specific express
352
352
  Sequel.function(:func) >= 1 # (func() >= 1)
353
353
  Sequel.function(:func, :column) <= 1 # (func("column") <= 1)
354
354
 
355
- If you want to use them on a symbol, you should call <tt>Sequel.expr</tt> with the symbol:
355
+ If you want to use them on a symbol, you should call <tt>Sequel.[]</tt> with the symbol:
356
356
 
357
- Sequel.expr(:column) > 1 # ("column" > 1)
357
+ Sequel[:column] > 1 # ("column" > 1)
358
358
 
359
359
  A common use of virtual rows is to handle inequality operators:
360
360
 
@@ -364,11 +364,11 @@ A common use of virtual rows is to handle inequality operators:
364
364
 
365
365
  The standard mathematical operates are defined on most Sequel-specific expression objects:
366
366
 
367
- Sequel.expr(:column) + 1 # "column" + 1
368
- Sequel.expr(:table__column) - 1 # "table"."column" - 1
367
+ Sequel[:column] + 1 # "column" + 1
368
+ Sequel[:table__column] - 1 # "table"."column" - 1
369
369
  Sequel.qualify(:table, :column) * 1 # "table"."column" * 1
370
- Sequel.expr(:column) / 1 # "column" / 1
371
- Sequel.expr(:column) ** 1 # power("column", 1)
370
+ Sequel[:column] / 1 # "column" / 1
371
+ Sequel[:column] ** 1 # power("column", 1)
372
372
 
373
373
  You can also call the operator methods directly on the Sequel module:
374
374
 
@@ -380,15 +380,15 @@ You can also call the operator methods directly on the Sequel module:
380
380
 
381
381
  Note that since Sequel implements support for ruby's coercion protocol, the following also works:
382
382
 
383
- 1 + Sequel.expr(:column)
383
+ 1 + Sequel[:column]
384
384
  1 - Sequel.qualify(:table__column)
385
385
 
386
386
  === Boolean Operators (AND OR)
387
387
 
388
388
  Sequel defines the & and | methods on most Sequel-specific expression objects to handle AND and OR:
389
389
 
390
- Sequel.expr(:column1) & :column2 # ("column1" AND "column2")
391
- Sequel.expr(:column1=>1) | {:column2=>2} # (("column1" = 1) OR ("column2" = 2))
390
+ Sequel[:column1] & :column2 # ("column1" AND "column2")
391
+ Sequel[:column1=>1] | {:column2=>2} # (("column1" = 1) OR ("column2" = 2))
392
392
  (Sequel.function(:func) > 1) & :column3 # ((func() > 1) AND "column3")
393
393
 
394
394
  Note the use of parentheses in the last statement. If you omit them, you won't get what you expect.
@@ -430,8 +430,8 @@ Note again that <tt>Dataset#exclude</tt> uses ~, not +negate+:
430
430
 
431
431
  Casting in Sequel is done with the +cast+ method, which is available on most of the Sequel-specific expression objects:
432
432
 
433
- Sequel.expr(:name).cast(:text) # CAST("name" AS text)
434
- Sequel.expr('1').cast(:integer) # CAST('1' AS integer)
433
+ Sequel[:name].cast(:text) # CAST("name" AS text)
434
+ Sequel['1'].cast(:integer) # CAST('1' AS integer)
435
435
  Sequel.qualify(:table, :column).cast(:date) # CAST("table"."column" AS date)
436
436
 
437
437
  You can also use the <tt>Sequel.cast</tt> method:
@@ -442,41 +442,41 @@ You can also use the <tt>Sequel.cast</tt> method:
442
442
 
443
443
  Sequel allows the use of bitwise mathematical operators on Sequel::SQL::NumericExpression objects:
444
444
 
445
- Sequel.expr(:number) + 1 # => #<Sequel::SQL::NumericExpression ...>
446
- (Sequel.expr(:number) + 1) & 5 # (("number" + 1) & 5)
445
+ Sequel[:number] + 1 # => #<Sequel::SQL::NumericExpression ...>
446
+ (Sequel[:number] + 1) & 5 # (("number" + 1) & 5)
447
447
 
448
448
  As you can see, when you use the + operator on a symbol, you get a NumericExpression. You can turn an expression a NumericExpression using +sql_number+:
449
449
 
450
- Sequel.expr(:number).sql_number | 5 # ("number" | 5)
450
+ Sequel[:number].sql_number | 5 # ("number" | 5)
451
451
  Sequel.function(:func).sql_number << 7 # (func() << 7)
452
452
  Sequel.cast(:name, :integer).sql_number >> 8 # (CAST("name" AS integer) >> 8)
453
453
 
454
454
  Sequel allows you to do the cast and conversion at the same time via +cast_numeric+:
455
455
 
456
- Sequel.expr(:name).cast_numeric ^ 9 # (CAST("name" AS integer) ^ 9)
456
+ Sequel[:name].cast_numeric ^ 9 # (CAST("name" AS integer) ^ 9)
457
457
 
458
458
  Note that &, |, and ~ are already defined to do AND, OR, and NOT on most expressions, so if you want to use the bitwise operators, you need to make sure that they are converted first:
459
459
 
460
- ~Sequel.expr(:name) # NOT "name"
461
- ~Sequel.expr(:name).sql_number # ~"name"
460
+ ~Sequel[:name] # NOT "name"
461
+ ~Sequel[:name].sql_number # ~"name"
462
462
 
463
463
  === String Operators (||, LIKE, Regexp)
464
464
 
465
465
  Sequel allows the use of the string concatenation operator on Sequel::SQL::StringExpression objects, which can be created using the +sql_string+ method on an expression:
466
466
 
467
- Sequel.expr(:name).sql_string + ' - Name' # ("name" || ' - Name')
467
+ Sequel[:name].sql_string + ' - Name' # ("name" || ' - Name')
468
468
 
469
469
  Just like for the bitwise operators, Sequel allows you do do the cast and conversion at the same time via +cast_string+:
470
470
 
471
- Sequel.expr(:number).cast_string + ' - Number' # (CAST(number AS varchar(255)) || ' - Number')
471
+ Sequel[:number].cast_string + ' - Number' # (CAST(number AS varchar(255)) || ' - Number')
472
472
 
473
473
  Note that similar to the mathematical operators, you cannot switch the order the expression and have it work:
474
474
 
475
- 'Name - ' + Sequel.expr(:name).sql_string # raises TypeError
475
+ 'Name - ' + Sequel[:name].sql_string # raises TypeError
476
476
 
477
- Just like for the mathematical operators, you can use <tt>Sequel.expr</tt> to wrap the object:
477
+ Just like for the mathematical operators, you can use <tt>Sequel.[]</tt> to wrap the object:
478
478
 
479
- Sequel.expr('Name - ') + :name # ('Name - ' || "name")
479
+ Sequel['Name - '] + :name # ('Name - ' || "name")
480
480
 
481
481
  The <tt>Sequel.join</tt> method concatenates all of the elements in the array:
482
482
 
@@ -488,8 +488,8 @@ Just like ruby's <tt>String#join</tt>, you can provide an argument for a string
488
488
 
489
489
  For the LIKE operator, Sequel defines the +like+ and +ilike+ methods on most Sequel-specific expression objects:
490
490
 
491
- Sequel.expr(:name).like('A%') # ("name" LIKE 'A%' ESCAPE '\')
492
- Sequel.expr(:name).ilike('A%') # ("name" ILIKE 'A%' ESCAPE '\')
491
+ Sequel[:name].like('A%') # ("name" LIKE 'A%' ESCAPE '\')
492
+ Sequel[:name].ilike('A%') # ("name" ILIKE 'A%' ESCAPE '\')
493
493
 
494
494
  You can also use the <tt>Sequel.like</tt> and <tt>Sequel.ilike</tt> methods:
495
495
 
@@ -515,24 +515,24 @@ Note that using +ilike+ with a regular expression will always make the regexp ca
515
515
 
516
516
  Sequel supports specifying ascending or descending order using the +asc+ and +desc+ method on most Sequel-specific expression objects:
517
517
 
518
- Sequel.expr(:column).asc # "column" ASC
519
- Sequel.expr(:column).qualify(:table).desc # "table"."column" DESC
518
+ Sequel[:column].asc # "column" ASC
519
+ Sequel[:column].qualify(:table).desc # "table"."column" DESC
520
520
 
521
521
  You can also use the <tt>Sequel.asc</tt> and <tt>Sequel.desc</tt> methods:
522
522
 
523
523
  Sequel.asc(:column) # "column" ASC
524
- Sequel.desc(Sequel.expr(:column).qualify(:table)) # "table"."column" DESC
524
+ Sequel.desc(Sequel[:column].qualify(:table)) # "table"."column" DESC
525
525
 
526
526
  On some databases, you can specify null ordering:
527
527
 
528
528
  Sequel.asc(:column, :nulls=>:first) # "column" ASC NULLS FIRST
529
- Sequel.desc(Sequel.expr(:column).qualify(:table), :nulls=>:last) # "table"."column" DESC NULLS LAST
529
+ Sequel.desc(Sequel[:column].qualify(:table), :nulls=>:last) # "table"."column" DESC NULLS LAST
530
530
 
531
531
  === All Columns (.*)
532
532
 
533
533
  To select all columns in a table, Sequel supports the * method on identifiers without an argument:
534
534
 
535
- Sequel.expr(:table).* # "table".*
535
+ Sequel[:table].* # "table".*
536
536
 
537
537
  === CASE statements
538
538
 
@@ -555,8 +555,8 @@ If you provide a 3rd argument to <tt>Sequel.case</tt>, it goes between CASE and
555
555
 
556
556
  Sequel supports SQL subscripts using the +sql_subscript+ method on most Sequel-specific expression objects:
557
557
 
558
- Sequel.expr(:column).sql_subscript(3) # column[3]
559
- Sequel.expr(:column).qualify(:table).sql_subscript(3) # table.column[3]
558
+ Sequel[:column].sql_subscript(3) # column[3]
559
+ Sequel[:column].qualify(:table).sql_subscript(3) # table.column[3]
560
560
 
561
561
  You can also use the <tt>Sequel.subscript</tt> method:
562
562