mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +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.Transaction;
|
||||
|
||||
/**
|
||||
* Creates the CloudStack Database by using the 4.0 schema and apply
|
||||
* upgrade steps to it.
|
||||
*/
|
||||
// Creates the CloudStack Database by using the 4.0 schema and apply
|
||||
// upgrade steps to it.
|
||||
public class DatabaseCreator {
|
||||
protected static void printHelp(String cmd) {
|
||||
System.out.println(
|
||||
"DatabaseCreator creates the database schema by removing the \n" +
|
||||
"previous schema, creating the schema, and running \n" +
|
||||
"DatabaseCreator creates the database schema by removing the \n" +
|
||||
"previous schema, creating the schema, and running \n" +
|
||||
"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) {
|
||||
@ -73,7 +71,7 @@ public class DatabaseCreator {
|
||||
} catch (FileNotFoundException e) {
|
||||
System.err.println("Unable to read " + args[i] + ": " + e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
try {
|
||||
runner.runScript(reader);
|
||||
} catch (IOException e) {
|
||||
@ -111,4 +109,4 @@ public class DatabaseCreator {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public class ScriptRunner {
|
||||
|
||||
private String delimiter = DEFAULT_DELIMITER;
|
||||
private boolean fullLineDelimiter = false;
|
||||
|
||||
|
||||
private StringBuffer _logBuffer = new StringBuffer();
|
||||
|
||||
/**
|
||||
@ -170,7 +170,11 @@ public class ScriptRunner {
|
||||
}
|
||||
Thread.yield();
|
||||
} else {
|
||||
command.append(line);
|
||||
int idx = line.indexOf("--");
|
||||
if (idx != -1)
|
||||
command.append(line.substring(0, idx));
|
||||
else
|
||||
command.append(line);
|
||||
command.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user