Commit 81f6f2fe authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

1. Ignore last semicolon in upgrade statements when using Oracle. JM-737

2. Fixed problem that was preventing automatic upgrades to work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@4138 b35dd754-fafc-0310-a699-88a17e54d16e
parent c1b71f0a
...@@ -14,8 +14,8 @@ import org.jivesoftware.util.LocaleUtils; ...@@ -14,8 +14,8 @@ import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import org.jivesoftware.wildfire.XMPPServer; import org.jivesoftware.wildfire.XMPPServer;
import org.jivesoftware.wildfire.container.Plugin; import org.jivesoftware.wildfire.container.Plugin;
import org.jivesoftware.wildfire.container.PluginManager;
import org.jivesoftware.wildfire.container.PluginClassLoader; import org.jivesoftware.wildfire.container.PluginClassLoader;
import org.jivesoftware.wildfire.container.PluginManager;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
...@@ -234,7 +234,7 @@ public class SchemaManager { ...@@ -234,7 +234,7 @@ public class SchemaManager {
// Run all upgrade scripts until we're up to the latest schema. // Run all upgrade scripts until we're up to the latest schema.
for (int i=currentVersion+1; i <= DATABASE_VERSION; i++) { for (int i=currentVersion+1; i <= DATABASE_VERSION; i++) {
// Resource will be like "/database/upgrade/6/wildfire_hsqldb.sql" // Resource will be like "/database/upgrade/6/wildfire_hsqldb.sql"
String resourceName = "/database/upgrade/" + i + "/" + schemaKey + "_" + String resourceName = "upgrade/" + i + "/" + schemaKey + "_" +
DbConnectionManager.getDatabaseType() + ".sql"; DbConnectionManager.getDatabaseType() + ".sql";
InputStream resource = resourceLoader.loadResource(resourceName); InputStream resource = resourceLoader.loadResource(resourceName);
if (resource == null) { if (resource == null) {
...@@ -296,6 +296,11 @@ public class SchemaManager { ...@@ -296,6 +296,11 @@ public class SchemaManager {
} }
// Send command to database. // Send command to database.
if (!done && !command.toString().equals("")) { if (!done && !command.toString().equals("")) {
// Remove last semicolon when using Oracle to prevent "invalid character error"
if (DbConnectionManager.getDatabaseType() == DbConnectionManager.DatabaseType
.oracle) {
command.deleteCharAt(command.length() - 1);
}
Statement stmt = con.createStatement(); Statement stmt = con.createStatement();
stmt.execute(command.toString()); stmt.execute(command.toString());
stmt.close(); stmt.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment