src/java.sql/share/classes/java/sql/Statement.java
author herrick
Wed, 20 Nov 2019 10:17:37 -0500
branchJDK-8200758-branch
changeset 59160 e90068e7afa1
parent 47216 71c04702a3d5
permissions -rw-r--r--
JDK-8234402: revert change that stopped providing JPackageToolProvider Reviewed-by: asemenyuk, almatvee, kcr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
     2
 * Copyright (c) 1996, 2017, 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
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
    28
import java.util.regex.Pattern;
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
    29
import static java.util.stream.Collectors.joining;
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
    30
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * <P>The object used for executing a static SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * and returning the results it produces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * By default, only one <code>ResultSet</code> object per <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * object can be open at the same time. Therefore, if the reading of one
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <code>ResultSet</code> object is interleaved
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * with the reading of another, each must have been generated by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * different <code>Statement</code> objects. All execution methods in the
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
    40
 * <code>Statement</code> interface implicitly close a current
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
    41
 * <code>ResultSet</code> object of the statement if an open one exists.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @see Connection#createStatement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * @see ResultSet
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
    45
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    47
public interface Statement extends Wrapper, AutoCloseable {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * Executes the given SQL statement, which returns a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * <code>ResultSet</code> object.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    52
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    53
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    54
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * @param sql an SQL statement to be sent to the database, typically a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *        static SQL <code>SELECT</code> statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @return a <code>ResultSet</code> object that contains the data produced
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     *         by the given query; never <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    60
     * this method is called on a closed <code>Statement</code>, the given
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *            SQL statement produces anything other than a single
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    62
     *            <code>ResultSet</code> object, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    63
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    64
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    65
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    66
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    67
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    ResultSet executeQuery(String sql) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * Executes the given SQL statement, which may be an <code>INSERT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * <code>UPDATE</code>, or <code>DELETE</code> statement or an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * SQL statement that returns nothing, such as an SQL DDL statement.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    75
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    76
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    77
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * <code>DELETE</code>; or an SQL statement that returns nothing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * such as a DDL statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @return either (1) the row count for SQL Data Manipulation Language (DML) statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *         or (2) 0 for SQL statements that return nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    86
     * this method is called on a closed <code>Statement</code>, the given
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    87
     * SQL statement produces a <code>ResultSet</code> object, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    88
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    89
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    90
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    91
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
    92
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    int executeUpdate(String sql) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * Releases this <code>Statement</code> object's database
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * and JDBC resources immediately instead of waiting for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * this to happen when it is automatically closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * It is generally good practice to release resources as soon as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * you are finished with them to avoid tying up database
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Calling the method <code>close</code> on a <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * object that is already closed has no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * <B>Note:</B>When a <code>Statement</code> object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * closed, its current <code>ResultSet</code> object, if one exists, is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * also closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    void close() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    //----------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Retrieves the maximum number of bytes that can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * returned for character and binary column values in a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * object produced by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * This limit applies only to  <code>BINARY</code>, <code>VARBINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * <code>NCHAR</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * and <code>LONGVARCHAR</code> columns.  If the limit is exceeded, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * excess data is silently discarded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @return the current column size limit for columns storing character and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *         binary values; zero means there is no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @see #setMaxFieldSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    int getMaxFieldSize() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * Sets the limit for the maximum number of bytes that can be returned for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * character and binary column values in a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * object produced by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * This limit applies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * only to <code>BINARY</code>, <code>VARBINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * <code>NCHAR</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * <code>LONGVARCHAR</code> fields.  If the limit is exceeded, the excess data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * is silently discarded. For maximum portability, use values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * greater than 256.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * @param max the new column size limit in bytes; zero means there is no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * this method is called on a closed <code>Statement</code>
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   151
     *            or the condition {@code max >= 0} is not satisfied
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @see #getMaxFieldSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    void setMaxFieldSize(int max) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * Retrieves the maximum number of rows that a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * <code>ResultSet</code> object produced by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * <code>Statement</code> object can contain.  If this limit is exceeded,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * the excess rows are silently dropped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @return the current maximum number of rows for a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *         object produced by this <code>Statement</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *         zero means there is no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @see #setMaxRows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    int getMaxRows() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Sets the limit for the maximum number of rows that any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * <code>ResultSet</code> object  generated by this <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * object can contain to the given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * If the limit is exceeded, the excess
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * rows are silently dropped.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @param max the new max rows limit; zero means there is no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * this method is called on a closed <code>Statement</code>
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   181
     *            or the condition {@code max >= 0} is not satisfied
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @see #getMaxRows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    void setMaxRows(int max) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * Sets escape processing on or off.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * If escape scanning is on (the default), the driver will do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * escape substitution before sending the SQL statement to the database.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   190
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   191
     * The {@code Connection} and {@code DataSource} property
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   192
     * {@code escapeProcessing} may be used to change the default escape processing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   193
     * behavior.  A value of true (the default) enables escape Processing for
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   194
     * all {@code Statement} objects. A value of false disables escape processing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   195
     * for all {@code Statement} objects.  The {@code setEscapeProcessing}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   196
     * method may be used to specify the escape processing behavior for an
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   197
     * individual {@code Statement} object.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
   198
     * <p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * Note: Since prepared statements have usually been parsed prior
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * to making this call, disabling escape processing for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * <code>PreparedStatements</code> objects will have no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @param enable <code>true</code> to enable escape processing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     *       <code>false</code> to disable it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    void setEscapeProcessing(boolean enable) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * Retrieves the number of seconds the driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * wait for a <code>Statement</code> object to execute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * If the limit is exceeded, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * <code>SQLException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * @return the current query timeout limit in seconds; zero means there is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     *         no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * @see #setQueryTimeout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    int getQueryTimeout() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * Sets the number of seconds the driver will wait for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * <code>Statement</code> object to execute to the given number of seconds.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   227
     *By default there is no limit on the amount of time allowed for a running
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   228
     * statement to complete. If the limit is exceeded, an
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   229
     * <code>SQLTimeoutException</code> is thrown.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   230
     * A JDBC driver must apply this limit to the <code>execute</code>,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   231
     * <code>executeQuery</code> and <code>executeUpdate</code> methods.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   232
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   233
     * <strong>Note:</strong> JDBC driver implementations may also apply this
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   234
     * limit to {@code ResultSet} methods
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * (consult your driver vendor documentation for details).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   236
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   237
     * <strong>Note:</strong> In the case of {@code Statement} batching, it is
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   238
     * implementation defined as to whether the time-out is applied to
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   239
     * individual SQL commands added via the {@code addBatch} method or to
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   240
     * the entire batch of SQL commands invoked by the {@code executeBatch}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   241
     * method (consult your driver vendor documentation for details).
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @param seconds the new query timeout limit in seconds; zero means
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *        there is no limit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * this method is called on a closed <code>Statement</code>
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   247
     *            or the condition {@code seconds >= 0} is not satisfied
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @see #getQueryTimeout
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    void setQueryTimeout(int seconds) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * Cancels this <code>Statement</code> object if both the DBMS and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * driver support aborting an SQL statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * This method can be used by one thread to cancel a statement that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * is being executed by another thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    void cancel() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * Retrieves the first warning reported by calls on this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * Subsequent <code>Statement</code> object warnings will be chained to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * <code>SQLWarning</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * <p>The warning chain is automatically cleared each time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * a statement is (re)executed. This method may not be called on a closed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * <code>Statement</code> object; doing so will cause an <code>SQLException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * to be thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <P><B>Note:</B> If you are processing a <code>ResultSet</code> object, any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * warnings associated with reads on that <code>ResultSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * will be chained on it rather than on the <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * object that produced it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @return the first <code>SQLWarning</code> object or <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *         if there are no warnings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    SQLWarning getWarnings() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * Clears all the warnings reported on this <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * object. After a call to this method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * the method <code>getWarnings</code> will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * <code>null</code> until a new warning is reported for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    void clearWarnings() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * Sets the SQL cursor name to the given <code>String</code>, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * will be used by subsequent <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * <code>execute</code> methods. This name can then be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * used in SQL positioned update or delete statements to identify the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * current row in the <code>ResultSet</code> object generated by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * statement.  If the database does not support positioned update/delete,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * this method is a noop.  To insure that a cursor has the proper isolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * level to support updates, the cursor's <code>SELECT</code> statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * should have the form <code>SELECT FOR UPDATE</code>.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * <code>FOR UPDATE</code> is not present, positioned updates may fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * <P><B>Note:</B> By definition, the execution of positioned updates and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * deletes must be done by a different <code>Statement</code> object than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * the one that generated the <code>ResultSet</code> object being used for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * positioning. Also, cursor names must be unique within a connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * @param name the new cursor name, which must be unique within
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     *             a connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    void setCursorName(String name) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    //----------------------- Multiple Results --------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * Executes the given SQL statement, which may return multiple results.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * In some (uncommon) situations, a single SQL statement may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * multiple result sets and/or update counts.  Normally you can ignore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * this unless you are (1) executing a stored procedure that you know may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * return multiple results or (2) you are dynamically executing an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * unknown SQL string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * The <code>execute</code> method executes an SQL statement and indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * form of the first result.  You must then use the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * <code>getResultSet</code> or <code>getUpdateCount</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * to retrieve the result, and <code>getMoreResults</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * move to any subsequent result(s).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   339
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   340
     *<strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   341
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @param sql any SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @return <code>true</code> if the first result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     *         object; <code>false</code> if it is an update count or there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     *         no results
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   346
     * @exception SQLException if a database access error occurs,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   347
     * this method is called on a closed <code>Statement</code>,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   348
     * the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   349
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   350
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   351
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   352
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   353
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @see #getResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @see #getUpdateCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @see #getMoreResults
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    boolean execute(String sql) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *  Retrieves the current result as a <code>ResultSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *  This method should be called only once per result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @return the current result as a <code>ResultSet</code> object or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * <code>null</code> if the result is an update count or there are no more results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    ResultSet getResultSet() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     *  Retrieves the current result as an update count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *  if the result is a <code>ResultSet</code> object or there are no more results, -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     *  is returned. This method should be called only once per result.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @return the current result as an update count; -1 if the current result is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * <code>ResultSet</code> object or there are no more results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    int getUpdateCount() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * Moves to this <code>Statement</code> object's next result, returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * <code>true</code> if it is a <code>ResultSet</code> object, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * implicitly closes any current <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * object(s) obtained with the method <code>getResultSet</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * <P>There are no more results when the following is true:
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   392
     * <PRE>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     *     // stmt is a Statement object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *     ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1))
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   395
     * }</PRE>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @return <code>true</code> if the next result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *         object; <code>false</code> if it is an update count or there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     *         no more results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    boolean getMoreResults() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    //--------------------------JDBC 2.0-----------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * Gives the driver a hint as to the direction in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * rows will be processed in <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * objects created using this <code>Statement</code> object.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * default value is <code>ResultSet.FETCH_FORWARD</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * Note that this method sets the default fetch direction for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * result sets generated by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * Each result set has its own methods for getting and setting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * its own fetch direction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @param direction the initial direction for processing rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * or the given direction
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * is not one of <code>ResultSet.FETCH_FORWARD</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * <code>ResultSet.FETCH_REVERSE</code>, or <code>ResultSet.FETCH_UNKNOWN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * @see #getFetchDirection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    void setFetchDirection(int direction) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * Retrieves the direction for fetching rows from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * database tables that is the default for result sets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * generated from this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * If this <code>Statement</code> object has not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * a fetch direction by calling the method <code>setFetchDirection</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * the return value is implementation-specific.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * @return the default fetch direction for result sets generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *          from this <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @see #setFetchDirection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    int getFetchDirection() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * Gives the JDBC driver a hint as to the number of rows that should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * be fetched from the database when more rows are needed for
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   452
     * <code>ResultSet</code> objects generated by this <code>Statement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * If the value specified is zero, then the hint is ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * The default value is zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * @param rows the number of rows to fetch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * this method is called on a closed <code>Statement</code> or the
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   459
     *        condition {@code rows >= 0} is not satisfied.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @see #getFetchSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    void setFetchSize(int rows) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * Retrieves the number of result set rows that is the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * fetch size for <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * generated from this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * If this <code>Statement</code> object has not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * a fetch size by calling the method <code>setFetchSize</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * the return value is implementation-specific.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * @return the default fetch size for result sets generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     *          from this <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * @see #setFetchSize
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    int getFetchSize() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * Retrieves the result set concurrency for <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * generated by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * @return either <code>ResultSet.CONCUR_READ_ONLY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * <code>ResultSet.CONCUR_UPDATABLE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    int getResultSetConcurrency() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * Retrieves the result set type for <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * generated by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    int getResultSetType()  throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   508
     * Adds the given SQL command to the current list of commands for this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * <code>Statement</code> object. The commands in this list can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * executed as a batch by calling the method <code>executeBatch</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * <P>
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   512
     *<strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   513
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * @param sql typically this is a SQL <code>INSERT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * <code>UPDATE</code> statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   517
     * this method is called on a closed <code>Statement</code>, the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   518
     * driver does not support batch updates, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   519
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @see #executeBatch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @see DatabaseMetaData#supportsBatchUpdates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    void addBatch( String sql ) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * Empties this <code>Statement</code> object's current list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * SQL commands.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
   529
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     *  this method is called on a closed <code>Statement</code> or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * driver does not support batch updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * @see #addBatch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * @see DatabaseMetaData#supportsBatchUpdates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    void clearBatch() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * Submits a batch of commands to the database for execution and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * if all commands execute successfully, returns an array of update counts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * The <code>int</code> elements of the array that is returned are ordered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * to correspond to the commands in the batch, which are ordered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * according to the order in which they were added to the batch.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * The elements in the array returned by the method <code>executeBatch</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * may be one of the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * <OL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * <LI>A number greater than or equal to zero -- indicates that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * command was processed successfully and is an update count giving the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * number of rows in the database that were affected by the command's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * execution
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * <LI>A value of <code>SUCCESS_NO_INFO</code> -- indicates that the command was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * processed successfully but that the number of rows affected is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * unknown
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * If one of the commands in a batch update fails to execute properly,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * this method throws a <code>BatchUpdateException</code>, and a JDBC
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * driver may or may not continue to process the remaining commands in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * the batch.  However, the driver's behavior must be consistent with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * particular DBMS, either always continuing to process commands or never
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * continuing to process commands.  If the driver continues processing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * after a failure, the array returned by the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * <code>BatchUpdateException.getUpdateCounts</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * will contain as many elements as there are commands in the batch, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * at least one of the elements will be the following:
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 18156
diff changeset
   566
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * <LI>A value of <code>EXECUTE_FAILED</code> -- indicates that the command failed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * to execute successfully and occurs only if a driver continues to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * process commands after a command fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * </OL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * The possible implementations and return values have been modified in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * the Java 2 SDK, Standard Edition, version 1.3 to
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   574
     * accommodate the option of continuing to process commands in a batch
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   575
     * update after a <code>BatchUpdateException</code> object has been thrown.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * @return an array of update counts containing one element for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * command in the batch.  The elements of the array are ordered according
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * to the order in which commands were added to the batch.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * this method is called on a closed <code>Statement</code> or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * driver does not support batch statements. Throws {@link BatchUpdateException}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * (a subclass of <code>SQLException</code>) if one of the commands sent to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * database fails to execute properly or attempts to return a result set.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   585
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   586
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   587
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   588
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * @see #addBatch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * @see DatabaseMetaData#supportsBatchUpdates
7797
5869cf1fbd3e 7006454: Typo in javadocs typo for Statement.executeBatch @since
lancea
parents: 6684
diff changeset
   592
     * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    int[] executeBatch() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * Retrieves the <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * that produced this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * @return the connection that produced this statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    Connection getConnection()  throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
  //--------------------------JDBC 3.0-----------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * The constant indicating that the current <code>ResultSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * should be closed when calling <code>getMoreResults</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
    int CLOSE_CURRENT_RESULT = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * The constant indicating that the current <code>ResultSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * should not be closed when calling <code>getMoreResults</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    int KEEP_CURRENT_RESULT = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * The constant indicating that all <code>ResultSet</code> objects that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * have previously been kept open should be closed when calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * <code>getMoreResults</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    int CLOSE_ALL_RESULTS = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * The constant indicating that a batch statement executed successfully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     * but that no count of the number of rows it affected is available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    int SUCCESS_NO_INFO = -2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    /**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   642
     * The constant indicating that an error occurred while executing a
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * batch statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    int EXECUTE_FAILED = -3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * The constant indicating that generated keys should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * available for retrieval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    int RETURN_GENERATED_KEYS = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * The constant indicating that generated keys should not be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * available for retrieval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    int NO_GENERATED_KEYS = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * Moves to this <code>Statement</code> object's next result, deals with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * any current <code>ResultSet</code> object(s) according  to the instructions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * specified by the given flag, and returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * <code>true</code> if the next result is a <code>ResultSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * <P>There are no more results when the following is true:
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   672
     * <PRE>{@code
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     *     // stmt is a Statement object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     *     ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1))
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
   675
     * }</PRE>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * @param current one of the following <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     *        constants indicating what should happen to current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     *        <code>ResultSet</code> objects obtained using the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     *        <code>getResultSet</code>:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     *        <code>Statement.CLOSE_CURRENT_RESULT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     *        <code>Statement.KEEP_CURRENT_RESULT</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     *        <code>Statement.CLOSE_ALL_RESULTS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * @return <code>true</code> if the next result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     *         object; <code>false</code> if it is an update count or there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     *         more results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * this method is called on a closed <code>Statement</code> or the argument
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
   689
     *         supplied is not one of the following:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     *        <code>Statement.CLOSE_CURRENT_RESULT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     *        <code>Statement.KEEP_CURRENT_RESULT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     *        <code>Statement.CLOSE_ALL_RESULTS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     *@exception SQLFeatureNotSupportedException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * <code>DatabaseMetaData.supportsMultipleOpenResults</code> returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * <code>false</code> and either
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     *        <code>Statement.KEEP_CURRENT_RESULT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     *        <code>Statement.CLOSE_ALL_RESULTS</code> are supplied as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * the argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
    boolean getMoreResults(int current) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * Retrieves any auto-generated keys created as a result of executing this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * <code>Statement</code> object. If this <code>Statement</code> object did
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * not generate any keys, an empty <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * object is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *<p><B>Note:</B>If the columns which represent the auto-generated keys were not specified,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * the JDBC driver implementation will determine the columns which best represent the auto-generated keys.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * @return a <code>ResultSet</code> object containing the auto-generated key(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     *         generated by the execution of this <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
    ResultSet getGeneratedKeys() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * Executes the given SQL statement and signals the driver with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * given flag about whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     * auto-generated keys produced by this <code>Statement</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * should be made available for retrieval.  The driver will ignore the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * flag if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * auto-generated keys (the list of such statements is vendor-specific).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   730
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   731
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   732
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * <code>DELETE</code>; or an SQL statement that returns nothing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * such as a DDL statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * @param autoGeneratedKeys a flag indicating whether auto-generated keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     *        should be made available for retrieval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     *         one of the following constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     *         <code>Statement.RETURN_GENERATED_KEYS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     *         <code>Statement.NO_GENERATED_KEYS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * @return either (1) the row count for SQL Data Manipulation Language (DML) statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     *         or (2) 0 for SQL statements that return nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     *  this method is called on a closed <code>Statement</code>, the given
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   747
     *            SQL statement returns a <code>ResultSet</code> object,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   748
     *            the given constant is not one of those allowed, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   749
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * this method with a constant of Statement.RETURN_GENERATED_KEYS
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   752
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   753
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   754
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   755
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * Executes the given SQL statement and signals the driver that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * auto-generated keys indicated in the given array should be made available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * for retrieval.   This array contains the indexes of the columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * target table that contain the auto-generated keys that should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * available. The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * auto-generated keys (the list of such statements is vendor-specific).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   768
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   769
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   770
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * <code>DELETE</code>; or an SQL statement that returns nothing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * such as a DDL statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * @param columnIndexes an array of column indexes indicating the columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     *        that should be returned from the inserted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     * @return either (1) the row count for SQL Data Manipulation Language (DML) statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     *         or (2) 0 for SQL statements that return nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * this method is called on a closed <code>Statement</code>, the SQL
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   782
     * statement returns a <code>ResultSet</code> object,the second argument
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   783
     * supplied to this method is not an
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   784
     * <code>int</code> array whose elements are valid column indexes, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   785
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   787
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   788
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   789
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   790
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
    int executeUpdate(String sql, int columnIndexes[]) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * Executes the given SQL statement and signals the driver that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * auto-generated keys indicated in the given array should be made available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * for retrieval.   This array contains the names of the columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     * target table that contain the auto-generated keys that should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * available. The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * auto-generated keys (the list of such statements is vendor-specific).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   803
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   804
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   805
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * <code>DELETE</code>; or an SQL statement that returns nothing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * such as a DDL statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     * @param columnNames an array of the names of the columns that should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     *        returned from the inserted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     *         or <code>DELETE</code> statements, or 0 for SQL statements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     *         that return nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     *  this method is called on a closed <code>Statement</code>, the SQL
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   816
     *            statement returns a <code>ResultSet</code> object, the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     *            second argument supplied to this method is not a <code>String</code> array
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   818
     *            whose elements are valid column names, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   819
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   821
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   822
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   823
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   824
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
    int executeUpdate(String sql, String columnNames[]) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * Executes the given SQL statement, which may return multiple results,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * and signals the driver that any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * auto-generated keys should be made available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * for retrieval.  The driver will ignore this signal if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * In some (uncommon) situations, a single SQL statement may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * multiple result sets and/or update counts.  Normally you can ignore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * this unless you are (1) executing a stored procedure that you know may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * return multiple results or (2) you are dynamically executing an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * unknown SQL string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * The <code>execute</code> method executes an SQL statement and indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * form of the first result.  You must then use the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     * <code>getResultSet</code> or <code>getUpdateCount</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * to retrieve the result, and <code>getMoreResults</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     * move to any subsequent result(s).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   848
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   849
     *<strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   850
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * @param sql any SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * @param autoGeneratedKeys a constant indicating whether auto-generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     *        keys should be made available for retrieval using the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     *        <code>getGeneratedKeys</code>; one of the following constants:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     *        <code>Statement.RETURN_GENERATED_KEYS</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     *        <code>Statement.NO_GENERATED_KEYS</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     * @return <code>true</code> if the first result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     *         object; <code>false</code> if it is an update count or there are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     *         no results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   861
     * this method is called on a closed <code>Statement</code>, the second
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     *         parameter supplied to this method is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     *         <code>Statement.RETURN_GENERATED_KEYS</code> or
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   864
     *         <code>Statement.NO_GENERATED_KEYS</code>,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   865
     * the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   866
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * this method with a constant of Statement.RETURN_GENERATED_KEYS
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   869
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   870
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   871
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   872
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * @see #getResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * @see #getUpdateCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     * @see #getMoreResults
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
     * @see #getGeneratedKeys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
    boolean execute(String sql, int autoGeneratedKeys) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
     * Executes the given SQL statement, which may return multiple results,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
     * and signals the driver that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     * auto-generated keys indicated in the given array should be made available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * for retrieval.  This array contains the indexes of the columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * target table that contain the auto-generated keys that should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * available.  The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * Under some (uncommon) situations, a single SQL statement may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     * multiple result sets and/or update counts.  Normally you can ignore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * this unless you are (1) executing a stored procedure that you know may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * return multiple results or (2) you are dynamically executing an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * unknown SQL string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * The <code>execute</code> method executes an SQL statement and indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * form of the first result.  You must then use the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * <code>getResultSet</code> or <code>getUpdateCount</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * to retrieve the result, and <code>getMoreResults</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * move to any subsequent result(s).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   903
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   904
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   905
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * @param sql any SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * @param columnIndexes an array of the indexes of the columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     *        inserted row that should be  made available for retrieval by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     *        call to the method <code>getGeneratedKeys</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * @return <code>true</code> if the first result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     *         object; <code>false</code> if it is an update count or there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     *         are no results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   914
     * this method is called on a closed <code>Statement</code>, the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     *            elements in the <code>int</code> array passed to this method
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   916
     *            are not valid column indexes, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   917
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   919
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   920
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   921
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   922
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * @see #getResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * @see #getUpdateCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     * @see #getMoreResults
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
    boolean execute(String sql, int columnIndexes[]) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * Executes the given SQL statement, which may return multiple results,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     * and signals the driver that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * auto-generated keys indicated in the given array should be made available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * for retrieval. This array contains the names of the columns in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * target table that contain the auto-generated keys that should be made
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * available.  The driver will ignore the array if the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * auto-generated keys (the list of such statements is vendor-specific).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * In some (uncommon) situations, a single SQL statement may return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * multiple result sets and/or update counts.  Normally you can ignore
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     * this unless you are (1) executing a stored procedure that you know may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     * return multiple results or (2) you are dynamically executing an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * unknown SQL string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * The <code>execute</code> method executes an SQL statement and indicates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * form of the first result.  You must then use the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * <code>getResultSet</code> or <code>getUpdateCount</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * to retrieve the result, and <code>getMoreResults</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * move to any subsequent result(s).
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   952
     *<p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   953
     * <strong>Note:</strong>This method cannot be called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   954
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     * @param sql any SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * @param columnNames an array of the names of the columns in the inserted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     *        row that should be made available for retrieval by a call to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     *        method <code>getGeneratedKeys</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
     * @return <code>true</code> if the next result is a <code>ResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     *         object; <code>false</code> if it is an update count or there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     *         are no more results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * @exception SQLException if a database access error occurs,
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   963
     * this method is called on a closed <code>Statement</code>,the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     *          elements of the <code>String</code> array passed to this
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   965
     *          method are not valid column names, the method is called on a
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   966
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   968
     * @throws SQLTimeoutException when the driver has determined that the
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   969
     * timeout value that was specified by the {@code setQueryTimeout}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   970
     * method has been exceeded and has at least attempted to cancel
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
   971
     * the currently running {@code Statement}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * @see #getResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * @see #getUpdateCount
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     * @see #getMoreResults
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * @see #getGeneratedKeys
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
    boolean execute(String sql, String columnNames[]) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * Retrieves the result set holdability for <code>ResultSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * generated by this <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     *         <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     * this method is called on a closed <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
    int getResultSetHoldability() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * Retrieves whether this <code>Statement</code> object has been closed. A <code>Statement</code> is closed if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * method close has been called on it, or if it is automatically closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * @return true if this <code>Statement</code> object is closed; false if it is still open
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
    boolean isClosed() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
         * Requests that a <code>Statement</code> be pooled or not pooled.  The value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
         * specified is a hint to the statement pool implementation indicating
11016
e2665f4ac6d2 7110111: Minor Java SE javadoc & Constructor clean up
lancea
parents: 7797
diff changeset
  1006
         * whether the application wants the statement to be pooled.  It is up to
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
         * the statement pool manager as to whether the hint is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
         * The poolable value of a statement is applicable to both internal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
         * statement caches implemented by the driver and external statement caches
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
         * implemented by application servers and other applications.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
         * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
         * By default, a <code>Statement</code> is not poolable when created, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
         * a <code>PreparedStatement</code> and <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
         * are poolable when created.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1016
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
         * @param poolable              requests that the statement be pooled if true and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
         *                                              that the statement not be pooled if false
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1019
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
         * @throws SQLException if this method is called on a closed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
         * <code>Statement</code>
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1022
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
         * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
        void setPoolable(boolean poolable)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
                throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
         * Returns a  value indicating whether the <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
         * is poolable or not.
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1031
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
         * @return              <code>true</code> if the <code>Statement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
         * is poolable; <code>false</code> otherwise
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1034
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
         * @throws SQLException if this method is called on a closed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
         * <code>Statement</code>
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1037
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
         * @since 1.6
23590
ffd8b0b70511 8038493: Tidy warnings cleanup for java.sql
yan
parents: 21278
diff changeset
  1039
         *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
         * @see java.sql.Statement#setPoolable(boolean) setPoolable(boolean)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
        boolean isPoolable()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
                throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1045
    //--------------------------JDBC 4.1 -----------------------------
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1046
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1047
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1048
     * Specifies that this {@code Statement} will be closed when all its
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1049
     * dependent result sets are closed. If execution of the {@code Statement}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1050
     * does not produce any result sets, this method has no effect.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1051
     * <p>
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1052
     * <strong>Note:</strong> Multiple calls to {@code closeOnCompletion} do
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1053
     * not toggle the effect on this {@code Statement}. However, a call to
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1054
     * {@code closeOnCompletion} does effect both the subsequent execution of
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1055
     * statements, and statements that currently have open, dependent,
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1056
     * result sets.
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1057
     *
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1058
     * @throws SQLException if this method is called on a closed
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1059
     * {@code Statement}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1060
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1061
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1062
    public void closeOnCompletion() throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1063
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1064
    /**
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1065
     * Returns a value indicating whether this {@code Statement} will be
6684
2708e0ba15a8 6987638: javadoc update to RowSetProvider and Statement
lancea
parents: 6540
diff changeset
  1066
     * closed when all its dependent result sets are closed.
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1067
     * @return {@code true} if the {@code Statement} will be closed when all
6684
2708e0ba15a8 6987638: javadoc update to RowSetProvider and Statement
lancea
parents: 6540
diff changeset
  1068
     * of its dependent result sets are closed; {@code false} otherwise
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1069
     * @throws SQLException if this method is called on a closed
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1070
     * {@code Statement}
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1071
     * @since 1.7
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1072
     */
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1073
    public boolean isCloseOnCompletion() throws SQLException;
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 5506
diff changeset
  1074
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1075
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1076
    //--------------------------JDBC 4.2 -----------------------------
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1077
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1078
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1079
     *  Retrieves the current result as an update count; if the result
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1080
     * is a <code>ResultSet</code> object or there are no more results, -1
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1081
     *  is returned. This method should be called only once per result.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1082
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1083
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1084
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1085
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1086
     * The default implementation will throw {@code UnsupportedOperationException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1087
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1088
     * @return the current result as an update count; -1 if the current result
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1089
     * is a <code>ResultSet</code> object or there are no more results
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1090
     * @exception SQLException if a database access error occurs or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1091
     * this method is called on a closed <code>Statement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1092
     * @see #execute
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1093
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1094
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1095
    default long getLargeUpdateCount() throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1096
        throw new UnsupportedOperationException("getLargeUpdateCount not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1097
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1098
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1099
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1100
     * Sets the limit for the maximum number of rows that any
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1101
     * <code>ResultSet</code> object  generated by this <code>Statement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1102
     * object can contain to the given number.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1103
     * If the limit is exceeded, the excess
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1104
     * rows are silently dropped.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1105
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1106
     * This method should be used when the row limit may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1107
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1108
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1109
     * The default implementation will throw {@code UnsupportedOperationException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1110
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1111
     * @param max the new max rows limit; zero means there is no limit
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1112
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1113
     * this method is called on a closed <code>Statement</code>
18156
edb590d448c5 8016217: More javadoc warnings
alanb
parents: 15284
diff changeset
  1114
     *            or the condition {@code max >= 0} is not satisfied
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1115
     * @see #getMaxRows
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1116
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1117
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1118
    default void setLargeMaxRows(long max) throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1119
        throw new UnsupportedOperationException("setLargeMaxRows not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1120
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1121
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1122
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1123
     * Retrieves the maximum number of rows that a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1124
     * <code>ResultSet</code> object produced by this
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1125
     * <code>Statement</code> object can contain.  If this limit is exceeded,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1126
     * the excess rows are silently dropped.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1127
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1128
     * This method should be used when the returned row limit may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1129
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1130
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1131
     * The default implementation will return {@code 0}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1132
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1133
     * @return the current maximum number of rows for a <code>ResultSet</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1134
     *         object produced by this <code>Statement</code> object;
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1135
     *         zero means there is no limit
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1136
     * @exception SQLException if a database access error occurs or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1137
     * this method is called on a closed <code>Statement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1138
     * @see #setMaxRows
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1139
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1140
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1141
    default long getLargeMaxRows() throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1142
        return 0;
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1143
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1144
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1145
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1146
     * Submits a batch of commands to the database for execution and
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1147
     * if all commands execute successfully, returns an array of update counts.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1148
     * The <code>long</code> elements of the array that is returned are ordered
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1149
     * to correspond to the commands in the batch, which are ordered
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1150
     * according to the order in which they were added to the batch.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1151
     * The elements in the array returned by the method {@code executeLargeBatch}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1152
     * may be one of the following:
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1153
     * <OL>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1154
     * <LI>A number greater than or equal to zero -- indicates that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1155
     * command was processed successfully and is an update count giving the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1156
     * number of rows in the database that were affected by the command's
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1157
     * execution
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1158
     * <LI>A value of <code>SUCCESS_NO_INFO</code> -- indicates that the command was
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1159
     * processed successfully but that the number of rows affected is
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1160
     * unknown
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1161
     * <P>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1162
     * If one of the commands in a batch update fails to execute properly,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1163
     * this method throws a <code>BatchUpdateException</code>, and a JDBC
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1164
     * driver may or may not continue to process the remaining commands in
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1165
     * the batch.  However, the driver's behavior must be consistent with a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1166
     * particular DBMS, either always continuing to process commands or never
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1167
     * continuing to process commands.  If the driver continues processing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1168
     * after a failure, the array returned by the method
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1169
     * <code>BatchUpdateException.getLargeUpdateCounts</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1170
     * will contain as many elements as there are commands in the batch, and
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1171
     * at least one of the elements will be the following:
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 18156
diff changeset
  1172
     *
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1173
     * <LI>A value of <code>EXECUTE_FAILED</code> -- indicates that the command failed
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1174
     * to execute successfully and occurs only if a driver continues to
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1175
     * process commands after a command fails
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1176
     * </OL>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1177
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1178
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1179
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1180
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1181
     * The default implementation will throw {@code UnsupportedOperationException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1182
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1183
     * @return an array of update counts containing one element for each
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1184
     * command in the batch.  The elements of the array are ordered according
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1185
     * to the order in which commands were added to the batch.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1186
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1187
     * this method is called on a closed <code>Statement</code> or the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1188
     * driver does not support batch statements. Throws {@link BatchUpdateException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1189
     * (a subclass of <code>SQLException</code>) if one of the commands sent to the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1190
     * database fails to execute properly or attempts to return a result set.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1191
     * @throws SQLTimeoutException when the driver has determined that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1192
     * timeout value that was specified by the {@code setQueryTimeout}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1193
     * method has been exceeded and has at least attempted to cancel
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1194
     * the currently running {@code Statement}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1195
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1196
     * @see #addBatch
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1197
     * @see DatabaseMetaData#supportsBatchUpdates
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1198
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1199
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1200
    default long[] executeLargeBatch() throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1201
        throw new UnsupportedOperationException("executeLargeBatch not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1202
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1203
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1204
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1205
     * Executes the given SQL statement, which may be an <code>INSERT</code>,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1206
     * <code>UPDATE</code>, or <code>DELETE</code> statement or an
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1207
     * SQL statement that returns nothing, such as an SQL DDL statement.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1208
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1209
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1210
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1211
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1212
     * <strong>Note:</strong>This method cannot be called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1213
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1214
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1215
     * The default implementation will throw {@code UnsupportedOperationException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1216
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1217
     * @param sql an SQL Data Manipulation Language (DML) statement,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1218
     * such as <code>INSERT</code>, <code>UPDATE</code> or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1219
     * <code>DELETE</code>; or an SQL statement that returns nothing,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1220
     * such as a DDL statement.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1221
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1222
     * @return either (1) the row count for SQL Data Manipulation Language
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1223
     * (DML) statements or (2) 0 for SQL statements that return nothing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1224
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1225
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1226
     * this method is called on a closed <code>Statement</code>, the given
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1227
     * SQL statement produces a <code>ResultSet</code> object, the method is called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1228
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1229
     * @throws SQLTimeoutException when the driver has determined that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1230
     * timeout value that was specified by the {@code setQueryTimeout}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1231
     * method has been exceeded and has at least attempted to cancel
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1232
     * the currently running {@code Statement}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1233
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1234
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1235
    default long executeLargeUpdate(String sql) throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1236
        throw new UnsupportedOperationException("executeLargeUpdate not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1237
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1238
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1239
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1240
     * Executes the given SQL statement and signals the driver with the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1241
     * given flag about whether the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1242
     * auto-generated keys produced by this <code>Statement</code> object
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1243
     * should be made available for retrieval.  The driver will ignore the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1244
     * flag if the SQL statement
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1245
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1246
     * auto-generated keys (the list of such statements is vendor-specific).
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1247
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1248
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1249
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1250
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1251
     * <strong>Note:</strong>This method cannot be called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1252
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1253
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1254
     * The default implementation will throw {@code SQLFeatureNotSupportedException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1255
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1256
     * @param sql an SQL Data Manipulation Language (DML) statement,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1257
     * such as <code>INSERT</code>, <code>UPDATE</code> or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1258
     * <code>DELETE</code>; or an SQL statement that returns nothing,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1259
     * such as a DDL statement.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1260
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1261
     * @param autoGeneratedKeys a flag indicating whether auto-generated keys
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1262
     *        should be made available for retrieval;
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1263
     *         one of the following constants:
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1264
     *         <code>Statement.RETURN_GENERATED_KEYS</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1265
     *         <code>Statement.NO_GENERATED_KEYS</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1266
     * @return either (1) the row count for SQL Data Manipulation Language (DML) statements
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1267
     *         or (2) 0 for SQL statements that return nothing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1268
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1269
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1270
     *  this method is called on a closed <code>Statement</code>, the given
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1271
     *            SQL statement returns a <code>ResultSet</code> object,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1272
     *            the given constant is not one of those allowed, the method is called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1273
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1274
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1275
     * this method with a constant of Statement.RETURN_GENERATED_KEYS
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1276
     * @throws SQLTimeoutException when the driver has determined that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1277
     * timeout value that was specified by the {@code setQueryTimeout}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1278
     * method has been exceeded and has at least attempted to cancel
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1279
     * the currently running {@code Statement}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1280
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1281
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1282
    default long executeLargeUpdate(String sql, int autoGeneratedKeys)
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1283
            throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1284
        throw new SQLFeatureNotSupportedException("executeLargeUpdate not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1285
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1286
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1287
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1288
     * Executes the given SQL statement and signals the driver that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1289
     * auto-generated keys indicated in the given array should be made available
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1290
     * for retrieval.   This array contains the indexes of the columns in the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1291
     * target table that contain the auto-generated keys that should be made
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1292
     * available. The driver will ignore the array if the SQL statement
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1293
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1294
     * auto-generated keys (the list of such statements is vendor-specific).
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1295
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1296
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1297
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1298
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1299
     * <strong>Note:</strong>This method cannot be called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1300
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1301
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1302
     * The default implementation will throw {@code SQLFeatureNotSupportedException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1303
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1304
     * @param sql an SQL Data Manipulation Language (DML) statement,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1305
     * such as <code>INSERT</code>, <code>UPDATE</code> or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1306
     * <code>DELETE</code>; or an SQL statement that returns nothing,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1307
     * such as a DDL statement.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1308
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1309
     * @param columnIndexes an array of column indexes indicating the columns
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1310
     *        that should be returned from the inserted row
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1311
     * @return either (1) the row count for SQL Data Manipulation Language (DML) statements
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1312
     *         or (2) 0 for SQL statements that return nothing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1313
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1314
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1315
     * this method is called on a closed <code>Statement</code>, the SQL
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1316
     * statement returns a <code>ResultSet</code> object,the second argument
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1317
     * supplied to this method is not an
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1318
     * <code>int</code> array whose elements are valid column indexes, the method is called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1319
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1320
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1321
     * @throws SQLTimeoutException when the driver has determined that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1322
     * timeout value that was specified by the {@code setQueryTimeout}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1323
     * method has been exceeded and has at least attempted to cancel
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1324
     * the currently running {@code Statement}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1325
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1326
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1327
    default long executeLargeUpdate(String sql, int columnIndexes[]) throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1328
        throw new SQLFeatureNotSupportedException("executeLargeUpdate not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1329
    }
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1330
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1331
    /**
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1332
     * Executes the given SQL statement and signals the driver that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1333
     * auto-generated keys indicated in the given array should be made available
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1334
     * for retrieval.   This array contains the names of the columns in the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1335
     * target table that contain the auto-generated keys that should be made
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1336
     * available. The driver will ignore the array if the SQL statement
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1337
     * is not an <code>INSERT</code> statement, or an SQL statement able to return
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1338
     * auto-generated keys (the list of such statements is vendor-specific).
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1339
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1340
     * This method should be used when the returned row count may exceed
15284
aa4ba8514e3d 8006642: Fix javadoc warnings due to Integer.MAX_VALUE
lancea
parents: 15278
diff changeset
  1341
     * {@link Integer#MAX_VALUE}.
15278
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1342
     * <p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1343
     * <strong>Note:</strong>This method cannot be called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1344
     * <code>PreparedStatement</code> or <code>CallableStatement</code>.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1345
     *<p>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1346
     * The default implementation will throw {@code SQLFeatureNotSupportedException}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1347
     *
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1348
     * @param sql an SQL Data Manipulation Language (DML) statement,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1349
     * such as <code>INSERT</code>, <code>UPDATE</code> or
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1350
     * <code>DELETE</code>; or an SQL statement that returns nothing,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1351
     * such as a DDL statement.
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1352
     * @param columnNames an array of the names of the columns that should be
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1353
     *        returned from the inserted row
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1354
     * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1355
     *         or <code>DELETE</code> statements, or 0 for SQL statements
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1356
     *         that return nothing
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1357
     * @exception SQLException if a database access error occurs,
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1358
     *  this method is called on a closed <code>Statement</code>, the SQL
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1359
     *            statement returns a <code>ResultSet</code> object, the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1360
     *            second argument supplied to this method is not a <code>String</code> array
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1361
     *            whose elements are valid column names, the method is called on a
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1362
     * <code>PreparedStatement</code> or <code>CallableStatement</code>
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1363
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1364
     * @throws SQLTimeoutException when the driver has determined that the
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1365
     * timeout value that was specified by the {@code setQueryTimeout}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1366
     * method has been exceeded and has at least attempted to cancel
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1367
     * the currently running {@code Statement}
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1368
     * @since 1.8
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1369
     */
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1370
    default long executeLargeUpdate(String sql, String columnNames[])
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1371
            throws SQLException {
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1372
        throw new SQLFeatureNotSupportedException("executeLargeUpdate not implemented");
e081d3f73b75 8005080: JDBC 4.2 Core changes
lancea
parents: 14342
diff changeset
  1373
    }
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1374
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1375
    // JDBC 4.3
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1376
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1377
    /**
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1378
     * Returns a {@code String} enclosed in single quotes. Any occurrence of a
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1379
     * single quote within the string will be replaced by two single quotes.
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1380
     *
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1381
     * <blockquote>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1382
     * <table class="striped">
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1383
     * <caption>Examples of the conversion:</caption>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1384
     * <thead>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1385
     * <tr><th scope="col">Value</th><th scope="col">Result</th></tr>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1386
     * </thead>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1387
     * <tbody style="text-align:center">
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1388
     * <tr> <th scope="row">Hello</th> <td>'Hello'</td> </tr>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1389
     * <tr> <th scope="row">G'Day</th> <td>'G''Day'</td> </tr>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1390
     * <tr> <th scope="row">'G''Day'</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1391
     * <td>'''G''''Day'''</td> </tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1392
     * <tr> <th scope="row">I'''M</th> <td>'I''''''M'</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1393
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1394
     *
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1395
     * </tbody>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1396
     * </table>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1397
     * </blockquote>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1398
     * @implNote
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1399
     * JDBC driver implementations may need to provide their own implementation
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1400
     * of this method in order to meet the requirements of the underlying
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1401
     * datasource.
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1402
     * @param val a character string
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1403
     * @return A string enclosed by single quotes with every single quote
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1404
     * converted to two single quotes
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1405
     * @throws NullPointerException if val is {@code null}
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1406
     * @throws SQLException if a database access error occurs
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1407
     *
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1408
     * @since 9
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1409
     */
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1410
     default String enquoteLiteral(String val)  throws SQLException {
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1411
         return "'" + val.replace("'", "''") +  "'";
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1412
    }
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1413
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1414
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1415
     /**
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1416
     * Returns a SQL identifier. If {@code identifier} is a simple SQL identifier:
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1417
     * <ul>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1418
     * <li>Return the original value if {@code alwaysQuote} is
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1419
     * {@code false}</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1420
     * <li>Return a delimited identifier if {@code alwaysQuote} is
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1421
     * {@code true}</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1422
     * </ul>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1423
     *
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1424
     * If {@code identifier} is not a simple SQL identifier, {@code identifier} will be
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1425
     * enclosed in double quotes if not already present. If the datasource does
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1426
     * not support double quotes for delimited identifiers, the
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1427
     * identifier should be enclosed by the string returned from
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1428
     * {@link DatabaseMetaData#getIdentifierQuoteString}.  If the datasource
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1429
     * does not support delimited identifiers, a
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1430
     * {@code SQLFeatureNotSupportedException} should be thrown.
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1431
     * <p>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1432
     * A {@code SQLException} will be thrown if {@code identifier} contains any
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1433
     * characters invalid in a delimited identifier or the identifier length is
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1434
     * invalid for the datasource.
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1435
     *
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1436
     * @implSpec
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1437
     * The default implementation uses the following criteria to
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1438
     * determine a valid simple SQL identifier:
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1439
     * <ul>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1440
     * <li>The string is not enclosed in double quotes</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1441
     * <li>The first character is an alphabetic character from a through z, or
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1442
     * from A through Z</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1443
     * <li>The name only contains alphanumeric characters or the character "_"</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1444
     * </ul>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1445
     *
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1446
     * The default implementation will throw a {@code SQLException} if:
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1447
     * <ul>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1448
     * <li>{@code identifier} contains a {@code null} character or double quote and is not
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1449
     * a simple SQL identifier.</li>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1450
     * <li>The length of {@code identifier} is less than 1 or greater than 128 characters
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1451
     * </ul>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1452
     * <blockquote>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1453
     * <table class="striped" >
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1454
     * <caption>Examples of the conversion:</caption>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1455
     * <thead>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1456
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1457
     * <th scope="col">identifier</th>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1458
     * <th scope="col">alwaysQuote</th>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1459
     * <th scope="col">Result</th></tr>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1460
     * </thead>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1461
     * <tbody>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1462
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1463
     * <th scope="row">Hello</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1464
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1465
     * <td>Hello</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1466
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1467
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1468
     * <th scope="row">Hello</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1469
     * <td>true</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1470
     * <td>"Hello"</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1471
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1472
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1473
     * <th scope="row">G'Day</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1474
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1475
     * <td>"G'Day"</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1476
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1477
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1478
     * <th scope="row">"Bruce Wayne"</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1479
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1480
     * <td>"Bruce Wayne"</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1481
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1482
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1483
     * <th scope="row">"Bruce Wayne"</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1484
     * <td>true</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1485
     * <td>"Bruce Wayne"</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1486
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1487
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1488
     * <th scope="row">GoodDay$</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1489
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1490
     * <td>"GoodDay$"</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1491
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1492
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1493
     * <th scope="row">Hello"World</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1494
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1495
     * <td>SQLException</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1496
     * </tr>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1497
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1498
     * <th scope="row">"Hello"World"</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1499
     * <td>false</td>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1500
     * <td>SQLException</td>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1501
     * </tr>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1502
     * </tbody>
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1503
     * </table>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1504
     * </blockquote>
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1505
     * @implNote
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1506
     * JDBC driver implementations may need to provide their own implementation
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1507
     * of this method in order to meet the requirements of the underlying
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1508
     * datasource.
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1509
     * @param identifier a SQL identifier
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1510
     * @param alwaysQuote indicates if a simple SQL identifier should be
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1511
     * returned as a quoted identifier
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1512
     * @return A simple SQL identifier or a delimited identifier
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1513
     * @throws SQLException if identifier is not a valid identifier
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1514
     * @throws SQLFeatureNotSupportedException if the datasource does not support
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1515
     * delimited identifiers
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1516
     * @throws NullPointerException if identifier is {@code null}
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1517
     *
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1518
     * @since 9
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1519
     */
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1520
    default String enquoteIdentifier(String identifier, boolean alwaysQuote) throws SQLException {
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1521
        int len = identifier.length();
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1522
        if (len < 1 || len > 128) {
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1523
            throw new SQLException("Invalid name");
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1524
        }
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1525
        if (Pattern.compile("[\\p{Alpha}][\\p{Alnum}_]*").matcher(identifier).matches()) {
33306
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1526
            return alwaysQuote ?  "\"" + identifier + "\"" : identifier;
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1527
        }
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1528
        if (identifier.matches("^\".+\"$")) {
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1529
            identifier = identifier.substring(1, len - 1);
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1530
        }
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1531
        if (Pattern.compile("[^\u0000\"]+").matcher(identifier).matches()) {
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1532
            return "\"" + identifier + "\"";
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1533
        } else {
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1534
            throw new SQLException("Invalid name");
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1535
        }
286b5548bab6 8139056: Add convenience methods to Statement.java
lancea
parents: 25859
diff changeset
  1536
    }
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1537
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1538
    /**
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1539
     * Retrieves whether {@code identifier} is a simple SQL identifier.
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1540
     *
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1541
     * @implSpec The default implementation uses the following criteria to
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1542
     * determine a valid simple SQL identifier:
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1543
     * <ul>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1544
     * <li>The string is not enclosed in double quotes</li>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1545
     * <li>The first character is an alphabetic character from a through z, or
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1546
     * from A through Z</li>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1547
     * <li>The string only contains alphanumeric characters or the character
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1548
     * "_"</li>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1549
     * <li>The string is between 1 and 128 characters in length inclusive</li>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1550
     * </ul>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1551
     *
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1552
     * <blockquote>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1553
     * <table class="striped" >
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1554
     * <caption>Examples of the conversion:</caption>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1555
     * <thead>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1556
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1557
     * <th scope="col">identifier</th>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1558
     * <th scope="col">Simple Identifier</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1559
     * </thead>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1560
     *
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1561
     * <tbody>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1562
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1563
     * <th scope="row">Hello</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1564
     * <td>true</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1565
     * </tr>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1566
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1567
     * <th scope="row">G'Day</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1568
     * <td>false</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1569
     * </tr>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1570
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1571
     * <th scope="row">"Bruce Wayne"</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1572
     * <td>false</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1573
     * </tr>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1574
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1575
     * <th scope="row">GoodDay$</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1576
     * <td>false</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1577
     * </tr>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1578
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1579
     * <th scope="row">Hello"World</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1580
     * <td>false</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1581
     * </tr>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1582
     * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1583
     * <th scope="row">"Hello"World"</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1584
     * <td>false</td>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1585
     * </tr>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1586
     * </tbody>
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1587
     * </table>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1588
     * </blockquote>
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1589
     * @implNote JDBC driver implementations may need to provide their own
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1590
     * implementation of this method in order to meet the requirements of the
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1591
     * underlying datasource.
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1592
     * @param identifier a SQL identifier
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1593
     * @return  true if  a simple SQL identifier, false otherwise
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1594
     * @throws NullPointerException if identifier is {@code null}
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1595
     * @throws SQLException if a database access error occurs
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1596
     *
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1597
     * @since 9
34337
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1598
     */
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1599
    default boolean isSimpleIdentifier(String identifier) throws SQLException {
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1600
        int len = identifier.length();
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1601
        return len >= 1 && len <= 128
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1602
                && Pattern.compile("[\\p{Alpha}][\\p{Alnum}_]*").matcher(identifier).matches();
b088bf935e4b 8143165: Add Statement.isSimpleIdentifier and update enquoteLiteral
lancea
parents: 33306
diff changeset
  1603
    }
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1604
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1605
    /**
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1606
    * Returns a {@code String} representing a National Character Set Literal
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1607
    * enclosed in single quotes and prefixed with a upper case letter N.
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1608
    * Any occurrence of a single quote within the string will be replaced
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1609
    * by two single quotes.
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1610
    *
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1611
    * <blockquote>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1612
    * <table class="striped">
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1613
    * <caption>Examples of the conversion:</caption>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1614
    * <thead>
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1615
    * <tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1616
    * <th scope="col">Value</th>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1617
    * <th scope="col">Result</th>
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1618
    * </tr>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1619
    * </thead>
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1620
    * <tbody>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1621
    * <tr> <th scope="row">Hello</th> <td>N'Hello'</td> </tr>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1622
    * <tr> <th scope="row">G'Day</th> <td>N'G''Day'</td> </tr>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1623
    * <tr> <th scope="row">'G''Day'</th>
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1624
    * <td>N'''G''''Day'''</td> </tr>
45885
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1625
    * <tr> <th scope="row">I'''M</th> <td>N'I''''''M'</td>
562fed91cd84 8184311: Update java.sql and java.sql.rowset API docs for accessibility
jjg
parents: 45126
diff changeset
  1626
    * <tr> <th scope="row">N'Hello'</th> <td>N'N''Hello'''</td> </tr>
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1627
    *
45126
9c8ac4361d9f 8180256: Fix HTML 5 issues in java.sql and java.sql.rowset modules
jjg
parents: 44256
diff changeset
  1628
    * </tbody>
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1629
    * </table>
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1630
    * </blockquote>
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1631
    * @implNote
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1632
    * JDBC driver implementations may need to provide their own implementation
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1633
    * of this method in order to meet the requirements of the underlying
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1634
    * datasource. An implementation of enquoteNCharLiteral may accept a different
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1635
    * set of characters than that accepted by the same drivers implementation of
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1636
    * enquoteLiteral.
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1637
    * @param val a character string
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1638
    * @return the result of replacing every single quote character in the
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1639
    * argument by two single quote characters where this entire result is
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1640
    * then prefixed with 'N'.
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1641
    * @throws NullPointerException if val is {@code null}
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1642
    * @throws SQLException if a database access error occurs
44256
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1643
    *
12050b22e372 8176721: @since value errors java.sql module
mli
parents: 34873
diff changeset
  1644
    * @since 9
34873
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1645
    */
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1646
    default String enquoteNCharLiteral(String val)  throws SQLException {
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1647
        return "N'" + val.replace("'", "''") +  "'";
5696afb07ba3 8144082: Add Statement.enquoteNCharLiteral
lancea
parents: 34337
diff changeset
  1648
   }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
}