提交 29f54eb0 authored 作者: noelgrandin's avatar noelgrandin

Add entrypoint to org.h2.tools.Shell so it can be called from inside an application.

patch by Thomas Gillet.
上级 d70d4680
......@@ -38,6 +38,8 @@ Change Log
</li><li>Lucene 2 is no longer supported.
</li><li>Fix bug in calculating default MIN and MAX values for SEQUENCE.
</li><li>Fix bug in performing IN queries with multiple values when IGNORECASE=TRUE
</li><li>Add entrypoint to org.h2.tools.Shell so it can be called from inside an application.
patch by Thomas Gillet.
</li></ul>
<h2>Version 1.3.175 (2014-01-18)</h2>
......
......@@ -163,6 +163,23 @@ public class Shell extends Tool implements Runnable {
}
}
}
/**
* Run the shell tool with the given connection and command line settings.<br>
* The connection will be closed when the shell exits.
* This is primary used to integrate the Shell into another application.
* <p>
* <i>Note:</i> using the "-url" option in {@code args} doesn't make much sense
* since it will override the {@code conn} parameter.
*
* @param conn the connection
* @param args the command line settings
*/
public void runTool(Connection conn, String... args) throws SQLException {
this.conn = conn;
this.stat = conn.createStatement();
runTool(args);
}
private void showHelp() {
println("Commands are case insensitive; SQL statements end with ';'");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论