Update README
This commit is contained in:
parent
d88e431f07
commit
55081e5d28
55
README.md
55
README.md
@ -1,37 +1,18 @@
|
||||
# skript-db
|
||||
|
||||
> Sensible SQL support for Skript.
|
||||
---
|
||||
|
||||
### Expression `Data Source` => `datasource`
|
||||
Stores the connection information for a data source. This should be saved to a variable in a
|
||||
`script load` event or manually through an effect command.
|
||||
|
||||
The url format for your database may vary! The example provided uses a MySQL database.
|
||||
#### Syntax
|
||||
```
|
||||
[the] data(base|[ ]source) [(of|at)] %string%
|
||||
```
|
||||
|
||||
#### Examples
|
||||
```
|
||||
set {sql} to the database "mysql://localhost:3306/mydatabase?user=admin&password=12345&useSSL=false"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Effect `Execute Statement`
|
||||
Executes a statement on a database and optionally stores the result in a variable. Expressions
|
||||
embedded in the query will be escaped to avoid SQL injection.
|
||||
|
||||
<p>
|
||||
If a single variable, such as `{test}`, is passed, the variable will be set to the number of
|
||||
affected rows.
|
||||
|
||||
<p>
|
||||
If a list variable, such as `{test::*}`, is passed, the query result will be mapped to the list
|
||||
variable in the form `{test::<column name>::<row number>}`
|
||||
|
||||
Specifying `synchronously` will make skript-db execute the query on the event thread, which is useful for async
|
||||
events. Note that skript-db will ignore this flag if you attempt to run this on the main thread.
|
||||
#### Syntax
|
||||
```
|
||||
execute %string% (in|on) %datasource% [and store [[the] (output|result)[s]] (to|in) [the] [var[iable]] %-objects%]
|
||||
[synchronously] execute %string% (in|on) %datasource% [and store [[the] (output|result)[s]] (to|in) [the] [var[iable]] %-objects%]
|
||||
```
|
||||
|
||||
#### Examples
|
||||
@ -39,7 +20,7 @@ execute %string% (in|on) %datasource% [and store [[the] (output|result)[s]] (to|
|
||||
execute "select * from table" in {sql} and store the result in {output::*}
|
||||
```
|
||||
```
|
||||
execute "select * from %{table variable}%" in {sql} and store the result in {output::*}
|
||||
execute "select * where player=%{player}%" in {sql} and store the result in {output::*}
|
||||
```
|
||||
|
||||
---
|
||||
@ -70,3 +51,25 @@ execute unsafe {fully dynamic query} in {sql}
|
||||
|
||||
---
|
||||
|
||||
# skript-db
|
||||
|
||||
> Sensible SQL support for Skript.
|
||||
---
|
||||
|
||||
### Expression `Data Source` => `datasource`
|
||||
Stores the connection information for a data source. This should be saved to a variable in a
|
||||
`script load` event or manually through an effect command.
|
||||
|
||||
The url format for your database may vary! The example provided uses a MySQL database.
|
||||
#### Syntax
|
||||
```
|
||||
[the] data(base|[ ]source) [(of|at)] %string% [with [a] [max[imum]] [connection] life[ ]time of %timespan%]"
|
||||
```
|
||||
|
||||
#### Examples
|
||||
```
|
||||
set {sql} to the database "mysql://localhost:3306/mydatabase?user=admin&password=12345&useSSL=false"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user