src/java.sql/share/classes/javax/sql/StatementEvent.java
author naoto
Thu, 31 Jan 2019 12:43:59 -0800
changeset 53614 125012edb689
parent 47216 71c04702a3d5
child 58338 faf791c5a710
permissions -rw-r--r--
8217892: Clarify the support for the new Japanese era in java.time.chrono.JapaneseEra Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
     2
 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 * Created on Apr 28, 2005
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
package javax.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.sql.PreparedStatement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.sql.SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.EventObject;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A <code>StatementEvent</code> is sent to all <code>StatementEventListener</code>s which were
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * registered with a <code>PooledConnection</code>. This occurs when the driver determines that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <code>PreparedStatement</code> that is associated with the <code>PooledConnection</code> has been closed or the driver determines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * is invalid.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    40
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
public class StatementEvent extends EventObject {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
    45
        static final long serialVersionUID = -8089573731826608315L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        private SQLException            exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
        private PreparedStatement       statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
         * <code>PreparedStatement</code>.  The <code>SQLException</code> contained in the event defaults to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
         * null.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    53
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
         * @param con                   The <code>PooledConnection</code> that the closed or invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
         * <code>PreparedStatement</code>is associated with.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 14342
diff changeset
    56
         * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    57
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
         * @throws IllegalArgumentException if <code>con</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                                  PreparedStatement statement) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                this.exception = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * <code>PreparedStatement</code> and <code>SQLException</code>
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    74
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
         * @param con                   The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * is associated with.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         * @param exception             The <code>SQLException </code>the driver is about to throw to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         *                                              the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
         * @throws IllegalArgumentException if <code>con</code> is null.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    82
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                                                  PreparedStatement statement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                                  SQLException exception) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                this.exception = exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
         * Returns the <code>PreparedStatement</code> that is being closed or is invalid
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    97
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
         * @return      The <code>PreparedStatement</code> that is being closed or is invalid
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    99
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        public PreparedStatement getStatement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                return this.statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
         * Returns the <code>SQLException</code> the driver is about to throw
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
   109
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
         * @return      The <code>SQLException</code> the driver is about to throw
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
   111
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        public SQLException getSQLException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                return this.exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
}