@@ -374,7 +374,7 @@ A common use of virtual rows is to handle inequality operators:
374374
375375 DB[:albums].where{col1 > col2} # SELECT * FROM "albums" WHERE ("col1" > "col2")
376376
377- === Standard Mathematical Operators (+ - * /)
377+ === Standard Mathematical Operators (+ - * / ** )
378378
379379The standard mathematical operates are defined on most Sequel-specific expression objects:
380380
@@ -464,7 +464,7 @@ You can also use the <tt>Sequel.cast</tt> method:
464464
465465 Sequel.cast(:name, :text) # CAST("name" AS text)
466466
467- === Bitwise Mathematical Operators (& | ^ << >> ~)
467+ === Bitwise Mathematical Operators (& | ^ << >> ~ % )
468468
469469Sequel allows the use of bitwise mathematical operators on Sequel::SQL::NumericExpression objects:
470470
@@ -476,6 +476,7 @@ As you can see, when you use the + operator on a symbol, you get a NumericExpres
476476 Sequel[:number].sql_number | 5 # ("number" | 5)
477477 Sequel.function(:func).sql_number << 7 # (func() << 7)
478478 Sequel.cast(:name, :integer).sql_number >> 8 # (CAST("name" AS integer) >> 8)
479+ (Sequel[:number] + 1) % 10 # (("number" + 1) % 10)
479480
480481Sequel allows you to do the cast and conversion at the same time via +cast_numeric+:
481482
@@ -496,11 +497,11 @@ Just like for the bitwise operators, Sequel allows you to do the cast and conver
496497
497498 Sequel[:number].cast_string + ' - Number' # (CAST(number AS varchar(255)) || ' - Number')
498499
499- Note that similar to the mathematical operators, you cannot switch the order the expression and have it work:
500+ Note that unlike the mathematical operators, you cannot switch the order the expression and have it work:
500501
501502 'Name - ' + Sequel[:name].sql_string # raises TypeError
502503
503- Just like for the mathematical operators, you can use <tt>Sequel.[]</tt> to wrap the object:
504+ You can use <tt>Sequel.[]</tt> to wrap the object:
504505
505506 Sequel['Name - '] + :name # ('Name - ' || "name")
506507
0 commit comments