⚙️
T-MiniGameAPI
WebsiteDiscord
2.0.0
2.0.0
  • 🏠Home
  • 💻Maven and Gradle
  • 📦Minigame setup
  • 🖱️Plugins are using this libarary
  • Basic features
    • 🗺️Configuration
      • 🎯Configurators
      • 🔴Override Configuartors
    • 🧑Models
      • 📦File model
        • 🟢Single file
        • 🟠Many files
      • 🧑‍🦱Users
    • 📔Loaders
      • 📗Loader
        • 📂File loader
  • Minigame features
    • 🅰️Arena system
      • 🟢Arena
      • 🔵ArenaManager
    • 🎮Game system
      • 🔴Game Manager
      • 🔵Game State
      • 🟡Users in game
      • 🟢Teams
    • ⏰Timers
      • 😀SimpleTimer
      • ✨XpTimer
    • 🪙Coins system
      • 🟢UserCoins
      • 🔵UserCoinsManager
    • ✨Statistics system
      • 🟢Default statistics system
      • 🔵Your own statistics system
    • 💥Cosmetics system
      • 📀Cosmetic
        • 💕ParticleCosmetic
      • ✳️Cosmetics Manager
      • 🧒Users' cosmetics
        • 💿UserCosmeticsManager
        • ✅UserCosmetics
  • Modules
    • 🔌What is module ?
    • 🗒️Modules list
    • Internal Modules
      • Commands Module
        • 🧔Parent commands
        • 🧒Sub commands
        • 📑Tab completer
        • ®️Command registration
      • SQL Module
        • 💡DbModel
        • SQLDatabaseDao
        • 💾Database loader
        • SQLDatabaseAdapter
        • SQLDatabaseMigrator
      • MongoDB Module
        • MongoDbConnector
        • 💡MongoDbModel
        • MongoDbDao
        • 💾MongoDb loader
    • 💾How to create module?
Powered by GitBook
On this page
  1. Modules
  2. Internal Modules
  3. SQL Module

SQLDatabaseAdapter

PreviousDatabase loaderNextSQLDatabaseMigrator

Last updated 8 months ago

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 -

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) {
    }
}
https://github.com/timsixth/T-DataBasesAPI