0N/A/*
2362N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A/*
0N/A * Created on Apr 28, 2005
0N/A */
0N/Apackage javax.sql;
0N/A
0N/Aimport java.sql.PreparedStatement;
0N/Aimport java.sql.SQLException;
0N/Aimport java.util.EventObject;
0N/A
0N/A/**
0N/A * A <code>StatementEvent</code> is sent to all <code>StatementEventListener</code>s which were
0N/A * registered with a <code>PooledConnection</code>. This occurs when the driver determines that a
0N/A * <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines
0N/A * is invalid.
0N/A * <p>
0N/A * @since 1.6
0N/A */
0N/Apublic class StatementEvent extends EventObject {
0N/A
0N/A private SQLException exception;
0N/A private PreparedStatement statement;
0N/A
0N/A /**
0N/A * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
0N/A * <code>PreparedStatement</code>. The <code>SQLException</code> contained in the event defaults to
0N/A * null.
0N/A * <p>
0N/A * @param con The <code>PooledConnection</code> that the closed or invalid
0N/A * <code>PreparedStatement</code>is associated with.
0N/A * @param statement The <code>PreparedStatement</code> that is bieng closed or is invalid
0N/A * <p>
0N/A * @throws IllegalArgumentException if <code>con</code> is null.
0N/A *
0N/A * @since 1.6
0N/A */
0N/A public StatementEvent(PooledConnection con,
0N/A PreparedStatement statement) {
0N/A
0N/A super(con);
0N/A
0N/A this.statement = statement;
0N/A this.exception = null;
0N/A }
0N/A
0N/A /**
0N/A * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
0N/A * <code>PreparedStatement</code> and <code>SQLException</code>
0N/A * <p>
0N/A * @param con The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
0N/A * is associated with.
0N/A * @param statement The <code>PreparedStatement</code> that is being closed or is invalid
0N/A * @param exception The <code>SQLException </code>the driver is about to throw to
0N/A * the application
0N/A *
0N/A * @throws IllegalArgumentException if <code>con</code> is null.
0N/A * <p>
0N/A * @since 1.6
0N/A */
0N/A public StatementEvent(PooledConnection con,
0N/A PreparedStatement statement,
0N/A SQLException exception) {
0N/A
0N/A super(con);
0N/A
0N/A this.statement = statement;
0N/A this.exception = exception;
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>PreparedStatement</code> that is being closed or is invalid
0N/A * <p>
0N/A * @return The <code>PreparedStatement</code> that is being closed or is invalid
0N/A * <p>
0N/A * @since 1.6
0N/A */
0N/A public PreparedStatement getStatement() {
0N/A
0N/A return this.statement;
0N/A }
0N/A
0N/A /**
0N/A * Returns the <code>SQLException</code> the driver is about to throw
0N/A * <p>
0N/A * @return The <code>SQLException</code> the driver is about to throw
0N/A * <p>
0N/A * @since 1.6
0N/A */
0N/A public SQLException getSQLException() {
0N/A
0N/A return this.exception;
0N/A }
0N/A}