src/java.sql.rowset/share/classes/javax/sql/rowset/JoinRowSet.java
author lancea
Wed, 13 Mar 2019 14:10:18 -0400
changeset 54106 9a90236ab64c
parent 47216 71c04702a3d5
permissions -rw-r--r--
8220253: Fix Headings in java.sql.rowset Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54106
9a90236ab64c 8220253: Fix Headings in java.sql.rowset
lancea
parents: 47216
diff changeset
     2
 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sql.rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import javax.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import javax.naming.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.math.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.sql.rowset.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * The <code>JoinRowSet</code> interface provides a mechanism for combining related
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * data from different <code>RowSet</code> objects into one <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * object, which represents an SQL <code>JOIN</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * In other words, a <code>JoinRowSet</code> object acts as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * container for the data from <code>RowSet</code> objects that form an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <code>JOIN</code> relationship.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * The <code>Joinable</code> interface provides the methods for setting,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * retrieving, and unsetting a match column, the basis for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * establishing an SQL <code>JOIN</code> relationship. The match column may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * alternatively be set by supplying it to the appropriate version of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <code>JointRowSet</code> method <code>addRowSet</code>.
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 5506
diff changeset
    50
 *
54106
9a90236ab64c 8220253: Fix Headings in java.sql.rowset
lancea
parents: 47216
diff changeset
    51
 * <h2>1.0 Overview</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * Disconnected <code>RowSet</code> objects (<code>CachedRowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * and implementations extending the <code>CachedRowSet</code> interface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * do not have a standard way to establish an SQL <code>JOIN</code> between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <code>RowSet</code> objects without the expensive operation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * reconnecting to the data source. The <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * interface is specifically designed to address this need.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * Any <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * can be added to a <code>JoinRowSet</code> object to become
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * part of an SQL <code>JOIN</code> relationship. This means that both connected
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * and disconnected <code>RowSet</code> objects can be part of a <code>JOIN</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <code>RowSet</code> objects operating in a connected environment
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * (<code>JdbcRowSet</code> objects) are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * encouraged to use the database to which they are already
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * connected to establish SQL <code>JOIN</code> relationships between
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * tables directly. However, it is possible for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * <code>JdbcRowSet</code> object to be added to a <code>JoinRowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * if necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * Any number of <code>RowSet</code> objects can be added to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * instance of <code>JoinRowSet</code> provided that they
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * can be related in an SQL <code>JOIN</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * By definition, the SQL <code>JOIN</code> statement is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * combine the data contained in two or more relational database tables based
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * upon a common attribute. The <code>Joinable</code> interface provides the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * for establishing a common attribute, which is done by setting a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <i>match column</i>. The match column commonly coincides with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * the primary key, but there is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * no requirement that the match column be the same as the primary key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * By establishing and then enforcing column matches,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * a <code>JoinRowSet</code> object establishes <code>JOIN</code> relationships
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * between <code>RowSet</code> objects without the assistance of an available
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * relational database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * The type of <code>JOIN</code> to be established is determined by setting
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * one of the <code>JoinRowSet</code> constants using the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * <code>setJoinType</code>. The following SQL <code>JOIN</code> types can be set:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *  <LI><code>CROSS_JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *  <LI><code>FULL_JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *  <LI><code>INNER_JOIN</code> - the default if no <code>JOIN</code> type has been set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *  <LI><code>LEFT_OUTER_JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *  <LI><code>RIGHT_OUTER_JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * </UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * Note that if no type is set, the <code>JOIN</code> will automatically be an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * inner join. The comments for the fields in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * <code>JoinRowSet</code> interface explain these <code>JOIN</code> types, which are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * standard SQL <code>JOIN</code> types.
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 5506
diff changeset
   100
 *
54106
9a90236ab64c 8220253: Fix Headings in java.sql.rowset
lancea
parents: 47216
diff changeset
   101
 * <h2>2.0 Using a <code>JoinRowSet</code> Object for Creating a <code>JOIN</code></h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * When a <code>JoinRowSet</code> object is created, it is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * The first <code>RowSet</code> object to be added becomes the basis for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * <code>JOIN</code> relationship.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * Applications must determine which column in each of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * <code>RowSet</code> objects to be added to the <code>JoinRowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * should be the match column. All of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * <code>RowSet</code> objects must contain a match column, and the values in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * each match column must be ones that can be compared to values in the other match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * columns. The columns do not have to have the same name, though they often do,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * and they do not have to store the exact same data type as long as the data types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * can be compared.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * <P>
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
   114
 * A match column can be set in two ways:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 *  <li>By calling the <code>Joinable</code> method <code>setMatchColumn</code><br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 *  This is the only method that can set the match column before a <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 *  object is added to a <code>JoinRowSet</code> object. The <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 *  must have implemented the <code>Joinable</code> interface in order to use the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 *  <code>setMatchColumn</code>. Once the match column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *  has been set, this method can be used to reset the match column at any time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 *  <li>By calling one of the versions of the <code>JoinRowSet</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 *  <code>addRowSet</code> that takes a column name or number (or an array of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 *  column names or numbers)<BR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 *  Four of the five <code>addRowSet</code> methods take a match column as a parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 *  These four methods set or reset the match column at the time a <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 *  object is being added to a <code>JoinRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * </ul>
54106
9a90236ab64c 8220253: Fix Headings in java.sql.rowset
lancea
parents: 47216
diff changeset
   129
 * <h2>3.0 Sample Usage</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * The following code fragment adds two <code>CachedRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * objects to a <code>JoinRowSet</code> object. Note that in this example,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * no SQL <code>JOIN</code> type is set, so the default <code>JOIN</code> type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * which is <i>INNER_JOIN</i>, is established.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * In the following code fragment, the table <code>EMPLOYEES</code>, whose match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * column is set to the first column (<code>EMP_ID</code>), is added to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * <code>JoinRowSet</code> object <i>jrs</i>. Then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * the table <code>ESSP_BONUS_PLAN</code>, whose match column is likewise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * the <code>EMP_ID</code> column, is added. When this second
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * table is added to <i>jrs</i>, only the rows in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * <code>ESSP_BONUS_PLAN</code> whose <code>EMP_ID</code> value matches an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * <code>EMP_ID</code> value in the <code>EMPLOYEES</code> table are added.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * In this case, everyone in the bonus plan is an employee, so all of the rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * in the table <code>ESSP_BONUS_PLAN</code> are added to the <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * object.  In this example, both <code>CachedRowSet</code> objects being added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * have implemented the <code>Joinable</code> interface and can therefore call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * the <code>Joinable</code> method <code>setMatchColumn</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 *     JoinRowSet jrs = new JoinRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 *     ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *     CachedRowSet empl = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 *     empl.populate(rs1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 *     empl.setMatchColumn(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 *     jrs.addRowSet(empl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 *     ResultSet rs2 = stmt.executeQuery("SELECT * FROM ESSP_BONUS_PLAN");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 *     CachedRowSet bonus = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 *     bonus.populate(rs2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 *     bonus.setMatchColumn(1); // EMP_ID is the first column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 *     jrs.addRowSet(bonus);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * At this point, <i>jrs</i> is an inside JOIN of the two <code>RowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * based on their <code>EMP_ID</code> columns. The application can now browse the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * combined data as if it were browsing one single <code>RowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * Because <i>jrs</i> is itself a <code>RowSet</code> object, an application can
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * navigate or modify it using <code>RowSet</code> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 *     jrs.first();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 *     int employeeID = jrs.getInt(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 *     String employeeName = jrs.getString(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * Note that because the SQL <code>JOIN</code> must be enforced when an application
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * adds a second or subsequent <code>RowSet</code> object, there
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * may be an initial degradation in performance while the <code>JOIN</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * being performed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * The following code fragment adds an additional <code>CachedRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * In this case, the match column (<code>EMP_ID</code>) is set when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * <code>CachedRowSet</code> object is added to the <code>JoinRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 *     ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 *     CachedRowSet fourO1k = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 *     four01k.populate(rs3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 *     jrs.addRowSet(four01k, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * The <code>JoinRowSet</code> object <i>jrs</i> now contains values from all three
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * tables. The data in each row in <i>four01k</i> in which the value for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * <code>EMP_ID</code> column matches a value for the <code>EMP_ID</code> column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * in <i>jrs</i> has been added to <i>jrs</i>.
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 5506
diff changeset
   195
 *
54106
9a90236ab64c 8220253: Fix Headings in java.sql.rowset
lancea
parents: 47216
diff changeset
   196
 * <h2>4.0 <code>JoinRowSet</code> Methods</h2>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * The <code>JoinRowSet</code> interface supplies several methods for adding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * <code>RowSet</code> objects and for getting information about the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * <code>JoinRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * <UL>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 *   <LI>Methods for adding one or more <code>RowSet</code> objects<BR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 *       These methods allow an application to add one <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 *       at a time or to add multiple <code>RowSet</code> objects at one time. In
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 *       either case, the methods may specify the match column for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 *       <code>RowSet</code> object being added.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 *   <LI>Methods for getting information<BR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 *       One method retrieves the <code>RowSet</code> objects in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 *       <code>JoinRowSet</code> object, and another method retrieves the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 *       <code>RowSet</code> names.  A third method retrieves either the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 *       <code>WHERE</code> clause used behind the scenes to form the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 *       <code>JOIN</code> or a text description of what the <code>WHERE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 *       clause does.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 *   <LI>Methods related to the type of <code>JOIN</code><BR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 *       One method sets the <code>JOIN</code> type, and five methods find out whether
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 *       the <code>JoinRowSet</code> object supports a given type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 *   <LI>A method to make a separate copy of the <code>JoinRowSet</code> object<BR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 *       This method creates a copy that can be persisted to the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 * </UL>
20880
1b610151b316 8026812: doclint clean up for java.sql and javax.sql
lancea
parents: 5506
diff changeset
   219
 *
24968
3308660aa3f2 8046389: Add missing @since tag under javax.sql.**
henryjen
parents: 23010
diff changeset
   220
 * @since 1.5
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
public interface JoinRowSet extends WebRowSet {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * object. If the <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * is the first to be added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * object, it forms the basis of the <code>JOIN</code> relationship to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * established.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * This method should be used only when the given <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * object already has a match column that was set with the <code>Joinable</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * method <code>setMatchColumn</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * Note: A <code>Joinable</code> object is any <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * that has implemented the <code>Joinable</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @param rowset the <code>RowSet</code> object that is to be added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *        <code>JoinRowSet</code> object; it must implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *        <code>Joinable</code> interface and have a match column set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @throws SQLException if (1) an empty rowset is added to the to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *         <code>JoinRowSet</code> object, (2) a match column has not been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *         set for <i>rowset</i>, or (3) <i>rowset</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *         violates the active <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @see Joinable#setMatchColumn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    public void addRowSet(Joinable rowset) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * object and sets the designated column as the match column for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * the <code>RowSet</code> object. If the <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * is the first to be added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * object, it forms the basis of the <code>JOIN</code> relationship to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * established.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * This method should be used when <i>RowSet</i> does not already have a match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * column set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @param rowset the <code>RowSet</code> object that is to be added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     *        <code>JoinRowSet</code> object; it may implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *        <code>Joinable</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @param columnIdx an <code>int</code> that identifies the column to become the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     *         match column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @throws SQLException if (1) <i>rowset</i> is an empty rowset or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *         (2) <i>rowset</i> violates the active <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * @see Joinable#unsetMatchColumn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public void addRowSet(RowSet rowset, int columnIdx) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * Adds <i>rowset</i> to this <code>JoinRowSet</code> object and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * sets the designated column as the match column. If <i>rowset</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * is the first to be added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * object, it forms the basis for the <code>JOIN</code> relationship to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * established.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * This method should be used when the given <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * does not already have a match column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @param rowset the <code>RowSet</code> object that is to be added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     *        <code>JoinRowSet</code> object; it may implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *        <code>Joinable</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @param columnName the <code>String</code> object giving the name of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *        column to be set as the match column
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @throws SQLException if (1) <i>rowset</i> is an empty rowset or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *         (2) the match column for <i>rowset</i> does not satisfy the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     *         conditions of the <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     public void addRowSet(RowSet rowset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                           String columnName) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * Adds one or more <code>RowSet</code> objects contained in the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * array of <code>RowSet</code> objects to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * object and sets the match column for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * each of the <code>RowSet</code> objects to the match columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * in the given array of column indexes. The first element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <i>columnIdx</i> is set as the match column for the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * <code>RowSet</code> object in <i>rowset</i>, the second element of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * <i>columnIdx</i> is set as the match column for the second element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * in <i>rowset</i>, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * The first <code>RowSet</code> object added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * object forms the basis for the <code>JOIN</code> relationship.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * This method should be used when the given <code>RowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * does not already have a match column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @param rowset an array of one or more <code>RowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *        to be added to the <code>JOIN</code>; it may implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     *        <code>Joinable</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * @param columnIdx an array of <code>int</code> values indicating the index(es)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *        of the columns to be set as the match columns for the <code>RowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *        objects in <i>rowset</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @throws SQLException if (1) an empty rowset is added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *         <code>JoinRowSet</code> object, (2) a match column is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *         for a <code>RowSet</code> object in <i>rowset</i>, or (3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *         a <code>RowSet</code> object being added violates the active
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *         <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    public void addRowSet(RowSet[] rowset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                          int[] columnIdx) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * Adds one or more <code>RowSet</code> objects contained in the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * array of <code>RowSet</code> objects to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * object and sets the match column for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * each of the <code>RowSet</code> objects to the match columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * in the given array of column names. The first element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * <i>columnName</i> is set as the match column for the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * <code>RowSet</code> object in <i>rowset</i>, the second element of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <i>columnName</i> is set as the match column for the second element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * in <i>rowset</i>, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * The first <code>RowSet</code> object added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * object forms the basis for the <code>JOIN</code> relationship.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * This method should be used when the given <code>RowSet</code> object(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * does not already have a match column.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @param rowset an array of one or more <code>RowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     *        to be added to the <code>JOIN</code>; it may implement the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     *        <code>Joinable</code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * @param columnName an array of <code>String</code> values indicating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     *        names of the columns to be set as the match columns for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     *        <code>RowSet</code> objects in <i>rowset</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * @throws SQLException if (1) an empty rowset is added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     *         <code>JoinRowSet</code> object, (2) a match column is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *         for a <code>RowSet</code> object in <i>rowset</i>, or (3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     *         a <code>RowSet</code> object being added violates the active
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *         <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    public void addRowSet(RowSet[] rowset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                          String[] columnName) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * Returns a <code>Collection</code> object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * <code>RowSet</code> objects that have been added to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * <code>JoinRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * This should return the 'n' number of RowSet contained
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 20880
diff changeset
   363
     * within the <code>JOIN</code> and maintain any updates that have occurred while in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * this union.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * @return a <code>Collection</code> object consisting of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     *        <code>RowSet</code> objects added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *        object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @throws SQLException if an error occurs generating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     *         <code>Collection</code> object to be returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public Collection<?> getRowSets() throws java.sql.SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * Returns a <code>String</code> array containing the names of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *         <code>RowSet</code> objects added to this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *         object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @return a <code>String</code> array of the names of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *         <code>RowSet</code> objects in this <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     *         object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @throws SQLException if an error occurs retrieving the names of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     *         the <code>RowSet</code> objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * @see CachedRowSet#setTableName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    public String[] getRowSetNames() throws java.sql.SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * Creates a new <code>CachedRowSet</code> object containing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * data in this <code>JoinRowSet</code> object, which can be saved
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * to a data source using the <code>SyncProvider</code> object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * the <code>CachedRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * If any updates or modifications have been applied to the JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * the CachedRowSet returned by the method will not be able to persist
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * it's changes back to the originating rows and tables in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * in the datasource. The CachedRowSet instance returned should not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * contain modification data and it should clear all properties of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * it's originating SQL statement. An application should reset the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * SQL statement using the <code>RowSet.setCommand</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * In order to allow changes to be persisted back to the datasource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * to the originating tables, the <code>acceptChanges</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * should be used and called on a JoinRowSet object instance. Implementations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * can leverage the internal data and update tracking in their
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * implementations to interact with the SyncProvider to persist any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @return a CachedRowSet containing the contents of the JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * @throws SQLException if an error occurs assembling the CachedRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * @see javax.sql.RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @see javax.sql.rowset.CachedRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @see javax.sql.rowset.spi.SyncProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public CachedRowSet toCachedRowSet() throws java.sql.SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * Indicates if CROSS_JOIN is supported by a JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @return true if the CROSS_JOIN is supported; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    public boolean supportsCrossJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * Indicates if INNER_JOIN is supported by a JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * @return true is the INNER_JOIN is supported; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    public boolean supportsInnerJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * Indicates if LEFT_OUTER_JOIN is supported by a JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * @return true is the LEFT_OUTER_JOIN is supported; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    public boolean supportsLeftOuterJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * Indicates if RIGHT_OUTER_JOIN is supported by a JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @return true is the RIGHT_OUTER_JOIN is supported; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    public boolean supportsRightOuterJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * Indicates if FULL_JOIN is supported by a JoinRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * @return true is the FULL_JOIN is supported; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    public boolean supportsFullJoin();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * Allow the application to adjust the type of <code>JOIN</code> imposed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * on tables contained within the JoinRowSet object instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * Implementations should throw a SQLException if they do
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * not support a given <code>JOIN</code> type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @param joinType the standard JoinRowSet.XXX static field definition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * of a SQL <code>JOIN</code> to re-configure a JoinRowSet instance on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * the fly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * @throws SQLException if an unsupported <code>JOIN</code> type is set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * @see #getJoinType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    public void setJoinType(int joinType) throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * Return a SQL-like description of the WHERE clause being used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * in a JoinRowSet object. An implementation can describe
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * the WHERE clause of the SQL <code>JOIN</code> by supplying a SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * strings description of <code>JOIN</code> or provide a textual
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * description to assist applications using a <code>JoinRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * @return whereClause a textual or SQL description of the logical
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * WHERE clause used in the JoinRowSet instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * @throws SQLException if an error occurs in generating a representation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * of the WHERE clause.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    public String getWhereClause() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * Returns a <code>int</code> describing the set SQL <code>JOIN</code> type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * governing this JoinRowSet instance. The returned type will be one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * standard JoinRowSet types: <code>CROSS_JOIN</code>, <code>INNER_JOIN</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * <code>LEFT_OUTER_JOIN</code>, <code>RIGHT_OUTER_JOIN</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * <code>FULL_JOIN</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * @return joinType one of the standard JoinRowSet static field
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     *     definitions of a SQL <code>JOIN</code>. <code>JoinRowSet.INNER_JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     *     is returned as the default <code>JOIN</code> type is no type has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     *     explicitly set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * @throws SQLException if an error occurs determining the SQL <code>JOIN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     *     type supported by the JoinRowSet instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @see #setJoinType
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    public int getJoinType() throws SQLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * An ANSI-style <code>JOIN</code> providing a cross product of two tables
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    public static int CROSS_JOIN = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * An ANSI-style <code>JOIN</code> providing a inner join between two tables. Any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * unmatched rows in either table of the join should be discarded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    public static int INNER_JOIN = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * An ANSI-style <code>JOIN</code> providing a left outer join between two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * tables. In SQL, this is described where all records should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * returned from the left side of the JOIN statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    public static int LEFT_OUTER_JOIN = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * An ANSI-style <code>JOIN</code> providing a right outer join between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     * two tables. In SQL, this is described where all records from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     * table on the right side of the JOIN statement even if the table
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * on the left has no matching record.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    public static int RIGHT_OUTER_JOIN = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    /**
25976
4de01a56e3ee 8054555: javadoc cleanup for java.sql and javax.sql
lancea
parents: 24968
diff changeset
   530
     * An ANSI-style <code>JOIN</code> providing a full JOIN. Specifies that all
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * rows from either table be returned regardless of matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * records on the other table.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    public static int FULL_JOIN = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
}