Class ExecuteSQL

java.lang.Object
ru.bgcrm.util.distr.call.ExecuteSQL
All Implemented Interfaces:
InstallationCall

public class ExecuteSQL extends Object implements InstallationCall
Executer of SQL queries for updating DB structure. Running as InstallationCall and also directly.
  • Constructor Details

    • ExecuteSQL

      public ExecuteSQL()
  • Method Details

    • call

      public boolean call(Preferences setup, File zip, String param)
      Specified by:
      call in interface InstallationCall
    • call

      public void call(Connection con, String query) throws SQLException
      Executes multiline SQL script.
      Parameters:
      con - connection.
      query - SQL script, tokenized to commands by ;.
      Throws:
      SQLException
    • doQuery

      protected void doQuery(Statement st, String query, Set<String> existingHashes, Set<String> newHashes) throws SQLException
      Executes SQL query.
      Parameters:
      st - SQL statement, running the query.
      query - the query.
      existingHashes - hashes of already applied queries.
      newHashes - set there added hash of executed query if it wasn't presented in hashes.
      Throws:
      SQLException
    • getQueryHashes

      protected Set<String> getQueryHashes(Connection con) throws SQLException
      Loads applied query hashes.
      Parameters:
      con - SQL connection.
      Returns:
      set with hashes.
      Throws:
      SQLException
    • clearHashes

      public static void clearHashes()