Path: | doc/release_notes/4.35.0.txt |
Last Update: | Sun Oct 02 21:06:53 +0000 2016 |
For example, code like this will change behavior in ruby 2.4:
DB.create_table(:table) do add_column :column, Bignum end # or: DB.get(Sequel.cast('1', Bignum))
as this references the Bignum class. On ruby <2.4, this will create a 64-bit integer column, on ruby 2.4+, it will create a 32-bit integer column.
Code like this will be fine and does not need changing:
DB.create_table(:table) do Bignum :column end
as this calls the Bignum method.
Sequel now supports the :Bignum symbol as a generic type, so you can now switch references to the Bignum class to the :Bignum symbol whenever you want a generic 64-bit integer type:
DB.create_table(:table) do add_column :column, :Bignum end # or: DB.get(Sequel.cast('1', :Bignum))
Note that you should only do this if you are using Sequel 4.35.0+, as previous versions of Sequel will treat the :Bignum symbol as a database-specific type named Bignum.
DB.log_connection_info = true DB.get(1) # Logged: (0.000004s) (conn: 9713390226040) SELECT 1 AS v LIMIT
Example.first.lock!('FOR NO KEY UPDATE') #=> SELECT * FROM examples WHERE id = 1 FOR NO KEY UPDATE LIMIT 1
ds = DB[:table].comment("Some Comment").all # SELECT * FROM table -- Some Comment #
All consecutive whitespace in the comment is replaced by a single space, and the comment ends in a newline so that it works correctly in subqueries.
This extension is mostly useful if you are doing analysis of your database server query log and want to include higher level information about the query in the comment.
DB.extension :server_logging DB.log_connection_info = true DB.get(1) # Logged: (0.000004s) (conn: 9712828677240, server: read_only) # SELECT 1 AS v LIMIT 1 DB[:a].insert(:b=>1) # Logged: (0.000003s) (conn: 9712534040260, server: default) # INSERT INTO a (b) VALUES (1)