Skip to content

Commit

Permalink
adds command LOAD SCRIPT to console
Browse files Browse the repository at this point in the history
use LOAD SCRIPT in assembly packaging module

refs #7273
  • Loading branch information
robfrank committed Mar 27, 2017
1 parent 8164dc4 commit f20227c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
3 changes: 2 additions & 1 deletion distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@
<argument>-classpath</argument>
<classpath/>
<argument>com.orientechnologies.orient.console.OConsoleDatabaseApp</argument>
<argument>./src/test/resources/demoDB.osql</argument>
<argument>CREATE DATABASE plocal:./target/databases/demodb;</argument>
<argument>LOAD SCRIPT ./src/test/resources/demoDB.osql;</argument>
</arguments>
</configuration>
</execution>
Expand Down
1 change: 0 additions & 1 deletion distribution/src/test/resources/demoDB.osql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
SET echo FALSE
SET verbose 0

CREATE DATABASE plocal:./target/databases/demodb

CREATE CLASS DBInfo;
INSERT INTO DBInfo SET Name='SocialTravelAgency', Version='0.75';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@
import com.orientechnologies.orient.core.storage.impl.local.paginated.OPaginatedClusterDebug;
import com.orientechnologies.orient.server.config.OServerConfigurationManager;
import com.orientechnologies.orient.server.config.OServerUserConfiguration;
import sun.misc.Signal;
import sun.misc.SignalHandler;

import java.io.*;
import java.lang.reflect.Array;
Expand Down Expand Up @@ -123,22 +121,12 @@ public static void main(final String[] args) {
if (setTerminalToCBreak())
tty = true;

Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
restoreTerminal();
}
});
Runtime.getRuntime().addShutdownHook(new Thread(() -> restoreTerminal()));

} catch (Exception ignored) {
}

new OSignalHandler().installDefaultSignals(new SignalHandler() {

public void handle(Signal signal) {
restoreTerminal();
}
});
new OSignalHandler().installDefaultSignals(signal -> restoreTerminal());

final OConsoleDatabaseApp console = new OConsoleDatabaseApp(args);
if (tty)
Expand Down Expand Up @@ -2139,6 +2127,18 @@ public void compareDatabases(@ConsoleParameter(name = "db1-url", description = "
}
}

@ConsoleCommand(description = "Load a sql script into the current database", splitInWords = true, onlineHelp = "Console-Command-Load-Script")
public void loadScript(@ConsoleParameter(name = "scripPath", description = "load script scriptPath") final String scriptPath)
throws IOException {

checkForDatabase();

message("\nLoading script " + scriptPath + "...");

executeBatch(scriptPath);

}

@ConsoleCommand(description = "Import a database into the current one", splitInWords = false, onlineHelp = "Console-Command-Import")
public void importDatabase(@ConsoleParameter(name = "options", description = "Import options") final String text)
throws IOException {
Expand Down

0 comments on commit f20227c

Please sign in to comment.