Package henplus.view.util

Examples of henplus.view.util.CancelWriter


            return _workingStatement.executeQuery(selectStmt.toString());
        }

        @Override
        public long getExpectedRows() {
            final CancelWriter selectInfo = new CancelWriter(HenPlus.msg());
            Statement stmt = null;
            ResultSet rset = null;
            try {
                selectInfo.print("determining number of rows...");
                stmt = _session.createStatement();
                final StringBuilder countStmt = new StringBuilder("SELECT count(*) from ");
                countStmt.append(_table);
                if (_whereClause != null) {
                    countStmt.append(" WHERE ");
                    countStmt.append(_whereClause);
                }
                rset = stmt.executeQuery(countStmt.toString());
                rset.next();
                return rset.getLong(1);
            } catch (final Exception e) {
                return -1;
            } finally {
                if (rset != null) {
                    try {
                        rset.close();
                    } catch (final Exception e) {
                    }
                }
                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch (final Exception e) {
                    }
                }
                selectInfo.cancel();
            }
        }
View Full Code Here


    public LongRunningTimeDisplay(final String msg, final long showAfter) {
        _startTimeDisplayAfter = showAfter;
        _message = msg;
        _running = true;
        _armed = false;
        _timeDisplay = new CancelWriter(HenPlus.msg());
    }
View Full Code Here

        @Override
        public void cancelRunningStatement() {
            try {
                HenPlus.msg().println("cancel statement...");
                HenPlus.msg().flush();
                final CancelWriter info = new CancelWriter(HenPlus.msg());
                info.print("please wait");
                _stmt.cancel();
                info.cancel();
                HenPlus.msg().println("done.");
                _running = false;
            } catch (final Exception e) {
                Logger.debug("Exception while cancelling a statement: ", e);
            }
View Full Code Here

TOP

Related Classes of henplus.view.util.CancelWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.