Skript addon for SQL support in Skript (SQLite, MySQL, MariaDB and more supported with some configuration)
Go to file
Govindas aa65a4e7e8 set api version to 1.13
I think this will help with performance in 1.13+ version, but will keep working in 1.9+
2021-05-07 15:42:01 +03:00
src/main set api version to 1.13 2021-05-07 15:42:01 +03:00
.gitignore Fix pom.xml & update HikariCP 2021-04-30 11:50:23 +03:00
LICENSE Initial commit 2017-11-18 19:49:49 -08:00
pom.xml Fixed Govindas weirdness on project files 2021-05-04 18:00:16 +04:00
README.md Update README.md 2021-02-12 12:44:58 +02:00

skript-db

Sensible SQL support for Skript.


Difference from original skript-db

  • Fixed local variables disappearance in newer Skript versions (very hacky fix, but it works, so that's good!)
  • Thread-pool size is now automatically increasing on demand to use of CachedThreadPool, instead of a fixed hard-coded number
  • Uses a newer version of HikariCP
  • Only meant to be used by newer Minecraft versions (1.8 is not supported)

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.

If a single variable, such as {test}, is passed, the variable will be set to the number of affected rows.

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>}

If synchronously is specified, the SQL query will be done on the current thread.

Syntax

[synchronously] execute %string% (in|on) %datasource% [and store [[the] (output|result)[s]] (to|in) [the] [var[iable]] %-objects%]

Examples

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::*}

Expression Last Data Source Error => text

Stores the error from the last executed statement, if there was one.

Syntax

[the] [last] (sql|db|data(base|[ ]source)) error

Expression Unsafe Expression => text

Opts out of automatic SQL injection protection for a specific expression in a statement.

Syntax

unsafe %text%

Examples

execute "select %unsafe {columns variable}% from %{table variable}%" in {sql}
execute unsafe {fully dynamic query} in {sql}