-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added missing docs. #37
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# libasynql v3.0.0 <img src="https://poggit.pmmp.io/ci.badge/poggit/libasynql/libasynql" align="right"/> | ||
# libasynql v3.3.0 <img src="https://poggit.pmmp.io/ci.badge/poggit/libasynql/libasynql" align="right"/> | ||
Asynchronous SQL access library for PocketMine plugins. | ||
|
||
## Usage | ||
|
@@ -168,6 +168,12 @@ A variable declaration declares the required and optional variables for this que | |
#### Symbol | ||
- `:` | ||
|
||
### Nullable variable declaration | ||
Declare if the variable can accepts `null` values. It is only allowed inside a query declaration. | ||
|
||
#### Symbol | ||
- `?` | ||
|
||
#### Arguments | ||
##### VAR_NAME | ||
The name of the variable. Any characters apart from spaces, tabs and colons are allowed. However, to comply with ordinary SQL editors, using "normal" symbols (e.g. variable names in other programming languages) is recommended. | ||
|
@@ -178,6 +184,8 @@ The variable type. Possible values: | |
- `int` | ||
- `float` | ||
- `bool` | ||
- `timestamp` | ||
- `list` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
##### VAR_DEFAULT | ||
If the variable is optional, it declares a default value. | ||
|
@@ -198,6 +206,26 @@ A numeric value that can be parsed by [`(float)` cast, equivalent to `floatval`] | |
###### `bool` default | ||
`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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
|
||
**Allowed default values:** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
- `0` | ||
- `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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this allowed? Just reading the documentation, I would expect this to be usable in |
||
|
||
**Default value is not allowed** | ||
|
||
Example: | ||
```sql | ||
-- #{ group.name | ||
-- # :var_name1 list:int | ||
-- # :var_name2 list?float | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does |
||
-- #} | ||
``` | ||
|
||
### Query text | ||
Query text is not a command, but the non-commented part between the start and end commands of a query declaration. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.