Sueta
DA

DatabaseAPI

1.0

A simple DatabaseAPI for different types of databases.

·Plugin

DatabaseAPI
The API compatible to Spigot, Bungeecord and Standalone...

Usage

Database sqlite= DatabaseFactory.createSQLiteDatabase(FILE);
Database mysql= DatabaseFactory.createMySQLDatabase(HOST, PORT, USER, PASSWORD, DATABASE);
Database h2= DatabaseFactory.createH2Database(NAME, FILE, USER, PASSWORD);
Database postgreesql= DatabaseFactory.createPostgreeSQLDatabase(HOST, PORT, USER, PASSWORD, DATABASE);

//Execute a SQL update
db.executeUpdate(QRY, OBJECTS);
//If you get the Future directly after calling, it's blocking the main thread too:)
db.executeUpdateAsync(QRY, OBJECTS);

//Exdcute a SQL query
db.executeQueryAsync(QRY, new Function<ResultSet, Object>() {
    @Override
    public Object apply(ResultSet resultSet) {
        return null;
    }
}, OBJECTS);
//If you get the Future directly after calling, it's blocking the main thread too:)
db.executeQueryAsync(QRY, new Function<ResultSet, Object>() {
    @Override
    public Object apply(ResultSet resultSet) {
        return null;
    }
}, OBJECTS);

Similar projects

Plugin →