62 lines
1.1 KiB
Markdown
62 lines
1.1 KiB
Markdown
# CreeperSQL Lite
|
|
|
|
Standalone Java MySQL library for Minecraft plugins. No Bukkit/Spigot. Super light.
|
|
|
|
---
|
|
|
|
## Features
|
|
|
|
- Pure Java
|
|
- Automatic config: `plugins/MySQLConnection/config.yml`
|
|
- Standard SQL: SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, DROP TABLE
|
|
- Must set config or read before connecting
|
|
- Simple API
|
|
|
|
---
|
|
|
|
## Usage
|
|
|
|
1. **Set config**
|
|
`CreeperSQL mysql = new CreeperSQL();`
|
|
`mysql.setConfig("host","user","pass","db");`
|
|
|
|
or
|
|
|
|
`mysql.readMinecraftConfig();`
|
|
|
|
2. **Connect**
|
|
`mysql.connect();`
|
|
|
|
3. **SQL actions**
|
|
- `getTables()` → list of tables
|
|
- `sqlAction(sql)` → returns QueryResult
|
|
- `createTable(sql)`
|
|
- `dropTable(name)`
|
|
- `insert(sql)`
|
|
- `update(sql)`
|
|
- `delete(sql)`
|
|
- `close()`
|
|
|
|
4. **QueryResult**
|
|
- `rows` → list of rows
|
|
- `affectedRows` → number of rows affected
|
|
- `error` → error message
|
|
- `hasError()` → true if error
|
|
- `hasRows()` → true if rows returned
|
|
|
|
---
|
|
|
|
## Build
|
|
|
|
1. Create Java project (SDK 17+)
|
|
2. Add `CreeperSQL.java`
|
|
3. Add MySQL Connector/J
|
|
4. Build JAR → import into plugin
|
|
|
|
---
|
|
|
|
## Notes
|
|
|
|
- Config must be set/read before connecting
|
|
- Async queries recommended for heavy SQL
|