java.lang.Object
com.djrapitops.plan.storage.database.transactions.Transaction
Direct Known Subclasses:
BanStatusTransaction, BatchBanStatusTransaction, ChangeUserUUIDTransaction, CookieChangeTransaction, CreateIndexTransaction, DeleteWebGroupTransaction, GrantWebPermissionToGroupsWithPermissionTransaction, OperationCriticalTransaction, PingStoreTransaction, PlayerRegisterTransaction, RemoveWebGroupsTransaction, RemoveWebUserTransaction, ShutdownDataPreservationTransaction, StoreAllowlistBounceTransaction, StoreConfigTransaction, StoreGeoInfoTransaction, StoreJoinAddressTransaction, StoreMissingWebPermissionsTransaction, StorePluginVersionsTransaction, StoreServerInformationTransaction, StoreSessionTransaction, StoreWebGroupTransaction, StoreWebUserPreferencesTransaction, StoreWebUserTransaction, StoreWorldNameTransaction, ThrowawayTransaction, TPSStoreTransaction

public abstract class Transaction extends Object
Represents a database transaction.
  • Field Details Link icon

    • dbType Link icon

      protected DBType dbType
    • success Link icon

      protected boolean success
    • attempts Link icon

      protected int attempts
  • Constructor Details Link icon

    • Transaction Link icon

      protected Transaction()
  • Method Details Link icon

    • executeTransaction Link icon

      public void executeTransaction(SQLDB db)
    • commitMidTransaction Link icon

      protected void commitMidTransaction()
    • shouldBeExecuted Link icon

      protected boolean shouldBeExecuted()
      Override this method for conditional execution.

      Please note that the transaction has not been initialized and class variables are not available for queries. The condition should depend on other variables (Like the data that is to be stored) given to the transaction.

      Returns:
      false if the transaction should not execute.
    • performOperations Link icon

      protected abstract void performOperations()
      Implement this method for transaction execution.
    • query Link icon

      protected <T> T query(Query<T> query)
    • execute Link icon

      protected boolean execute(Executable executable)
    • executeReturningId Link icon

      protected int executeReturningId(ExecStatement executable)
    • execute Link icon

      protected boolean execute(String sql)
    • executeSwallowingExceptions Link icon

      protected void executeSwallowingExceptions(String... statements)
    • executeOther Link icon

      protected void executeOther(Transaction transaction)
    • getDBState Link icon

      protected Database.State getDBState()
    • getServerUUID Link icon

      protected ServerUUID getServerUUID()
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • wasSuccessful Link icon

      public boolean wasSuccessful()
    • dbIsNotUnderHeavyLoad Link icon

      public boolean dbIsNotUnderHeavyLoad()
    • getName Link icon

      public String getName()
    • hasTable Link icon

      protected boolean hasTable(String tableName)