public interface DataBaseResultMetaData
DataBaseResult
. If the
corresponding database result does not contain rows, the metadata object is
empty, which means that no metadata information is provided.
The following code fragment shows, how to make a database lookup, to determine the number of retrieved columns and the column names, and how to use the column names to get values from the column map. Further, the column type is determined from the meta data.
DataBaseAccessor accessor = LookupService.getDataBaseAccessor(channel);
try{
DataBaseResult result = accessor.call("SELECT a, b, c FROM TABLE2");
DataBaseResultMetaData metaData = result.getMetaData();
int numberOfColumns = metaData.getColumnCount();
String[] columnNames = metaData.getColumnNames();
for(Iterator rows = result.getRows(); rows.hasNext(); ){
Map columnMap =(Map)rows.next();
for (int i =0; i < numberOfColumns; i++){
Object value = columnMap.get(columnNames[i]);
if ("java.lang.String".equals(metaData.getColumnClassName(columnNames[i])){
String stringValue = (String)value;
....
}
...
}
}
}finally{
if (accessor!=null) accessor.close();
}
DataBaseResult
Modifier and Type | Method and Description |
---|---|
String |
getCatalogName(String columnName)
Returns the table's catalog name for the designated column.
|
String |
getColumnClassName(String columnName)
Returns the fully qualified name of the Java class whose instances are
manufactured if the method ResultSet.getObject is called to retrieve a
value from the column.
|
int |
getColumnDisplaySize(String columnName)
Returns the designated column's normal maximum width in characters.
|
String |
getColumnLabel(String columnName)
Returns the designated column's suggested title for use in printouts and
displays.
|
String[] |
getColumnNames()
Returns all column names.
|
int |
getColumnType(String columnName)
Returns the given column's SQL type.
|
String |
getColumnTypeName(String columnName)
Returns the designated column's database specific type name.
|
int |
getPrecision(String columnName)
Returns the designated column's number of decimal digits.
|
int |
getScale(String columnName)
Returns the designated column's number of decimal places.
|
String |
getSchemaName(String columnName)
Returns the designated column's table's schema.
|
String |
getTableName(String columnName)
Returns the designated column's table name.
|
boolean |
isAutoIncrement(String columnName)
Indicates whether the designated column is automatically numbered, thus
read-only.
|
boolean |
isCaseSensitive(String columnName)
Indicates whether a column's case matters.
|
boolean |
isCurrency(String columnName)
Indicates whether the designated column is a cash value.
|
boolean |
isDefinitelyWritable(String columnName)
Indicates whether a write on the designated column will definitely
succeed.
|
int |
isNullable(String columnName)
Indicates the nullability of values in the designated column.
|
boolean |
isReadOnly(String columnName)
Indicates whether the designated column is definitely not writable.
|
boolean |
isSearchable(String columnName)
Indicates whether the designated column can be used in a where clause.
|
boolean |
isSigned(String columnName)
Indicates whether values in the designated column are signed numbers.
|
boolean |
isWritable(String columnName)
Indicates whether it is possible for a write on the designated column to
succeed.
|
String[] getColumnNames()
String getColumnClassName(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
int getColumnType(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isAutoIncrement(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isCaseSensitive(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isSearchable(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isCurrency(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
int isNullable(String columnName)
columnName
- column namejava.sql.ResultSetMetaData.columnNoNulls
,
java.sql.ResultSetMetaData.columnNullable
, or
java.sql.ResultSetMetaData.columnNullableUnknown
NullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isSigned(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
int getColumnDisplaySize(String columnName)
columnName
- column nameString getColumnLabel(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
String getSchemaName(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
int getPrecision(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
int getScale(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
String getTableName(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
String getCatalogName(String columnName)
columnName
- column nameString getColumnTypeName(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isReadOnly(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isWritable(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
boolean isDefinitelyWritable(String columnName)
columnName
- column nameNullPointerException
- if columnName
is null
,IllegalArgumentException
- if columnName
is not part of
getColumnNames()
Access Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] SAP_XIAF
|
[sap.com] com.sap.aii.mapping.lib.facade
|
api
|
BC-XI
|
Copyright 2019 SAP AG Complete Copyright Notice