Class IPADatabaseManager

java.lang.Object
ca.phon.ipadictionary.impl.IPADatabaseManager

public class IPADatabaseManager extends Object
Handles creation and connections to the IPA transcription database.
  • Method Details

    • getConnectionString

      public static String getConnectionString()
      Get the database jdbc connection string.
    • getInstance

      public static IPADatabaseManager getInstance()
      Get the database instance.
    • getConnection

      public Connection getConnection()
      Create a new connection to the database.
      Returns:
      a jdbc db connection, null if an error occured
    • shutdown

      public void shutdown()
      Shutdown the database.
    • prepareStatement

      public PreparedStatement prepareStatement(Connection conn, String sql) throws SQLException
      Get the prepared statement for the given sql string. If the statement does not exist then it's created.
      Parameters:
      sql -
      genKeys -
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(Connection conn, String sql, int genKeys) throws SQLException
      Get the prepared statement for the given sql string. If the statement does not exist then it's created.
      Parameters:
      sql -
      genKeys -
      Throws:
      SQLException
    • prepareStatement

      public PreparedStatement prepareStatement(Connection conn, String sql, int rsType, int concur) throws SQLException
      Get the prepared statement for the given sql string. If the statement does not exist then it's created.
      Parameters:
      sql -
      genKeys -
      Throws:
      SQLException
    • createDictionary

      public boolean createDictionary(String langId, String name)
      Create a new dictionary with given language and name
      Parameters:
      langId -
      name -
      Returns:
      true if dictionary was created, false otherwise
    • clearDictionary

      public boolean clearDictionary(String langId)
    • getAvailableLanguages

      public Set<Language> getAvailableLanguages()
      Return a list of available languages in the database.
      Returns:
      list of languages
    • saveDataToFile

      public void saveDataToFile(String textFile, String langId) throws IOException
      Throws:
      IOException
    • addDataFromFile

      public void addDataFromFile(String textFile, String langId, String langName) throws IOException
      Fill database with data from plain text file. File should be in format WS (where WS is whitespace.)
      Throws:
      IOException
    • dropDictionary

      public boolean dropDictionary(String lang)