mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
DBCreator: Fix ScriptRunner to strip comments, reformat code
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
This commit is contained in:
parent
6d155416c2
commit
ef07cde449
@ -31,17 +31,15 @@ import com.cloud.utils.component.SystemIntegrityChecker;
|
|||||||
import com.cloud.utils.db.ScriptRunner;
|
import com.cloud.utils.db.ScriptRunner;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
|
|
||||||
/**
|
// Creates the CloudStack Database by using the 4.0 schema and apply
|
||||||
* Creates the CloudStack Database by using the 4.0 schema and apply
|
// upgrade steps to it.
|
||||||
* upgrade steps to it.
|
|
||||||
*/
|
|
||||||
public class DatabaseCreator {
|
public class DatabaseCreator {
|
||||||
protected static void printHelp(String cmd) {
|
protected static void printHelp(String cmd) {
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"DatabaseCreator creates the database schema by removing the \n" +
|
"DatabaseCreator creates the database schema by removing the \n" +
|
||||||
"previous schema, creating the schema, and running \n" +
|
"previous schema, creating the schema, and running \n" +
|
||||||
"through the database updaters.");
|
"through the database updaters.");
|
||||||
System.out.println("Usage: " + cmd + " [initial schema file] [database upgrade class]");
|
System.out.println("Usage: " + cmd + " [schema files] [database upgrade class]");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -73,7 +71,7 @@ public class DatabaseCreator {
|
|||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
System.err.println("Unable to read " + args[i] + ": " + e.getMessage());
|
System.err.println("Unable to read " + args[i] + ": " + e.getMessage());
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
runner.runScript(reader);
|
runner.runScript(reader);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -111,4 +109,4 @@ public class DatabaseCreator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class ScriptRunner {
|
|||||||
|
|
||||||
private String delimiter = DEFAULT_DELIMITER;
|
private String delimiter = DEFAULT_DELIMITER;
|
||||||
private boolean fullLineDelimiter = false;
|
private boolean fullLineDelimiter = false;
|
||||||
|
|
||||||
private StringBuffer _logBuffer = new StringBuffer();
|
private StringBuffer _logBuffer = new StringBuffer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -170,7 +170,11 @@ public class ScriptRunner {
|
|||||||
}
|
}
|
||||||
Thread.yield();
|
Thread.yield();
|
||||||
} else {
|
} else {
|
||||||
command.append(line);
|
int idx = line.indexOf("--");
|
||||||
|
if (idx != -1)
|
||||||
|
command.append(line.substring(0, idx));
|
||||||
|
else
|
||||||
|
command.append(line);
|
||||||
command.append(" ");
|
command.append(" ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user