SQLDatabaseAdapter

The SQL Database Adapter provides simple methods for selecting, inserting, deleting, and updating data in your SQL database.

The default provider is the T-DataBaseAPI library but you can create your own implementation of this adapter.

T-DataBaseAPI - https://github.com/timsixth/T-DataBasesAPI

SQLDatabaseAdapter methods

void executeUpdateAsync(String sql); //Executes update async
ResultSet executeQueryAsync(String query); //Executes query async
void insert(String tableName, Object... data); //Inserts data to database
//Deletes all from table when the where condition is pass, this is not truncate action
void deleteAllWhere(String tableName, String whereCondition); 
//Updates some fields provided in map when the where condition is pass
void updateWhere(String tableName, Map<String, Object> data, String whereCondition);
ResultSet selectAll(String tableName); //Selects all data from table
//Selects all data from table when the where condition is pass
ResultSet selectWhere(String tableName, String whereCondition, String... columnNames);

How to create your own implemantion of this adapter?

public class MySQLDatabaseAdapter implements SQLDatabaseAdapter {
    @Override
    public void executeUpdateAsync(String query) {
      
    }

    @Override
    public ResultSet executeQueryAsync(String query) {
        return null;
    }

    @Override
    public void insert(String tableName, Object... data) {
   
    }

    @Override
    public void deleteAllWhere(String tableName, String whereCondition) {
   
    }

    @Override
    public void updateWhere(String tableName, Map<String, Object> data, String whereCondition) {
    
    }

    @Override
    public ResultSet selectAll(String tableName) {
    }

    @Override
    public ResultSet selectWhere(String tableName, String whereCondition, String... columnNames) {
    }
}

Last updated