case when equivalent
This commit is contained in:
@@ -8,8 +8,12 @@ using from '../db/schema';
|
|||||||
view Books.constraints as select from Books { ID,
|
view Books.constraints as select from Books { ID,
|
||||||
|
|
||||||
// two-step mandatory check
|
// two-step mandatory check
|
||||||
title = null ? 'is missing' : trim(title)='' ? 'must not be empty' :
|
case
|
||||||
null as title,
|
when title is null then 'is missing'
|
||||||
|
when trim(title)='' then 'must not be empty'
|
||||||
|
end as title,
|
||||||
|
// the above is equivalent to:
|
||||||
|
// title is null ? 'is missing' : trim(title)='' ? 'must not be empty' :
|
||||||
|
|
||||||
// range check
|
// range check
|
||||||
stock < 0 ? 'must not be negative' :
|
stock < 0 ? 'must not be negative' :
|
||||||
|
|||||||
Reference in New Issue
Block a user