mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-11-28 22:24:49 +03:00
relational-query: bugfix. fix record width of fromMaybe result.
This commit is contained in:
parent
9619238692
commit
1400572384
@ -300,7 +300,7 @@ negate' = unsafeFlatUniOp $ SQL.word "-"
|
||||
|
||||
unsafeCastProjectable :: SqlContext c
|
||||
=> Record c a -> Record c b
|
||||
unsafeCastProjectable = unsafeProjectSql' . unsafeShowSql'
|
||||
unsafeCastProjectable = Syntax.record . Syntax.untypeRecord
|
||||
|
||||
-- | Number fromIntegral uni-operator.
|
||||
fromIntegral' :: (SqlContext c, Integral a, Num b)
|
||||
|
@ -414,6 +414,15 @@ maybeX = relation $ do
|
||||
|
||||
return $ fromMaybe (value 1) (a ?! intA0') >< b
|
||||
|
||||
maybeY :: Relation () (SetA, SetB)
|
||||
maybeY = relation $ do
|
||||
a <- queryMaybe setA
|
||||
b <- query setB
|
||||
|
||||
wheres $ a ?! strA2' .=. b ! mayStrB1'
|
||||
|
||||
return $ fromMaybe (SetA |$| value 1 |*| value "foo" |*| value "var") a >< b
|
||||
|
||||
notX :: Relation () (Maybe Bool)
|
||||
notX = relation $
|
||||
return $ not' valueFalse
|
||||
@ -438,6 +447,12 @@ uni =
|
||||
"SELECT ALL CASE WHEN (T0.int_a0 IS NULL) THEN 1 ELSE T0.int_a0 END AS f0, \
|
||||
\ T1.int_b0 AS f1, T1.may_str_b1 AS f2, T1.str_b2 AS f3 \
|
||||
\ FROM TEST.set_a T0 RIGHT JOIN TEST.set_b T1 ON (0=0) WHERE (T0.str_a2 = T1.may_str_b1)"
|
||||
, eqProp "fromMaybe record" maybeY
|
||||
"SELECT ALL CASE WHEN (T0.int_a0 IS NULL) THEN 1 ELSE T0.int_a0 END AS f0, \
|
||||
\ CASE WHEN (T0.int_a0 IS NULL) THEN 'foo' ELSE T0.str_a1 END AS f1, \
|
||||
\ CASE WHEN (T0.int_a0 IS NULL) THEN 'var' ELSE T0.str_a2 END AS f2, \
|
||||
\ T1.int_b0 AS f3, T1.may_str_b1 AS f4, T1.str_b2 AS f5 \
|
||||
\ FROM TEST.set_a T0 RIGHT JOIN TEST.set_b T1 ON (0=0) WHERE (T0.str_a2 = T1.may_str_b1)"
|
||||
, eqProp "not" notX
|
||||
"SELECT ALL (NOT (0=1)) AS f0"
|
||||
, eqProp "exists" existsX
|
||||
|
Loading…
Reference in New Issue
Block a user