Logo Search packages:      
Sourcecode: mysql-connector-java version File versions

void com::mysql::jdbc::ResultSet::realClose ( boolean  calledExplicitly  )  throws SQLException [inline, protected]

Closes this ResultSet and releases resources.

Parameters:
calledExplicitly was this called by close()?
Exceptions:
SQLException if an error occurs

Reimplemented in com::mysql::jdbc::UpdatableResultSet.

Definition at line 4376 of file ResultSet.java.

References getString().

Referenced by com::mysql::jdbc::Statement::closeAllOpenResults(), com::mysql::jdbc::Statement::execute(), com::mysql::jdbc::Statement::executeBatch(), com::mysql::jdbc::Statement::executeQuery(), com::mysql::jdbc::PreparedStatement::executeQuery(), com::mysql::jdbc::Statement::executeUpdate(), and com::mysql::jdbc::PreparedStatement::executeUpdate().

                            {
        try {
            if (this.useUsageAdvisor && !this.isClosed) {
                if (!calledExplicitly) {
                    String message = Messages.getString(
                            "ResultSet.ResultSet_implicitly_closed_by_driver._150") //$NON-NLS-1$
                         +Messages.getString(
                            "ResultSet._n_nYou_should_close_ResultSets_explicitly_from_your_code_to_free_up_resources_in_a_more_efficient_manner._151"); //$NON-NLS-1$

                    this.eventSink.consumeEvent(new ProfilerEvent(
                            ProfilerEvent.TYPE_WARN, "",
                            (this.owningStatement == null) ? "N/A"
                                                           : this.owningStatement.currentCatalog,
                            this.connection.getId(),
                            (this.owningStatement == null) ? (-1)
                                                           : this.owningStatement.getId(),
                            this.resultId, System.currentTimeMillis(), 0, null,
                            this.pointOfOrigin, message));
                }

                if (this.rowData instanceof RowDataStatic && !isLast() &&
                        !isAfterLast() && (this.rowData.size() != 0)) {
                    StringBuffer messageBuf = new StringBuffer(Messages.getString(
                                "ResultSet.Possible_incomplete_traversal_of_result_set._Cursor_was_left_on_row__154")); //$NON-NLS-1$
                    messageBuf.append(getRow());
                    messageBuf.append(Messages.getString("ResultSet._of__155")); //$NON-NLS-1$
                    messageBuf.append(this.rowData.size());
                    messageBuf.append(Messages.getString(
                            "ResultSet._rows_when_it_was_closed._156")); //$NON-NLS-1$
                    messageBuf.append(Messages.getString(
                            "ResultSet._n_nYou_should_consider_re-formulating_your_query_to_return_only_the_rows_you_are_interested_in_using._157")); //$NON-NLS-1$

                    this.eventSink.consumeEvent(new ProfilerEvent(
                            ProfilerEvent.TYPE_WARN, "",
                            (this.owningStatement == null)
                            ? Messages.getString("ResultSet.N/A_159")
                            : this.owningStatement.currentCatalog, //$NON-NLS-1$
                            this.connection.getId(),
                            (this.owningStatement == null) ? (-1)
                                                           : this.owningStatement.getId(),
                            this.resultId, System.currentTimeMillis(), 0, null,
                            this.pointOfOrigin, messageBuf.toString()));
                }

                //
                // Report on any columns that were selected but
                // not referenced
                //
                if (this.columnUsed.length > 0) {
                    StringBuffer buf = new StringBuffer(Messages.getString(
                                "ResultSet.The_following_columns_were__160")); //$NON-NLS-1$
                    buf.append(Messages.getString(
                            "ResultSet._part_of_the_SELECT_statement_for_this_result_set,_but_were_161")); //$NON-NLS-1$
                    buf.append(Messages.getString(
                            "ResultSet._never_referenced___162")); //$NON-NLS-1$

                    boolean issueWarn = false;

                    for (int i = 0; i < this.columnUsed.length; i++) {
                        if (!this.columnUsed[i]) {
                            if (!issueWarn) {
                                issueWarn = true;
                            } else {
                                buf.append(", ");
                            }

                            buf.append(this.fields[i].getFullName());
                        }
                    }

                    if (issueWarn) {
                        this.eventSink.consumeEvent(new ProfilerEvent(
                                ProfilerEvent.TYPE_WARN, "",
                                (this.owningStatement == null) ? "N/A"
                                                               : this.owningStatement.currentCatalog,
                                this.connection.getId(),
                                (this.owningStatement == null) ? (-1)
                                                               : this.owningStatement.getId(),
                                0, System.currentTimeMillis(), 0, null,
                                this.pointOfOrigin, buf.toString()));
                    }
                }
            }
        } finally {
            SQLException exceptionDuringClose = null;

            if (this.rowData != null) {
                try {
                    this.rowData.close();
                } catch (SQLException sqlEx) {
                    exceptionDuringClose = sqlEx;
                }
            }

            this.rowData = null;
            this.defaultTimeZone = null;
            this.fields = null;
            this.columnNameToIndex = null;
            this.fullColumnNameToIndex = null;
            this.eventSink = null;
            this.nextResultSet = null;
            this.warningChain = null;
            this.owningStatement = null;
            this.catalog = null;
            this.serverInfo = null;
            this.thisRow = null;
            this.fastDateCal = null;
            
            this.isClosed = true;
            
            if (exceptionDuringClose != null) {
                throw exceptionDuringClose;
            }
        }
    }


Generated by  Doxygen 1.6.0   Back to index