⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trace.java

📁 一个用java写的开源的数据库系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }    /**     * Method declaration     *     *     * @param code     *     * @return     */    public static SQLException error(int code) {        return getError(code, null);    }    /**     * Method declaration     *     *     * @param code     * @param s     *     * @return     */    public static SQLException error(int code, String s) {        return getError(code, s);    }    /**     * Method declaration     *     *     * @param code     * @param i     *     * @return     */    public static SQLException error(int code, int i) {        return getError(code, String.valueOf(i));    }    /**     * Method declaration     *     *     * @param condition     *     * @throws SQLException     */    static void doAssert(boolean condition) throws SQLException {        doAssert(condition, null);    }    /**     * Method declaration     *     *     * @param condition     * @param error     *     * @throws SQLException     */    static void doAssert(boolean condition,                         String error) throws SQLException {        if (!condition) {            printStack();            throw getError(ASSERT_FAILED, error);        }    }    /**     * Method declaration     *     *     * @param condition     * @param code     *     * @throws SQLException     */    static void check(boolean condition, int code) throws SQLException {        check(condition, code, null);    }    /**     * Method declaration     *     *     * @param condition     * @param code     * @param s     *     * @throws SQLException     */    static void check(boolean condition, int code,                      Object add) throws SQLException {        if (!condition) {            throw getError(code, add);        }    }// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP)// for the PrinterWriter interface    /**     * Method declaration     *     *     * @param c     */    public void println(char c[]) {        String s = new String(c);        if (sTrace.equals("") && (s.indexOf("hsqldb.Trace") == -1)                && (s.indexOf("hsqldb") != -1)) {            int i = s.indexOf('.');            if (i != -1) {                s = s.substring(i + 1);            }            i = s.indexOf('(');            if (i != -1) {                s = s.substring(0, i);            }            sTrace = s;        }    }// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP)    public void println(String s) {        if (sTrace.equals("") && (s.indexOf("hsqldb.Trace") == -1)                && (s.indexOf("hsqldb") != -1)) {            int i = s.indexOf('.');            if (i != -1) {                s = s.substring(i + 1);            }            i = s.indexOf('(');            if (i != -1) {                s = s.substring(0, i);            }            sTrace = s;        }    }// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP)    public void write(String s) {        ;    }    /**     * Constructor declaration     *     */    Trace() {        super(System.out);    }    /**     * Used to print messages to System.out     *     *     * @param message message to print     */    static void printSystemOut(String message) {        System.out.println(message);    }    /**     * Method declaration     *     *     * @param l     */    static void trace(long l) {        traceCaller(String.valueOf(l));    }    /**     * Method declaration     *     *     * @param i     */    static void trace(int i) {        traceCaller(String.valueOf(i));    }    /**     * Method declaration     *     */    static void trace() {        traceCaller("");    }    /**     * Method declaration     *     *     * @param s     */    static void trace(String s) {        traceCaller(s);    }    /**     * Method declaration     *     *     * @throws SQLException     */    static void stop() throws SQLException {        stop(null);    }    /**     * Method declaration     *     *     * @param s     *     * @throws SQLException     */    static void stop(String s) throws SQLException {        if (iStop++ % 10000 != 0) {            return;        }        if (new File("trace.stop").exists()) {            printStack();            throw getError(EXTERNAL_STOP, s);        }    }// fredt@users 20010701 - patch 418014 by deforest@users    /**     *  With trace enabled, it is sometimes hard to figure out     *  what a true exception is versus an exception generated     *  by the tracing engine. These two methods define     *  specialized versions Exceptions that are thrown during     *  tracing so you can more easily differentiate between a     *  Exception and a TraceException.     */    private static void printStack() {        class TraceException extends Exception {            TraceException() {                super("Trace");            }        }        ;        Exception e = new TraceException();        e.printStackTrace();    }    private static void traceCaller(String s) {        class TraceCallerException extends Exception {            TraceCallerException() {                super("TraceCaller");            }        }        ;        Exception e = new TraceCallerException();        sTrace = "";        e.printStackTrace(tTracer);        s = sTrace + "\t" + s;// fredt@users 20010701 - patch 418014 by deforest@users// trace to System.out is handy if only trace messages of hsql are required        if (TRACESYSTEMOUT) {            System.out.println(s);        } else {            DriverManager.println(s);        }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -