Class SQLHelper


  • public final class SQLHelper
    extends Object
    Represents the heart of the library "SQLHelper".
    • Constructor Detail

      • SQLHelper

        public SQLHelper​(ConnectionConfig connectionConfig,
                         Executor async)
        Creates a new instance of this class.
        Parameters:
        connectionConfig - connection config
        async - executor for asynchronous queries. If you want them synchronous, you can specify null.
      • SQLHelper

        public SQLHelper​(Executor async)
      • SQLHelper

        public SQLHelper()
    • Method Detail

      • connect

        public void connect()
        Connects to the remote database.
      • close

        public void close()
        Closes the connection to the remote database.
      • registerConnectionFactory

        public void registerConnectionFactory​(ConnectionType connectionType,
                                              SQLConnectionFactory connectionFactory)
        Registers a new connection factory
        Parameters:
        connectionType - the connection type you want to register a factory for
        connectionFactory - the connection factory you want to register
        Throws:
        IllegalArgumentException - if the connection type has already a registered factory
      • isRegistered

        public boolean isRegistered​(ConnectionType connectionType)
        Returns whenever the specified ConnectionType is already registered.
        Parameters:
        connectionType - the connection type you want to check if its registered or not
        Returns:
        true if registered, false otherwise
      • setConnectionConfig

        public void setConnectionConfig​(ConnectionConfig connectionConfig)
        Sets a new ConnectionConfig.
        Parameters:
        connectionConfig - value
      • setAsyncExecutor

        public void setAsyncExecutor​(Executor async)
        Sets a new Executor for async queries.
        Parameters:
        async - executor
      • select

        public SelectStatement select()
        Creates a new "SELECT" query object.
        Returns:
        select statement
      • insert

        public InsertStatement insert()
        Creates a new "INSERT" query object.
        Returns:
        insert statement
      • create

        public CreateStatement create()
        Creates a new "CREATE TABLE IF NOT EXISTS" query object.
        Returns:
        create statement
      • update

        public UpdateStatement update()
        Creates a new "UPDATE" query object.
        Returns:
        update statement
      • delete

        public DeleteStatement delete()
        Creates a new "DELETE" query object.
        Returns:
        delete statement
      • alterTable

        public AlterStatement alterTable()
        Creates a new "ALTER" query object.
        Returns:
        alter statement
      • dropTable

        public DropStatement dropTable()
        Creates a new "DROP" query object.
        Returns:
        drop statement
      • truncate

        public TruncateStatement truncate()
        Creates a new "TRUNCATE" query object.
        Returns:
        truncate statement