Class NeqSimDataBase

java.lang.Object
neqsim.util.database.NeqSimDataBase
All Implemented Interfaces:
Serializable, AutoCloseable, FileSystemSettings
Direct Known Subclasses:
NeqSimContractDataBase, NeqSimProcessDesignDataBase

public class NeqSimDataBase extends Object implements FileSystemSettings, Serializable, AutoCloseable

NeqSimDataBase class.

Version:
Dec 2018
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • dataBasePath

      public static String dataBasePath
      Constant dataBasePath="".
    • createTemporaryTables

      private static boolean createTemporaryTables
    • username

      private static String username
    • password

      private static String password
    • dataBaseType

      private static String dataBaseType
    • connectionString

      private static String connectionString
    • h2IsInitialized

      private static boolean h2IsInitialized
      True if h2 database has been initialized, i.e., populated with tables
    • h2IsInitalizing

      private static boolean h2IsInitalizing
      True while h2 database is being initialized.
    • statement

      private Statement statement
    • databaseConnection

      protected Connection databaseConnection
  • Constructor Details

    • NeqSimDataBase

      public NeqSimDataBase()

      Constructor for NeqSimDataBase.

  • Method Details

    • openConnection

      public Connection openConnection() throws SQLException, ClassNotFoundException

      openConnection.

      Returns:
      a Connection object
      Throws:
      SQLException - if any.
      ClassNotFoundException - if any.
    • getConnection

      public Connection getConnection()

      getConnection.

      Returns:
      a Connection object
    • getStatement

      public Statement getStatement()

      Getter for the field statement.

      Returns:
      a Statement object
    • setStatement

      public void setStatement(Statement statement)

      Setter for the field statement.

      Parameters:
      statement - a Statement object
    • execute

      public boolean execute(String sqlString)

      Execute query using execute.

      Parameters:
      sqlString - Query to execute.
      Returns:
      True if the first result is a ResultSet object; false if it is an update count or there are no results
    • executeQuery

      public void executeQuery(String sqlString)

      Execute query using executeQuery but do not return anything.

      Parameters:
      sqlString - Query to execute.
    • getResultSet

      public ResultSet getResultSet(String sqlString)

      Execute query using executeQuery and return ResultSet.

      Parameters:
      sqlString - Query to execute.
      Returns:
      a ResultSet object
    • close

      public void close() throws SQLException
      Specified by:
      close in interface AutoCloseable
      Throws:
      SQLException
    • createTemporaryTables

      public static boolean createTemporaryTables()

      createTemporaryTables.

      Returns:
      the createTemporaryTables
    • setCreateTemporaryTables

      public static void setCreateTemporaryTables(boolean createTemporaryTables)

      Setter for the field createTemporaryTables.

      Parameters:
      createTemporaryTables - the createTemporaryTables to set
    • getDataBaseType

      public static String getDataBaseType()

      Getter for the field dataBaseType.

      Returns:
      a String object
    • setDataBaseType

      public static void setDataBaseType(String aDataBaseType)

      Setter for the field dataBaseType.

      Parameters:
      aDataBaseType - a String object
    • setDataBaseType

      public static void setDataBaseType(String aDataBaseType, String connectionString)

      Setter for the field dataBaseType.

      Parameters:
      aDataBaseType - a String object
      connectionString - a String object
    • setUsername

      public static void setUsername(String aUsername)

      Setter for the field username.

      Parameters:
      aUsername - the username to set
    • setPassword

      public static void setPassword(String aPassword)

      Setter for the field password.

      Parameters:
      aPassword - the password to set
    • getConnectionString

      public static String getConnectionString()

      Getter for the field connectionString.

      Returns:
      the connectionString
    • setConnectionString

      public static void setConnectionString(String aConnectionString)

      Setter for the field connectionString.

      Parameters:
      aConnectionString - the connectionString to set
    • getComponentNames

      public static String[] getComponentNames()

      getComponentNames.

      Returns:
      an array of String objects
    • hasComponent

      public static boolean hasComponent(String name)
      Verify if database has a component.
      Parameters:
      name - Name of component to look for.
      Returns:
      True if component is found.
    • hasTempComponent

      public static boolean hasTempComponent(String name)
      Verify if database has a component.
      Parameters:
      name - Name of component to look for.
      Returns:
      True if component is found.
    • updateTable

      public static void updateTable(String tableName)
      Drops and re-creates table from contents in default csv file.
      Parameters:
      tableName - Name of table to replace
    • useExtendedComponentDatabase

      public static void useExtendedComponentDatabase(boolean useExtendedDatabase)
      Use extended component database.
      Parameters:
      useExtendedDatabase - the use extended database
    • updateTable

      public static void updateTable(String tableName, String path)
      Drops and re-creates table from contents in csv file.
      Parameters:
      tableName - Name of table to replace
      path - Path to csv file to get table data from
    • replaceTable

      public static void replaceTable(String tableName, String path)
      Drops and re-creates table from contents in csv file.
      Parameters:
      tableName - Name of table to replace
      path - Path to csv file to
    • initH2DatabaseFromCSVfiles

      public static void initH2DatabaseFromCSVfiles()

      initH2DatabaseFromCSVfiles.