Path: | doc/release_notes/3.13.0.txt |
Last Update: | Mon May 20 13:42:57 +0000 2013 |
DB.transaction(:prepare=>'some string') do ... end
Assuming that no exceptions are raised in the transaction block, Sequel will prepare the transaction. You can then commit the transaction later:
DB.commit_prepared_transaction('some string')
If you need to rollback the prepared transaction, you can do so as well:
DB.rollback_prepared_transaction('some string')
DB.transaction(:isolation=>:serializable) do ... end
You can also set the default isolation level for transactions via the transaction_isolation_level Database attribute:
DB.transaction_isolation_level = :committed
If you are connecting to Microsoft SQL Server, it is recommended that you set a default transaction isolation level if you plan on using this feature.
Album.filter(:release_date.desc(:nulls=>:first), :name.asc(:nulls=>:last)) # ORDER BY release_date DESC NULLS FIRST, # name ASC NULLS LAST
This syntax is supported by PostgreSQL 8.3+, Firebird 1.5+, Oracle, and probably some other databases as well, and makes it possible for the user to specify whether NULL values should sort before or after other values.
Node.find_or_create(:name=>'A'){|i| i.parent_id = 4}
DB[a].filter([:a, :b]=>[[1, 2], [3, 4]])
Previously, you had to call .sql_array on the array in order to tell Sequel that it was a value list and not a conditions specifier.
This fixes issues if you use table names that overlap with table names in the information_schema, such as domains. It‘s still recommended that you specify a default_schema if you are using a schema other than public.
'(a || ?)'.lit(:b).like('Test%') # ((a || b) LIKE 'Test%')
# 3.12.0 {1=>2}.case(0, nil) # CASE WHEN 1 THEN 2 ELSE 0 END # 3.13.0 {1=>2}.case(0, nil) # CASE NULL WHEN 1 THEN 2 ELSE 0 END
In general, you would never use nil explicitly, but the new behavior makes more sense if you have a variable that might be nil:
parent_id = Node[1].parent_id {1=>2}.case(0, parent_id)
If parent_id IS NULL/nil, then previously Sequel would have generated unexpected SQL. If you don‘t want a case expression value to be used, do not pass a second argument to case.
spec_coverage -> spec_cov integration -> spec_integration integration_cov -> spec_integration_cov