1 | <?php |
||
11 | class QueryHelper |
||
12 | { |
||
13 | /** |
||
14 | * @param string $sqlMethod |
||
15 | * @param mixed[] $params |
||
16 | * @return Expression |
||
17 | */ |
||
18 | public static function sqlCall(string $sqlMethod, ...$params): Expression |
||
28 | |||
29 | /** |
||
30 | * Only for PostgreSQL |
||
31 | * |
||
32 | * @param array ...$params |
||
33 | * @return Expression |
||
34 | */ |
||
35 | 1 | public static function coalesce(...$params): Expression |
|
39 | |||
40 | /** |
||
41 | * @param array $cases |
||
42 | * @param string|null $value |
||
43 | * @param string|null $else |
||
44 | * @return string |
||
45 | */ |
||
46 | 3 | public static function caseWhen(array $cases, string $value = '', string $else = null): string |
|
62 | } |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: