src/java.sql/share/classes/javax/sql/StatementEvent.java
author naoto
Tue, 12 Nov 2019 14:05:18 -0800
changeset 59043 1a79b4bfc85a
parent 58338 faf791c5a710
permissions -rw-r--r--
8232860: Error formatting integer values with MessageFormat.format() using HOST provider Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58338
faf791c5a710 8231442: Suppress warnings on non-serializable instance fields in java.sql.* modules
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 2005, 2019, 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;
58338
faf791c5a710 8231442: Suppress warnings on non-serializable instance fields in java.sql.* modules
darcy
parents: 47216
diff changeset
    47
        @SuppressWarnings("serial") // Not statically typed as Serializable
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        private PreparedStatement       statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
         * <code>PreparedStatement</code>.  The <code>SQLException</code> contained in the event defaults to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
         * null.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    54
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
         * @param con                   The <code>PooledConnection</code> that the closed or invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
         * <code>PreparedStatement</code>is associated with.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 14342
diff changeset
    57
         * @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
    58
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
         * @throws IllegalArgumentException if <code>con</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                                  PreparedStatement statement) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                this.exception = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         * Constructs a <code>StatementEvent</code> with the specified <code>PooledConnection</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
         * <code>PreparedStatement</code> and <code>SQLException</code>
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    75
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
         * @param con                   The <code>PooledConnection</code> that the closed or invalid <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * is associated with.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         * @param statement             The <code>PreparedStatement</code> that is being closed or is invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         * @param exception             The <code>SQLException </code>the driver is about to throw to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         *                                              the application
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
         * @throws IllegalArgumentException if <code>con</code> is null.
24197
a5c2cff81e25 8039488: Tidy warnings cleanup for javax.sql
yan
parents: 23010
diff changeset
    83
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        public StatementEvent(PooledConnection con,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                                  PreparedStatement statement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                                                  SQLException exception) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                super(con);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
                this.statement = statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                this.exception = exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
         * 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
    98
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
         * @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
   100
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        public PreparedStatement getStatement() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
                return this.statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
         * 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
   110
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
         * @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
   112
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        public SQLException getSQLException() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                return this.exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
}