Skip to content

Commit

Permalink
0000872: Add an uninstall feature to SymmetricDS. Add option to the c…
Browse files Browse the repository at this point in the history
…ommand line.
  • Loading branch information
chenson42 committed Nov 4, 2012
1 parent 8448985 commit 1bdfd8d
Showing 1 changed file with 16 additions and 17 deletions.
Expand Up @@ -71,7 +71,7 @@ public void removeTrigger(StringBuilder sqlBuffer, String catalogName, String sc

@Override
protected void createRequiredFunctions() {
String encode = this.parameterService.getTablePrefix() + "_" + "BASE_64_ENCODE";
String encode = this.parameterService.getTablePrefix() + "_base_64_encode";
if (!installed(SQL_FUNCTION_INSTALLED, encode)) {
String sql = "CREATE FUNCTION $(functionName)(binaryData BINARY) " +
" RETURNS VARCHAR(1000000) " +
Expand All @@ -82,43 +82,42 @@ protected void createRequiredFunctions() {
install(sql, encode);
}

String setSession = this.parameterService.getTablePrefix() + "_" + "BASE_64_ENCODE";
String setSession = this.parameterService.getTablePrefix() + "_set_session";
if (!installed(SQL_FUNCTION_INSTALLED, setSession)) {
String sql = "CREATE FUNCTION $(functionName)(binaryData BINARY) " +
" RETURNS VARCHAR(1000000) " +
" NO SQL " +
" LANGUAGE JAVA PARAMETER STYLE JAVA " +
" EXTERNAL NAME " +
" 'CLASSPATH:org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions.encodeBase64' ";
String sql = "CREATE PROCEDURE $(functionName)(key VARCHAR(50), data VARCHAR(50)) " +
" NO SQL " +
" LANGUAGE JAVA PARAMETER STYLE JAVA " +
" EXTERNAL NAME " +
" 'CLASSPATH:org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions.setSession' ";
install(sql, setSession);
}

String getSession = this.parameterService.getTablePrefix() + "_" + "BASE_64_ENCODE";
String getSession = this.parameterService.getTablePrefix() + "_get_session";
if (!installed(SQL_FUNCTION_INSTALLED, getSession)) {
String sql = "CREATE FUNCTION $(functionName)(key VARCHAR(50)) " +
" RETURNS VARCHAR(50) " +
" NO SQL " +
" LANGUAGE JAVA PARAMETER STYLE JAVA " +
" EXTERNAL NAME " +
" 'CLASSPATH:org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions.getSession' ";
" RETURNS VARCHAR(50) " +
" NO SQL " +
" LANGUAGE JAVA PARAMETER STYLE JAVA " +
" EXTERNAL NAME " +
" 'CLASSPATH:org.jumpmind.symmetric.db.hsqldb.HsqlDbFunctions.getSession' ";
install(sql, getSession);
}

}

@Override
protected void dropRequiredFunctions() {
String encode = this.parameterService.getTablePrefix() + "_" + "base_64_encode";
String encode = this.parameterService.getTablePrefix() + "_base_64_encode";
if (installed(SQL_FUNCTION_INSTALLED, encode)) {
uninstall(SQL_DROP_FUNCTION, encode);
}

String setSession = this.parameterService.getTablePrefix() + "_" + "set_session";
String setSession = this.parameterService.getTablePrefix() + "_set_session";
if (installed(SQL_FUNCTION_INSTALLED, setSession)) {
uninstall(SQL_DROP_FUNCTION, setSession);
}

String getSession = this.parameterService.getTablePrefix() + "_" + "get_session";
String getSession = this.parameterService.getTablePrefix() + "_get_session";
if (installed(SQL_FUNCTION_INSTALLED, getSession)) {
uninstall(SQL_DROP_FUNCTION, getSession);
}
Expand Down

0 comments on commit 1bdfd8d

Please sign in to comment.