public interface ResultSetMetaData extends Wrapper
ResultSet对象中列的类型和属性的信息的对象。
以下代码片段创建ResultSet对象rs,创建ResultSetMetaData对象rsmd,并使用rsmd来查找rs中有多少列,以及rs中的第一列是否可以在WHERE子句中使用。
ResultSet rs = stmt.executeQuery("SELECT a, b, c FROM TABLE2");
ResultSetMetaData rsmd = rs.getMetaData();
int numberOfColumns = rsmd.getColumnCount();
boolean b = rsmd.isSearchable(1);
| Modifier and Type | Field and Description |
|---|---|
static int |
columnNoNulls
常数表示一列不允许
NULL值。
|
static int |
columnNullable
常数表示一列允许
NULL值。
|
static int |
columnNullableUnknown
常数表示列的值的可空性是未知的。
|
| Modifier and Type | Method and Description |
|---|---|
String |
getCatalogName(int column)
获取指定列的表的目录名称。
|
String |
getColumnClassName(int column)
如果调用方法
ResultSet.getObject从列中检索值,则返回其实例生成的Java类的完全限定名称。
|
int |
getColumnCount()
返回此
ResultSet对象中的列数。
|
int |
getColumnDisplaySize(int column)
指定指定列的正常最大宽度(以字符为单位)。
|
String |
getColumnLabel(int column)
获取指定列的建议标题用于打印输出和显示。
|
String |
getColumnName(int column)
获取指定列的名称。
|
int |
getColumnType(int column)
检索指定列的SQL类型。
|
String |
getColumnTypeName(int column)
检索指定列的数据库特定类型名称。
|
int |
getPrecision(int column)
获取指定列的指定列大小。
|
int |
getScale(int column)
获取小数点右侧的指定列的位数。
|
String |
getSchemaName(int column)
获取指定列的表的模式。
|
String |
getTableName(int column)
获取指定列的表名称。
|
boolean |
isAutoIncrement(int column)
指示指定列是否自动编号。
|
boolean |
isCaseSensitive(int column)
指示列的大小写是否重要。
|
boolean |
isCurrency(int column)
指示指定的列是现金值。
|
boolean |
isDefinitelyWritable(int column)
指示指定列上的写入是否会成功。
|
int |
isNullable(int column)
表示指定列中的值的无效性。
|
boolean |
isReadOnly(int column)
指示指定列是否绝对不可写。
|
boolean |
isSearchable(int column)
指示指定的列是否可以在where子句中使用。
|
boolean |
isSigned(int column)
指示指定列中的值是否为有符号数。
|
boolean |
isWritable(int column)
指示指定列上的写入是否成功。
|
isWrapperFor, unwrapstatic final int columnNoNulls
NULL值。
static final int columnNullable
NULL值。
static final int columnNullableUnknown
int getColumnCount()
throws SQLException
ResultSet对象中的列数。
SQLException - 如果发生数据库访问错误
boolean isAutoIncrement(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
boolean isCaseSensitive(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
boolean isSearchable(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
boolean isCurrency(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
int isNullable(int column)
throws SQLException
column - 第一列是1,第二列是2,...
columnNoNulls , columnNullable或columnNullableUnknown
SQLException - 如果发生数据库访问错误
boolean isSigned(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是这样的话
false否则
SQLException - 如果发生数据库访问错误
int getColumnDisplaySize(int column)
throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
String getColumnLabel(int column) throws SQLException
AS子句AS 。
如果SQL AS没有指定,从返回的值getColumnLabel将是相同的由返回的值getColumnName方法。
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
String getColumnName(int column) throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
String getSchemaName(int column) throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
int getPrecision(int column)
throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
int getScale(int column)
throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
String getTableName(int column) throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
String getCatalogName(int column) throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
int getColumnType(int column)
throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
Types
String getColumnTypeName(int column) throws SQLException
column - 第一列是1,第二列是2,...
SQLException - 如果发生数据库访问错误
boolean isReadOnly(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
boolean isWritable(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话;
false否则
SQLException - 如果发生数据库访问错误
boolean isDefinitelyWritable(int column)
throws SQLException
column - 第一列是1,第二列是2,...
true如果是的话
false否则
SQLException - 如果发生数据库访问错误
String getColumnClassName(int column) throws SQLException
如果调用方法ResultSet.getObject从列中检索值,则返回其实例生成的Java类的完全限定名称。 ResultSet.getObject可能会返回此方法返回的类的子类。
column - 第一列是1,第二列是2,...
ResultSet.getObject将用于检索指定列中的值。
这是用于自定义映射的类名。
SQLException - 如果发生数据库访问错误
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.