Conversation
matcracker
commented
Jun 19, 2020
- Documented nullable variable declaration.
- Documented timestamp var type
- Documented list var type
- Documented nullable variable declaration. - Documented timestamp var type - Documented list var type
| Declare if the variable can accepts `null` values. It is only allowed inside a query declaration. | ||
|
|
||
| #### Symbol | ||
| - `?` |
There was a problem hiding this comment.
Wrong place. This section is for the statement types, i.e. the symbol immediately following -- #. ? is a modifier to the argument type, not a statement type.
| - `float` | ||
| - `bool` | ||
| - `timestamp` | ||
| - `list` |
There was a problem hiding this comment.
list is not a type. list:{type} is a modifier on other types. You would probably want to change this to list:{type} instead of list.
| ```sql | ||
| -- #{ group.name | ||
| -- # :var_name1 list:int | ||
| -- # :var_name2 list?float |
There was a problem hiding this comment.
What does list? mean? Please explain it better.
| - `NOW` | ||
|
|
||
| ###### `list` | ||
| An array of values whose type must be specified in the same way as the variable declaration. |
There was a problem hiding this comment.
Where is this allowed? Just reading the documentation, I would expect this to be usable in INSERT INTO tbl (a, b) VALUES (:a, :b) where a and b are lists. But in fact this is only allowed in the IN context.
Furthermore, should it be used as WHERE col IN :list or WHERE col IN (:list)? Please clarify.
| ###### `timestamp` default | ||
| A numeric value that can be parsed by [`(int)` cast, equivalent to `intval`](https://php.net/intval) or [`(float)` cast, equivalent to `floatval`](https://php.net/floatval) | ||
|
|
||
| **Allowed default values:** |
| `true`, `on`, `yes` or `1` will result in true. Other values, as long as there is something, will result default false. (If there is nothing, the variable will not be optional) | ||
|
|
||
| ###### `timestamp` default | ||
| A numeric value that can be parsed by [`(int)` cast, equivalent to `intval`](https://php.net/intval) or [`(float)` cast, equivalent to `floatval`](https://php.net/floatval) |
There was a problem hiding this comment.
Consider restructuring this section entirely. This section is supposed to describe default values, not to describe the types. Since description of the type is required, consider restructuring the section such that each type has its documentation and VAR_DEFAULT doesn't have its own place.
