public interface Joinable
Joinable
接口提供的方法获取和匹配的栏目设置,这是产生加入
RowSet
对象到对象的SQL
JOIN
JoinRowSet
形成的基础。
任何标准的RowSet
实施可以实施Joinable
接口才能被添加到一个JoinRowSet
对象。实现此接口的对象进行了RowSet
能力使用Joinable
方法,设置,检索和获取匹配的列信息。应用程序可以添加RowSet
对象没有实施Joinable
接口到JoinRowSet
对象,但是你必须使用其中的JoinRowSet.addRowSet
方法既可以RowSet
对象和一个匹配的列或RowSet
对象数组和匹配的列的数组。
获得在Joinable
接口的方法,一个RowSet
对象实现在五标准RowSet
接口至少一个,还实现了Joinable
接口。此外,最RowSet
对象扩展BaseRowSet
类。例如:
类myrowsetimpl延伸baserowset CachedRowSet实现,加入{::}
在Joinable
接口的方法允许RowSet
对象设置一个匹配的列,检索匹配或不匹配的列,列,这是一个在SQL JOIN
可以基于柱。一个类实现这些方法的一个实例可以被添加到一个JoinRowSet
对象允许一个SQL JOIN
关系建立。
新myrowsetimpl() CachedRowSet CRS =;CRS。填充((结果集)RS);(加入)(1)setmatchcolumnindex CRS;新joinrowsetimpl() JoinRowSet JRS =;当时addrowset(CRS);在前面的例子中,CRS是一
CachedRowSet
对象,实现了
Joinable
接口。在下面的例子中,CRS2没有,所以它必须提供匹配的列作为参数的
addRowSet
方法。这个例子假设列1是匹配列。
CachedRowSet CrS2 =新myrowsetimpl();CrS2。填充((结果集)RS);jrs2 =新joinrowsetimpl() JoinRowSet;jrs2 addrowset(crs2,1);
的JoinRowSet
接口使得它可以从一个或多个RowSet
对象合并到一个表没有招致创建一个数据库连接获取数据的费用。因此它非常适合使用在断开RowSet
对象。然而,任何RowSet
对象可以实现此接口,无论是连接或断开。请注意,JdbcRowSet
对象,总是连接到数据源,可以不必成为一个JoinRowSet
对象的一部分直接成为一个SQL JOIN
部分。
setMatchColumn
方法索引数组表示多少匹配的列被设置(数组长度)除了这列将用于匹配。例如:
int []我= { 1,2,4,7 };//表示四匹配的列,列索引1、2、4、7参加参加。加入setmatchcolumn(我);后续匹配的列可以添加如下不同的
Joinable
对象(一个
RowSet
对象,实现了
Joinable
接口)。
int [] W = { 3,2,5,3 };joinable2 setmatchcolumn(W);申请时,可以将两个或多个
RowSet
对象到一个
JoinRowSet
对象,数组中的索引顺序尤为重要。每个索引数组的直接映射到先前添加的
RowSet
对象相应的指标。如果重叠或重叠时,匹配列的数据保持在事件增加了一个额外的
Joinable
行集,需要涉及到匹配的列数据。因此,应用程序可以在任何顺序设置多个匹配的列,但这种秩序对
SQL
结果直接影响加入。
当使用列名称而不是列索引来表示匹配列时,这种断言在完全相同的方式上应用的方式是同样的方式。
JoinRowSet
Modifier and Type | Method and Description |
---|---|
int[] |
getMatchColumnIndexes()
检索匹配的列,设置该
RowSet 对象与方法
setMatchColumn(int[] columnIdxes) 指标。
|
String[] |
getMatchColumnNames()
检索匹配的列,设置该
RowSet 对象与方法
setMatchColumn(String [] columnNames) 的名字。
|
void |
setMatchColumn(int columnIdx)
指定的列设置为这
RowSet 对象匹配的列。
|
void |
setMatchColumn(int[] columnIdxes)
设置指定列为本
RowSet 对象匹配的列。
|
void |
setMatchColumn(String columnName)
指定的列设置为这
RowSet 对象匹配的列。
|
void |
setMatchColumn(String[] columnNames)
设置指定列为本
RowSet 对象匹配的列。
|
void |
unsetMatchColumn(int columnIdx)
设定指定列为本
RowSet 对象匹配的列。
|
void |
unsetMatchColumn(int[] columnIdxes)
设定指定列为本
RowSet 对象匹配的列。
|
void |
unsetMatchColumn(String columnName)
设定指定列为本
RowSet 对象匹配的列。
|
void |
unsetMatchColumn(String[] columnName)
设定指定列为本
RowSet 对象匹配的列。
|
void setMatchColumn(int columnIdx) throws SQLException
RowSet
对象匹配的列。一个
JoinRowSet
对象现在可以添加这
RowSet
对象基于匹配的列。
子接口,如CachedRowSet
™接口定义的方法CachedRowSet.setKeyColumns
,允许主键的语义是在特定的列执行。该setMatchColumn(int columnIdx)
方法实现应确保在关键柱的约束保持当CachedRowSet
对象设置一个主键列为比赛列。
columnIdx
-
int
标识列的索引被设置为匹配的列
SQLException
-如果一个无效的列的索引设置
setMatchColumn(int[])
,
unsetMatchColumn(int)
void setMatchColumn(int[] columnIdxes) throws SQLException
RowSet
对象匹配的列。一个
JoinRowSet
对象现在可以添加这
RowSet
对象基于匹配的列。
columnIdxes
-
int
标识列的索引设置为匹配的列的数组
SQLException
-如果一个无效的列的索引设置
setMatchColumn(int[])
,
unsetMatchColumn(int[])
void setMatchColumn(String columnName) throws SQLException
RowSet
对象匹配的列。一个
JoinRowSet
对象现在可以添加这
RowSet
对象基于匹配的列。
子接口如CachedRowSet
接口定义的方法CachedRowSet.setKeyColumns
,允许主键的语义是在特定的列执行。该setMatchColumn(String columnIdx)
方法实现应确保在关键柱的约束保持当CachedRowSet
对象设置一个主键列为比赛列。
columnName
-
String
对象给予的列名称被设置为匹配的列
SQLException
-如果一个无效的列名称设置、列名称为空,或列名称为空字符串
unsetMatchColumn(int)
,
setMatchColumn(int[])
void setMatchColumn(String[] columnNames) throws SQLException
RowSet
对象匹配的列。一个
JoinRowSet
对象现在可以添加这
RowSet
对象基于匹配的列。
columnNames
-
String
对象给予的列名称被设置为匹配的列的数组
SQLException
-如果一个无效的列名称设置、列名称为空,或列名称为空字符串
unsetMatchColumn(int)
,
setMatchColumn(int[])
int[] getMatchColumnIndexes() throws SQLException
RowSet
对象与方法
setMatchColumn(int[] columnIdxes)
指标。
RowSet
对象匹配的列的列的索引
int
阵列
SQLException
-如果没有匹配列已定
setMatchColumn(int)
,
unsetMatchColumn(int)
String[] getMatchColumnNames() throws SQLException
RowSet
对象与方法
setMatchColumn(String [] columnNames)
的名字。
String
对象的列设置为这
RowSet
对象匹配的列名称的数组
SQLException
-如果没有匹配列已定
setMatchColumn(int)
,
unsetMatchColumn(int)
void unsetMatchColumn(int columnIdx) throws SQLException
RowSet
对象匹配的列。
RowSet
对象实现的Joinable
接口必须确保关键约束将继续执行直到方法CachedRowSet.unsetKeyColumns
被称为在指定的列。
columnIdx
-
int
标识索引的列,将设置为匹配的列
SQLException
-如果一个无效的列的索引指定或被指定的列是以前没有设置为匹配的列
setMatchColumn(int)
void unsetMatchColumn(int[] columnIdxes) throws SQLException
RowSet
对象匹配的列。
columnIdxes
-一系列的
int
标识列的指标,可设置为匹配的列
SQLException
-如果一个无效的列的索引指定或被指定的列是以前没有设置为匹配的列
setMatchColumn(int)
void unsetMatchColumn(String columnName) throws SQLException
RowSet
对象匹配的列。
RowSet
对象实现的Joinable
接口必须确保关键约束将继续执行直到方法CachedRowSet.unsetKeyColumns
被称为在指定的列。
columnName
-
String
对象给列的名称,将设置为匹配的列
SQLException
-如果一个无效的列名称指定或指定列未设置为匹配的列
setMatchColumn(int)
void unsetMatchColumn(String[] columnName) throws SQLException
RowSet
对象匹配的列。
columnName
-数组对象,
String
给栏目名称被设置为匹配的列
SQLException
-如果一个无效的列名称指定或指定列未设置为匹配的列
setMatchColumn(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.