JavaTM 2 Platform
Standard Ed. 6

javax.sql.rowset
接口 JoinRowSet

所有超级接口:
CachedRowSet, Joinable, ResultSet, RowSet, WebRowSet, Wrapper

public interface JoinRowSet
extends WebRowSet

JoinRowSet 接口提供了一种机制,用于将取自不同 RowSet 对象的相关数据组合到一个 JoinRowSet 对象中,该对象表示一个 SQL JOIN。换句话说,JoinRowSet 对象可作为一个数据容器,这些数据取自那些形成 SQL JOIN 关系的 RowSet 对象。

Joinable 接口提供了一些用于设置、获取和取消设置匹配列的方法,匹配列建立 SQL JOIN 关系的基础。通过将匹配列提供给恰当形式的 JointRowSet 方法 addRowSet 也可设置匹配列。

1.0 概述

无连接的 RowSet 对象(CachedRowSet 对象和扩展 CachedRowSet 接口的实现)没有一种能在 RowSet 之间建立 SQL JOIN且无需重新连接数据源(该操作开销很大)的标准方式。JoinRowSet 接口是专门为解决这一需求而设计的。

任何 RowSet 对象都可添加到 JoinRowSet 对象,以成为 SQL JOIN 关系的一部分。这意味着已连接和无连接的 RowSet 对象都可成为 JOIN 的一部分。鼓励在连接环境中运行的 RowSet 对象(JdbcRowSet 对象)使用它们已连接的数据库直接在表之间建立 SQL JOIN 关系。但必要时也可以将 JdbcRowSet 对象添加到 JoinRowSet 对象中。

可将任意数目的 RowSet 对象添加到 JoinRowSet 的实例中,前提是只要这些对象可以在 SQL JOIN 中关联起来。根据定义,SQL JOIN 语句用于将两个或多个基于某个公共属性的关系数据库表中所包含的数据组合在一起。Joinable 接口提供了用于建立公共属性的方法,可通过设置匹配列 来建立。匹配列通常与主键相符,但是不要求匹配列与主键相同。通过建立然后强制执行匹配列,JoinRowSet 对象可在 RowSet 对象之间建立 JOIN 关系,无需可用关系型数据库的协助。

可通过使用方法 setJoinType 设置某个 JoinRowSet 常量来确定要建立的 JOIN 的类型。可设置以下 SQL JOIN 类型:

注意,如果未设置类型,则 JOIN 将自动为 INNER_JOIN。JoinRowSet 接口中各字段的注释说明了这些 JOIN 类型,它们都是标准的 SQL JOIN 类型。

2.0 使用 JoinRowSet 对象创建 JOIN

当创建了一个 JoinRowSet 对象时,它是空的。要添加的第一个 RowSet 对象将成为 JOIN 关系的基础。应用程序必须确定在要添加到 JoinRowSet 对象的每个 RowSet 对象中,哪个列应该是匹配列。所有的 RowSet 对象必须包含匹配列,并且每个匹配列中的值必须可以与其他匹配列中的值相比较。这些列不必有相同的名称(虽然通常它们的名称相同),只要数据类型是可比较的,它们也不必存储完全相同的数据类型。

可用两种方式来设置匹配列:

3.0 示例用法

以下代码片断将两个 CachedRowSet 对象添加到 JoinRowSet 对象中。注意,在此示例中未设置 SQL JOIN 类型,所以建立了默认的 JOIN 类型,即 INNER_JOIN

在以下代码片断中,表 EMPLOYEES 被添加到 JoinRowSet 对象 jrs 中,该表的匹配列被设置为第一列 (EMP_ID)。然后添加表 ESSP_BONUS_PLAN,其匹配列同样是 EMP_ID 列。将第二个表添加到 jrs 时,只添加 EMP_ID 值匹配 EMPLOYEESEMP_ID 值的 ESSP_BONUS_PLAN 中的行。在这种情况下,红利分配中的所有人都是雇员,所以表 ESSP_BONUS_PLAN 中的所有行都被添加 JoinRowSet 对象中。在此示例中,两个被添加的 CachedRowSet 对象都已实现了 Joinable 接口,因此都可调用 Joinable 方法 setMatchColumn

     JoinRowSet jrs = new JoinRowSetImpl();
 
     ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES");
     CachedRowSet empl = new CachedRowSetImpl();
     empl.populate(rs1);
     empl.setMatchColumn(1); 
     jrs.addRowSet(empl);
 
     ResultSet rs2 = stmt.executeQuery("SELECT * FROM ESSP_BONUS_PLAN");
     CachedRowSet bonus = new CachedRowSetImpl();
     bonus.populate(rs2);
     bonus.setMatchColumn(1); // EMP_ID is the first column
     jrs.addRowSet(bonus);
 

此时,jrs 是两个 RowSet 对象基于其 EMP_ID 列的内部 JOIN。应用程序现在可以浏览已组合的数据,就好像在浏览单个 RowSet 对象一样。因为 jrs 本身是一个 RowSet 对象,所以应用程序可以使用 RowSet 方法浏览或修改它。

     jrs.first();
     int employeeID = jrs.getInt(1);
     String employeeName = jrs.getString(2);
 

注意,因为在应用程序添加第二个或后续 RowSet 对象时必须强制执行 SQL JOIN,所以在执行 JOIN 时最初会出现性能下降。

以下代码片断添加了一个附加 CachedRowSet 对象。在这种情况下,将 CachedRowSet 对象添加到 JoinRowSet 对象时设置匹配列 (EMP_ID)。

     ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB");
     CachedRowSet fourO1k = new CachedRowSetImpl();
     four01k.populate(rs3);
     jrs.addRowSet(four01k, 1);
 

JoinRowSet 对象 jrs 现在包含取自所有三个表的值。EMP_ID 列值匹配 jrsEMP_ID 列值的 four01k 中的每行数据都被添加到 jrs

4.0 JoinRowSet 方法

JoinRowSet 接口提供了多种方法用于添加 RowSet 对象和获得有关 JoinRowSet 对象的信息。


字段摘要
static int CROSS_JOIN
          ANSI 风格的 JOIN,提供两个表的交叉乘积。
static int FULL_JOIN
          ANSI 风格的 JOIN,提供一个完全 JOIN。
static int INNER_JOIN
          ANSI 风格的 JOIN,提供两个表之间的内联合 (inner join)。
static int LEFT_OUTER_JOIN
          ANSI 风格的 JOIN,提供两个表之间的左外联合 (left outer join)。
static int RIGHT_OUTER_JOIN
          ANSI 风格的 JOIN,提供两个表之间的右外联合 (right outer join)。
 
从接口 javax.sql.rowset.WebRowSet 继承的字段
PUBLIC_XML_SCHEMA, SCHEMA_SYSTEM_ID
 
从接口 javax.sql.rowset.CachedRowSet 继承的字段
COMMIT_ON_ACCEPT_CHANGES
 
从接口 java.sql.ResultSet 继承的字段
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
 
方法摘要
 void addRowSet(Joinable rowset)
          将给定的 RowSet 对象添加到此 JoinRowSet 对象。
 void addRowSet(RowSet[] rowset, int[] columnIdx)
          将给定 RowSet 对象数组中包含的一个或多个 RowSet 对象添加到此 JoinRowSet 对象,并且将每个 RowSet 对象的匹配列设置为给定列索引数组中的匹配列。
 void addRowSet(RowSet[] rowset, String[] columnName)
          将给定 RowSet 对象数组中包含的一个或多个 RowSet 对象添加到此 JoinRowSet 对象,并且将每个 RowSet 对象的匹配列设置为给定列名数组中的匹配列。
 void addRowSet(RowSet rowset, int columnIdx)
          将给定的 RowSet 对象添加到此 JoinRowSet 对象,并将指定的列设置为 RowSet 对象的匹配列。
 void addRowSet(RowSet rowset, String columnName)
          将 rowset 添加到此 JoinRowSet 对象,并将指定的列设置为匹配列。
 int getJoinType()
          返回一个 int 值,它描述控制此 JoinRowSet 实例的已设置 SQL JOIN 类型。
 String[] getRowSetNames()
          返回一个 String 数组,包含添加到此 JoinRowSet 对象的 RowSet 对象的名称。
 Collection<?> getRowSets()
          返回一个 Collection 对象,包含已经添加到此 JoinRowSet 对象的 RowSet 对象。
 String getWhereClause()
          返回在 JoinRowSet 对象中使用的 WHERE 子句的类似 SQL 的描述。
 void setJoinType(int joinType)
          允许应用程序调整在 JoinRowSet 对象实例包含的表上强制应用的 JOIN 类型。
 boolean supportsCrossJoin()
          指示 JoinRowSet 实现是否支持 CROSS_JOIN。
 boolean supportsFullJoin()
          指示 JoinRowSet 实现是否支持 FULL_JOIN。
 boolean supportsInnerJoin()
          指示 JoinRowSet 实现是否支持 INNER_JOIN。
 boolean supportsLeftOuterJoin()
          指示 JoinRowSet 实现是否支持 LEFT_OUTER_JOIN。
 boolean supportsRightOuterJoin()
          指示 JoinRowSet 实现是否支持 RIGHT_OUTER_JOIN。
 CachedRowSet toCachedRowSet()
          创建一个包含此 JoinRowSet 对象中数据的新 CachedRowSet 对象,可以使用 CachedRowSet 对象的 SyncProvider 对象将此 JoinRowSet 对象保存到数据源。
 
从接口 javax.sql.rowset.WebRowSet 继承的方法
readXml, readXml, writeXml, writeXml, writeXml, writeXml
 
从接口 javax.sql.rowset.CachedRowSet 继承的方法
acceptChanges, acceptChanges, columnUpdated, columnUpdated, commit, createCopy, createCopyNoConstraints, createCopySchema, createShared, execute, getKeyColumns, getOriginal, getOriginalRow, getPageSize, getRowSetWarnings, getShowDeleted, getSyncProvider, getTableName, nextPage, populate, populate, previousPage, release, restoreOriginal, rollback, rollback, rowSetPopulated, setKeyColumns, setMetaData, setOriginalRow, setPageSize, setShowDeleted, setSyncProvider, setTableName, size, toCollection, toCollection, toCollection, undoDelete, undoInsert, undoUpdate
 
从接口 javax.sql.RowSet 继承的方法
addRowSetListener, clearParameters, execute, getCommand, getDataSourceName, getEscapeProcessing, getMaxFieldSize, getMaxRows, getPassword, getQueryTimeout, getTransactionIsolation, getTypeMap, getUrl, getUsername, isReadOnly, removeRowSetListener, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBlob, setBlob, setBlob, setBoolean, setBoolean, setByte, setByte, setBytes, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setClob, setClob, setClob, setCommand, setConcurrency, setDataSourceName, setDate, setDate, setDate, setDate, setDouble, setDouble, setEscapeProcessing, setFloat, setFloat, setInt, setInt, setLong, setLong, setMaxFieldSize, setMaxRows, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNClob, setNClob, setNClob, setNString, setNString, setNull, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setObject, setPassword, setQueryTimeout, setReadOnly, setRef, setRowId, setRowId, setShort, setShort, setSQLXML, setSQLXML, setString, setString, setTime, setTime, setTime, setTime, setTimestamp, setTimestamp, setTimestamp, setTimestamp, setTransactionIsolation, setType, setTypeMap, setURL, setUrl, setUsername
 
从接口 java.sql.ResultSet 继承的方法
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
 
从接口 java.sql.Wrapper 继承的方法
isWrapperFor, unwrap
 
从接口 javax.sql.rowset.Joinable 继承的方法
getMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn
 

字段详细信息

CROSS_JOIN

static final int CROSS_JOIN
ANSI 风格的 JOIN,提供两个表的交叉乘积。

另请参见:
常量字段值

INNER_JOIN

static final int INNER_JOIN
ANSI 风格的 JOIN,提供两个表之间的内联合 (inner join)。任一联合表中的所有不匹配列都应被丢弃。

另请参见:
常量字段值

LEFT_OUTER_JOIN

static final int LEFT_OUTER_JOIN
ANSI 风格的 JOIN,提供两个表之间的左外联合 (left outer join)。在 SQL 中,这可描述为应该从 JOIN 语句左侧表中返回所有记录的情况。

另请参见:
常量字段值

RIGHT_OUTER_JOIN

static final int RIGHT_OUTER_JOIN
ANSI 风格的 JOIN,提供两个表之间的右外联合 (right outer join)。在 SQL 中,这可描述为即使左侧的表没有匹配记录的情况下也应该从 JOIN 语句右侧表中返回所有记录的情况。

另请参见:
常量字段值

FULL_JOIN

static final int FULL_JOIN
ANSI 风格的 JOIN,提供一个完全 JOIN。指定不管在另一个表上是否有匹配的记录,都会返回任一表中的所有行。

另请参见:
常量字段值
方法详细信息

addRowSet

void addRowSet(Joinable rowset)
               throws SQLException
将给定的 RowSet 对象添加到此 JoinRowSet 对象。如果该 RowSet 对象是第一个添加到此 JoinRowSet 对象中的对象,则它形成要建立的 JOIN 关系的基础。

仅在给定的 RowSet 对象已经具有使用 Joinable 方法 setMatchColumn 所设置的匹配列时才应该使用此方法。

注:Joinable 是所有已经实现了 Joinable 接口的 RowSet 对象。

参数:
rowset - 要添加到此 JoinRowSet 对象的 RowSet 对象;它必须实现 Joinable 接口并且具有已设置的匹配列
抛出:
SQLException - 如果 (1) 将空的 rowset 添加到此 JoinRowSet 对象,(2) 尚未设置 rowset 的匹配列,或 (3) rowset 违反了活动状态的 JOIN
另请参见:
Joinable.setMatchColumn(int)

addRowSet

void addRowSet(RowSet rowset,
               int columnIdx)
               throws SQLException
将给定的 RowSet 对象添加到此 JoinRowSet 对象,并将指定的列设置为 RowSet 对象的匹配列。如果该 RowSet 对象是第一个添加到此 JoinRowSet 对象中的对象,则它形成要建立的 JOIN 关系的基础。

当尚未设置 RowSet 的匹配列时才应使用此方法。

参数:
rowset - 要添加到此 JoinRowSet 对象的 RowSet 对象;它可以实现 Joinable 接口
columnIdx - 一个 int 值,它标识要成为匹配列的列
抛出:
SQLException - 如果 (1) rowset 是一个空 rowset 或 (2) rowset 违反了活动状态的 JOIN
另请参见:
Joinable.unsetMatchColumn(int)

addRowSet

void addRowSet(RowSet rowset,
               String columnName)
               throws SQLException
rowset 添加到此 JoinRowSet 对象,并将指定的列设置为匹配列。如果 rowset 是第一个添加到此 JoinRowSet 对象中的对象,则它形成要建立的 JOIN 关系的基础。

当给定的 RowSet 对象还没有匹配列时应该使用此方法。

参数:
rowset - 要添加到此 JoinRowSet 对象的 RowSet 对象;它可以实现 Joinable 接口
columnName - String 对象,它提供要设置为匹配列的列名
抛出:
SQLException - 如果 (1) rowset 是一个空 rowset 或 (2) rowset 的匹配列不满足 JOIN 的条件

addRowSet

void addRowSet(RowSet[] rowset,
               int[] columnIdx)
               throws SQLException
将给定 RowSet 对象数组中包含的一个或多个 RowSet 对象添加到此 JoinRowSet 对象,并且将每个 RowSet 对象的匹配列设置为给定列索引数组中的匹配列。将 columnIdx 中的第一个元素设置为 rowset 中第一个 RowSet 对象的匹配列,将 columnIdx 中的第二个元素设置为 rowset 中第二个元素的匹配列,依此类推。

添加到此 JoinRowSet 对象的第一个 RowSet 对象形成 JOIN 关系的基础。

当给定的 RowSet 对象还没有匹配列时应该使用此方法。

参数:
rowset - 要添加到 JOIN 的一个或多个 RowSet 对象所组成的数组;它可以实现 Joinable 接口
columnIdx - 一个 int 值数组,指示要设置为 rowsetRowSet 对象的匹配列的列索引
抛出:
SQLException - 如果 (1) 将空的 rowset 添加到此 JoinRowSet 对象,(2) 没有设置 rowsetRowSet 对象的匹配列,或 (3) 要添加的 RowSet 对象违反了活动状态的 JOIN

addRowSet

void addRowSet(RowSet[] rowset,
               String[] columnName)
               throws SQLException
将给定 RowSet 对象数组中包含的一个或多个 RowSet 对象添加到此 JoinRowSet 对象,并且将每个 RowSet 对象的匹配列设置为给定列名数组中的匹配列。将 columnName 中的第一个元素设置为 rowset 中第一个 RowSet 对象的匹配列,将 columnName 中的第二个元素设置为 rowset 中第二个元素的匹配列,依此类推。

添加到此 JoinRowSet 对象的第一个 RowSet 对象形成 JOIN 关系的基础。

当给定的 RowSet 对象还没有匹配列时应该使用此方法。

参数:
rowset - 要添加到 JOIN 的一个或多个 RowSet 对象所组成的数组;它可以实现 Joinable 接口
columnName - 一个 String 值数组,指示要设置为 rowsetRowSet 对象的匹配列的列名
抛出:
SQLException - 如果 (1) 将空的 rowset 添加到此 JoinRowSet 对象,(2) 没有设置 rowsetRowSet 对象的匹配列,或 (3) 要添加的 RowSet 对象违反了活动状态的 JOIN

getRowSets

Collection<?> getRowSets()
                         throws SQLException
返回一个 Collection 对象,包含已经添加到此 JoinRowSet 对象的 RowSet 对象。此方法应该返回 JOIN 内包含的 'n' 个 RowSet 并维持此并集中出现的所有更新。

返回:
一个 Collection 对象,由添加到此 JoinRowSet 对象的 RowSet 对象组成
抛出:
SQLException - 如果生成要返回的 Collection 对象时发生错误

getRowSetNames

String[] getRowSetNames()
                        throws SQLException
返回一个 String 数组,包含添加到此 JoinRowSet 对象的 RowSet 对象的名称。

返回:
JoinRowSet 对象中的 RowSet 对象名所组成的 String 数组
抛出:
SQLException - 如果获取 RowSet 对象的名称时发生错误
另请参见:
CachedRowSet.setTableName(java.lang.String)

toCachedRowSet

CachedRowSet toCachedRowSet()
                            throws SQLException
创建一个包含此 JoinRowSet 对象中数据的新 CachedRowSet 对象,可以使用 CachedRowSet 对象的 SyncProvider 对象将此 JoinRowSet 对象保存到数据源。

如果对 JoinRowSet 进行了任何更新或修改,则该方法返回的 CachedRowSet 无法使其更改与数据源中的原始行和表保持一致。返回的 CachedRowSet 实例不应包含修改数据,并且应该清除其原始 SQL 语句的所有属性。应用程序应该使用 RowSet.setCommand 方法重置 SQL 语句。

要允许更改与数据源中的原始表保持一致,应该使用 acceptChanges 方法并对 JoinRowSet 对象实例调用该方法。实现可以利用在其中跟踪的内部数据和更新来与 SyncProvider 进行交互,以保持所有更改不变。

返回:
包含 JoinRowSet 内容的 CachedRowSet
抛出:
SQLException - 如果组合 CachedRowSet 对象时发生错误
另请参见:
RowSet, CachedRowSet, SyncProvider

supportsCrossJoin

boolean supportsCrossJoin()
指示 JoinRowSet 实现是否支持 CROSS_JOIN。

返回:
如果支持 CROSS_JOIN,则返回 true;否则返回 false

supportsInnerJoin

boolean supportsInnerJoin()
指示 JoinRowSet 实现是否支持 INNER_JOIN。

返回:
如果支持 INNER_JOIN,则返回 true;否则返回 false

supportsLeftOuterJoin

boolean supportsLeftOuterJoin()
指示 JoinRowSet 实现是否支持 LEFT_OUTER_JOIN。

返回:
如果支持 LEFT_OUTER_JOIN,则返回 true;否则返回 false

supportsRightOuterJoin

boolean supportsRightOuterJoin()
指示 JoinRowSet 实现是否支持 RIGHT_OUTER_JOIN。

返回:
如果支持 RIGHT_OUTER_JOIN,则返回 true;否则返回 false

supportsFullJoin

boolean supportsFullJoin()
指示 JoinRowSet 实现是否支持 FULL_JOIN。

返回:
如果支持 FULL_JOIN,则返回 true;否则返回 false

setJoinType

void setJoinType(int joinType)
                 throws SQLException
允许应用程序调整在 JoinRowSet 对象实例包含的表上强制应用的 JOIN 类型。如果实现不支持给定的 JOIN 类型,则应抛出 SQLException。

参数:
joinType - SQL JOIN 的标准 JoinRowSet.XXX 静态字段定义,用来在运行过程中重新配置 JoinRowSet 实例。
抛出:
SQLException - 如果设置了不支持的 JOIN 类型
另请参见:
getJoinType()

getWhereClause

String getWhereClause()
                      throws SQLException
返回在 JoinRowSet 对象中使用的 WHERE 子句的类似 SQL 的描述。通过提供 JOIN 的 SQL 字符串描述或一个文本描述,一个实现可以描述 SQL JOIN 的 WHERE 子句,以协助应用程序使用 JoinRowSet

返回:
whereClause,JoinRowSet 实例中使用的逻辑 WHERE 子句的文本或 SQL 描述
抛出:
SQLException - 如果生成 WHERE 子句的表示形式时发生错误。

getJoinType

int getJoinType()
                throws SQLException
返回一个 int 值,它描述控制此 JoinRowSet 实例的已设置 SQL JOIN 类型。返回的类型是标准的 JoinRowSet 类型之一:CROSS_JOININNER_JOINLEFT_OUTER_JOINRIGHT_OUTER_JOINFULL_JOIN

返回:
joinType,SQL JOIN 的某个标准 JoinRowSet 静态字段定义。在没有显式设置类型时,将 JoinRowSet.INNER_JOIN 作为默认的 JOIN 类型返回。
抛出:
SQLException - 如果在确定该 JoinRowSet 实例支持的 SQL JOIN 类型时发生错误。
另请参见:
setJoinType(int)

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only