当前位置: 首页>>代码示例>>Java>>正文


Java Shell类代码示例

本文整理汇总了Java中org.h2.tools.Shell的典型用法代码示例。如果您正苦于以下问题:Java Shell类的具体用法?Java Shell怎么用?Java Shell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Shell类属于org.h2.tools包,在下文中一共展示了Shell类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doPost

import org.h2.tools.Shell; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
    resp.setHeader("Pragma", "no-cache");
    resp.setDateHeader("Expires", 0);
    if (API.allowedBotHosts != null && ! API.allowedBotHosts.contains(req.getRemoteHost())) {
        resp.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;
    }

    String line = Convert.nullToEmpty(req.getParameter("line"));
    try (PrintStream out = new PrintStream(resp.getOutputStream())) {
        out.println("\n> " + line);
        try {
            Shell shell = new Shell();
            shell.setErr(out);
            shell.setOut(out);
            shell.runTool(Db.getConnection(), "-sql", line);
        } catch (SQLException e) {
            out.println(e.toString());
        }
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:24,代码来源:DbShellServlet.java

示例2: doPost

import org.h2.tools.Shell; //导入依赖的package包/类
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    resp.setHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
    resp.setHeader("Pragma", "no-cache");
    resp.setDateHeader("Expires", 0);
    if (API.allowedBotHosts != null && ! API.allowedBotHosts.contains(req.getRemoteHost())) {
        resp.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;
    }

    String line = Convert.nullToEmpty(req.getParameter("line"));
    try (PrintStream out = new PrintStream(resp.getOutputStream())) {
        out.println("\n> " + line);
        try {
            Shell shell = new Shell();
            shell.setErr(out);
            shell.setOut(out);
            shell.runTool(Db.db.getConnection(), "-sql", line);
        } catch (SQLException e) {
            out.println(e.toString());
        }
    }
}
 
开发者ID:risex,项目名称:risecoin,代码行数:24,代码来源:DbShellServlet.java

示例3: performConsoleCommand

import org.h2.tools.Shell; //导入依赖的package包/类
/**
 * @param args2
 */
private static void performConsoleCommand(List<String> args)
{
	try {
		createUrl(args);
		
		new Shell() {
			@Override
			protected void showUsage()
			{
				showConsoleUsage();
			}

		}.runTool(args.toArray(new String[0]));
		
	} catch (SQLException x) {
		System.err.println(x.getMessage() + "\n");
		showConsoleUsage();
	}

}
 
开发者ID:shesse,项目名称:h2ha,代码行数:24,代码来源:H2HaServer.java

示例4: executeQuery

import org.h2.tools.Shell; //导入依赖的package包/类
public static String executeQuery(String line) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(baos);
    out.println(line);
    try {
        Shell shell = new Shell();
        shell.setErr(out);
        shell.setOut(out);
        shell.runTool(Db.db.getConnection(), "-sql", line);
    } catch (SQLException e) {
        out.println(e.toString());
    }
    return new String(baos.toByteArray());
}
 
开发者ID:BitcoinFullnode,项目名称:ROKOS-OK-Bitcoin-Fullnode,代码行数:15,代码来源:Helper.java


注:本文中的org.h2.tools.Shell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。