Package ca.phon.ipadictionary.impl
Class IPADatabaseManager
java.lang.Object
ca.phon.ipadictionary.impl.IPADatabaseManager
Handles creation and connections to the IPA transcription
database.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataFromFile
(String textFile, String langId, String langName) Fill database with data from plain text file.boolean
clearDictionary
(String langId) boolean
createDictionary
(String langId, String name) Create a new dictionary with given language and nameboolean
dropDictionary
(String lang) Return a list of available languages in the database.Create a new connection to the database.static String
Get the database jdbc connection string.static IPADatabaseManager
Get the database instance.prepareStatement
(Connection conn, String sql) Get the prepared statement for the given sql string.prepareStatement
(Connection conn, String sql, int genKeys) Get the prepared statement for the given sql string.prepareStatement
(Connection conn, String sql, int rsType, int concur) Get the prepared statement for the given sql string.void
saveDataToFile
(String textFile, String langId) void
shutdown()
Shutdown the database.
-
Method Details
-
getConnectionString
Get the database jdbc connection string. -
getInstance
Get the database instance. -
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
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
Create a new dictionary with given language and name- Parameters:
langId
-name
-- Returns:
true
if dictionary was created,false
otherwise
-
clearDictionary
-
getAvailableLanguages
Return a list of available languages in the database.- Returns:
- list of languages
-
saveDataToFile
- Throws:
IOException
-
addDataFromFile
Fill database with data from plain text file. File should be in formatWS (where WS is whitespace.) - Throws:
IOException
-
dropDictionary
-