public interface JoinRowSet extends WebRowSet
JoinRowSet
接口提供了一种结合相关数据从不同的
RowSet
对象到一个
JoinRowSet
对象机制,这是一个SQL
JOIN
。换句话说,一个
JoinRowSet
对象作为一个从
RowSet
对象形成一个SQL
JOIN
关系数据的容器。
Joinable
接口提供的方法设置、检索、和不匹配的列,建立一个SQL JOIN
关系的基础。这场比赛也可以设置列提供它的JointRowSet
方法addRowSet
适当的版本。
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
列匹配,对象之间的关系建立JOIN
RowSet
对象没有一个可用的数据库支持。
要建立JOIN
类型是通过设置一个使用方法setJoinType
JoinRowSet
常数的测定。下面的SQL JOIN
类型可以设置:
CROSS_JOIN
FULL_JOIN
INNER_JOIN
-默认如果没有JOIN
型已定LEFT_OUTER_JOIN
RIGHT_OUTER_JOIN
JOIN
内部联接。在
JoinRowSet
接口领域的评论解释这些
JOIN
类型,这是标准的SQL
JOIN
类型。
JoinRowSet
对象创建一个JOIN
JoinRowSet
对象被创建,它是空的。第一
RowSet
对象被添加为
JOIN
关系的基础。应用程序必须确定哪些列在各自的
RowSet
对象被添加到
JoinRowSet
对象应匹配的列。所有的
RowSet
对象必须包含一个匹配的列,并在每个匹配列的值必须是那些可以比在其他匹配列的值。列不必有相同的名称,虽然他们经常这样做,他们不需要存储相同的数据类型,只要数据类型可以进行比较。
一个匹配的列可以设置在两个方面:
Joinable
方法setMatchColumn
RowSet
对象添加到一个JoinRowSet
对象的唯一方法。的RowSet
对象必须实施以Joinable
接口使用的方法setMatchColumn
。一旦匹配列的值已经确定,此方法可用于重置匹配列在任何时间。addRowSet
JoinRowSet
版本(或列名称或数字数组)addRowSet
方法需要一个匹配的列作为参数。这四种方法设置或重置匹配列的时间RowSet
对象被添加到一个JoinRowSet
对象。下面的代码片段添加两CachedRowSet
对象到一个JoinRowSet
对象。请注意,在这个例子中,没有SQL JOIN
类型设置,所以默认JOIN
型,这是inner_join,建立。
下面的代码片段中,表EMPLOYEES
,其匹配的列设置为第一列(EMP_ID
),添加到JoinRowSet
对象JRS。然后ESSP_BONUS_PLAN
匹配列的表,同样的EMP_ID
柱,加。当这二表添加到耶路撒冷,只有ESSP_BONUS_PLAN
EMP_ID
值匹配的行EMP_ID
值在EMPLOYEES
表加入。在这种情况下,在奖金计划的每个人都是一个员工,所以表中所有的ESSP_BONUS_PLAN
的行添加到JoinRowSet
对象。在这个例子中,两CachedRowSet
对象添加已实施Joinable
接口,因此可以称之为Joinable
方法setMatchColumn
。
新joinrowsetimpl() JoinRowSet JRS =;结果RS1 =支撑。executeQuery(“SELECT * FROM employees”);他们为新cachedrowsetimpl() CachedRowSet;采用填充(RS1);他们setmatchcolumn(1);当时addrowset(他们);结果2 =支撑。executeQuery(“SELECT * FROM essp_bonus_plan”);新cachedrowsetimpl() CachedRowSet奖金=;填充(RS2)奖金;奖金。setmatchcolumn(1);// emp_id是第一列当时addrowset(奖金);
在这一点上,当时是基于他们的EMP_ID
柱两RowSet
对象里面加入。该应用程序现在可以浏览联合数据就像是浏览一个RowSet
对象。因为当时本身是一RowSet
对象,应用程序可以浏览或修改使用RowSet
方法。
first() JRS;int EmployeeID = JRS getInt(1);串姓名= JRS GetString(2);
注意,因为SQL JOIN
必须强制执行申请时,增加了后续RowSet
对象,性能可能会有一个初始降解而JOIN
正在进行。
下面的代码片段,增加了一个额外的CachedRowSet
对象。在这种情况下,匹配的列(EMP_ID
)设置在CachedRowSet
对象添加到JoinRowSet
对象。
ResultSet RS3 =支撑。executeQuery(“SELECT * FROM 401k_contrib”);fouro1k =新cachedrowsetimpl() CachedRowSet;four01k填充(RS3);当时addrowset(four01k,1);
当时的JoinRowSet
对象现在包含值从三表。在four01k在为EMP_ID
列中的值相匹配的价值在当时的EMP_ID
柱已被添加到耶路撒冷的每一行中的数据。
JoinRowSet
方法JoinRowSet
接口供应增加
RowSet
对象和获取有关
JoinRowSet
对象信息的几种方法。
RowSet
objectsRowSet
对象添加一个RowSet
对象的方法。在任何情况下,该方法可以为每个RowSet
对象添加指定匹配的列。RowSet
对象在JoinRowSet
对象方法,另一种方法RowSet
名称检索。三分之一方法检索或SQL WHERE
子句使用的幕后形成JOIN
或文字说明什么WHERE
从句。JOIN
JOIN
类型相关的方法和五种方法找出是否JoinRowSet
对象支持一个给定的类型。JoinRowSet
objectModifier and Type | Field and Description |
---|---|
static int |
CROSS_JOIN
ANSI风格
JOIN 提供两个表的叉积
|
static int |
FULL_JOIN
ANSI风格
JOIN 提供一一全连接。
|
static int |
INNER_JOIN
ANSI风格
JOIN 提供两个表之间的内部连接。
|
static int |
LEFT_OUTER_JOIN
ANSI风格
JOIN 提供两个表之间的左外连接。
|
static int |
RIGHT_OUTER_JOIN
ANSI风格
JOIN 提供两个表之间的右外部联接。
|
PUBLIC_XML_SCHEMA, SCHEMA_SYSTEM_ID
COMMIT_ON_ACCEPT_CHANGES
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
Modifier and Type | Method and Description |
---|---|
void |
addRowSet(Joinable rowset)
由于增加了
RowSet 反对这
JoinRowSet 对象。
|
void |
addRowSet(RowSet[] rowset, int[] columnIdx)
添加一个或多个
RowSet 对象包含在了这
JoinRowSet
RowSet 对象数组和集合对象中的每一
RowSet 对象匹配列在给定列索引数组的配列。
|
void |
addRowSet(RowSet[] rowset, String[] columnName)
添加一个或多个
RowSet 对象包含在了这
JoinRowSet
RowSet 对象数组和集合对象中的每一
RowSet 对象匹配列在给定列名称匹配柱阵列。
|
void |
addRowSet(RowSet rowset, int columnIdx)
由于增加了
RowSet 反对这
JoinRowSet 对象并设置指定列为
RowSet 对象匹配的列。
|
void |
addRowSet(RowSet rowset, String columnName)
这增加了行集
JoinRowSet 对象和指定的列设置为匹配的列。
|
int |
getJoinType()
返回一个
int 描述设置SQL
JOIN 型治理这JoinRowSet实例。
|
String[] |
getRowSetNames()
返回一个包含该对象的名称
RowSet
String 数组添加到这个
JoinRowSet 对象。
|
Collection<?> |
getRowSets()
返回一个包含
RowSet 对象已被添加到这个
JoinRowSet 对象
Collection 对象。
|
String |
getWhereClause()
返回一个类似SQL的WHERE子句用于JoinRowSet对象描述。
|
void |
setJoinType(int joinType)
允许应用程序调整包含JoinRowSet对象实例在
JOIN 强加给表的类型。
|
boolean |
supportsCrossJoin()
表明如果cross_join由JoinRowSet实现支持
|
boolean |
supportsFullJoin()
表明如果full_join由JoinRowSet实现支持
|
boolean |
supportsInnerJoin()
表明如果inner_join由JoinRowSet实现支持
|
boolean |
supportsLeftOuterJoin()
表明如果left_outer_join由JoinRowSet实现支持
|
boolean |
supportsRightOuterJoin()
表明如果right_outer_join由JoinRowSet实现支持
|
CachedRowSet |
toCachedRowSet()
创建一个新的
CachedRowSet 对象包含的数据在这
JoinRowSet 对象,可以将其保存到一个数据源使用
SyncProvider 对象为
CachedRowSet 对象。
|
readXml, readXml, writeXml, writeXml, writeXml, writeXml
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
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
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, 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, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNull
isWrapperFor, unwrap
getMatchColumnIndexes, getMatchColumnNames, setMatchColumn, setMatchColumn, setMatchColumn, setMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn, unsetMatchColumn
static final int CROSS_JOIN
JOIN
提供两个表的叉积
static final int INNER_JOIN
JOIN
提供两个表之间的内部连接。在任何表中的连接的任何不匹配的行应被丢弃。
static final int LEFT_OUTER_JOIN
JOIN
提供两个表之间的左外连接。在SQL中,这是描述在所有记录应在加入语句的左边返回。
static final int RIGHT_OUTER_JOIN
JOIN
提供两个表之间的右外部联接。在SQL中,这是描述在所有记录的表JOIN语句右边即使左边的表中没有匹配的记录。
static final int FULL_JOIN
JOIN
提供一一全连接。指定无论从表中返回的所有行,而无论另一个表上的匹配记录都将返回。
void addRowSet(Joinable rowset) throws SQLException
RowSet
反对这
JoinRowSet
对象。如果
RowSet
对象被添加到这个
JoinRowSet
对象第一,它形成了
JOIN
关系的基础是建立。
这种方法只能用在特定的RowSet
对象已经有一个匹配的列设置的Joinable
方法setMatchColumn
。
注:一个Joinable
对象是任何RowSet
对象,实现了Joinable
接口。
rowset
-即被添加到该
JoinRowSet
对象的
RowSet
对象;它必须实现
Joinable
接口与比赛栏目设置
SQLException
如果(1)一个空的行集被添加到这个
JoinRowSet
对象,(2)匹配列尚未确定行集,或(3)行集违反活动
JOIN
Joinable.setMatchColumn(int)
void addRowSet(RowSet rowset, int columnIdx) throws SQLException
RowSet
反对这
JoinRowSet
对象并设置指定列为
RowSet
对象匹配的列。如果
RowSet
对象被添加到这个
JoinRowSet
对象第一,它形成了
JOIN
关系的基础是建立。
这一方法时应使用行集不已经有一个匹配的列设置。
rowset
-即被添加到该
JoinRowSet
对象的
RowSet
对象;它可以实现
Joinable
接口
columnIdx
-标识成为匹配列的列
int
SQLException
如果(1)行集是一个空的行集或(2)行集违反活动
JOIN
Joinable.unsetMatchColumn(int)
void addRowSet(RowSet rowset, String columnName) throws SQLException
JoinRowSet
对象和指定的列设置为匹配的列。如果行集被添加到这个
JoinRowSet
对象的第一,它的形式是建立关系的基础上,
JOIN
。
这种方法时应该使用给定的RowSet
对象不已经有一个匹配的列。
rowset
-即被添加到该
JoinRowSet
对象的
RowSet
对象;它可以实现
Joinable
接口
columnName
-
String
对象给予的列名称被设置为匹配的列
SQLException
如果(1)行集是一个空的行集或(2)为行集比赛列不满足条件的
JOIN
void addRowSet(RowSet[] rowset, int[] columnIdx) throws SQLException
RowSet
对象包含在了这
JoinRowSet
RowSet
对象数组和集合对象中的每一
RowSet
对象匹配列在给定列索引数组的配列。在columnidx第一单元设置为行集第一
RowSet
对象匹配的列,columnidx二元设置为行集二元匹配列,等等。
第一RowSet
对象添加到这个JoinRowSet
对象形式的JOIN
关系的基础。
这种方法时应该使用给定的RowSet
对象不已经有一个匹配的列。
rowset
-一个或多个
RowSet
对象被添加到
JOIN
数组;它可以实现
Joinable
接口
columnIdx
-
int
值指示索引数组(ES)的列被设置为在行集的
RowSet
对象匹配的列
SQLException
如果(1)一个空的行集被添加到这个
JoinRowSet
对象,(2)匹配列不为行集一
RowSet
对象,或(3)一个
RowSet
对象添加违反活动
JOIN
void addRowSet(RowSet[] rowset, String[] columnName) throws SQLException
RowSet
对象包含在了这
JoinRowSet
RowSet
对象数组和集合对象中的每一
RowSet
对象匹配列在给定列名称匹配柱阵列。在列名第一单元设置为行集第一
RowSet
对象匹配的列,列名二元设置为行集二元匹配列,等等。
第一RowSet
对象添加到这个JoinRowSet
对象形式的JOIN
关系的基础。
这种方法时应该使用给定的RowSet
对象(S)不已经有一个匹配的列。
rowset
-一个或多个
RowSet
对象被添加到
JOIN
数组;它可以实现
Joinable
接口
columnName
-
String
值被设置为行集的
RowSet
对象匹配的列的列名称的数组
SQLException
如果(1)一个空的行集被添加到这个
JoinRowSet
对象,(2)匹配列不为行集一
RowSet
对象,或(3)一个
RowSet
对象添加违反活动
JOIN
Collection<?> getRowSets() throws SQLException
RowSet
对象已被添加到这个
JoinRowSet
对象
Collection
对象。这应该归在
JOIN
包含N数行集和维护发生在在这个联盟有任何更新。
Collection
对象组成的
RowSet
对象添加到这个
JoinRowSet
对象
SQLException
-如果出现错误,产生要返回的
Collection
对象
String[] getRowSetNames() throws SQLException
RowSet
String
数组添加到这个
JoinRowSet
对象。
JoinRowSet
对象的
RowSet
对象的名称
String
阵列
SQLException
-如果出现错误的
RowSet
检索对象的名称
CachedRowSet.setTableName(java.lang.String)
CachedRowSet toCachedRowSet() throws SQLException
CachedRowSet
对象包含的数据在这
JoinRowSet
对象,可以将其保存到一个数据源使用
SyncProvider
对象为
CachedRowSet
对象。
如果任何更新或修改已被应用到JoinRowSet CachedRowSet方法返回的将无法坚持它的变化回起始行和表中的数据源。返回CachedRowSet实例不应该包含修改数据,应该清除所有的性质是始发的SQL语句。应用程序应该使用RowSet.setCommand
复位方法的SQL语句。
为了允许更改被保存回数据源的源表的acceptChanges
方法应使用呼吁JoinRowSet对象实例。实现可以利用内部数据和更新跟踪它们的实现与syncprovider互动坚持任何变化。
SQLException
-如果出现错误组装CachedRowSet对象
RowSet
,
CachedRowSet
,
SyncProvider
boolean supportsCrossJoin()
boolean supportsInnerJoin()
boolean supportsLeftOuterJoin()
boolean supportsRightOuterJoin()
boolean supportsFullJoin()
void setJoinType(int joinType) throws SQLException
JOIN
强加给表的类型。实现应该如果他们不给
JOIN
型支持抛出SQLException。
joinType
-一个SQL
JOIN
标准joinrowset.xxx静态字段定义重新上飞JoinRowSet实例配置。
SQLException
-如果不支持的
JOIN
类型设置
getJoinType()
String getWhereClause() throws SQLException
JOIN
或协助的应用程序使用一个
JoinRowSet
提供文本描述的
JOIN
SQL WHERE子句
SQLException
如果生成WHERE子句表示发生错误。
int getJoinType() throws SQLException
int
描述设置SQL
JOIN
型治理这JoinRowSet实例。返回类型是一个标准的JoinRowSet类型:
CROSS_JOIN
,
INNER_JOIN
,
LEFT_OUTER_JOIN
,
RIGHT_OUTER_JOIN
或
FULL_JOIN
。
JOIN
JoinRowSet静态字段定义的标准。
JoinRowSet.INNER_JOIN
是作为默认的
JOIN
型无型已显式设置返回。
SQLException
-如果出现错误,确定由JoinRowSet实例支持的SQL
JOIN
型。
setJoinType(int)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.