public class RowMetaData extends CloneableDataObject
Title: Structured Data Objects
Description: Row meta data which contains column names, their types and NULLable flag.
Copyright: Copyright (c) 2009
Company: StreamScape Technologies
DEFAULT_SERIAL_VERSION_ID
Constructor and Description |
---|
RowMetaData()
Creates new meta data instance without capacity limit.
|
RowMetaData(int capacity)
Creates new meta data instance with limitation on max rows number (capacity).
|
RowMetaData(java.util.List columns) |
RowMetaData(ResultSet rs)
Initializes row meta data from JDBC ResultSet.
|
Modifier and Type | Method and Description |
---|---|
void |
addColumn(ColumnDescriptor columnDescriptor) |
void |
addColumn(java.lang.String name)
Adds column definition with specified name to the meta data.
|
RowMetaData |
addColumn(java.lang.String name,
java.lang.Class clazz)
Adds column definition with specified name and Java type to the meta data.
|
void |
addColumn(java.lang.String name,
java.lang.Class columnClass,
boolean nullable)
Adds a column definition with specified name, Java type and NULLable flag to the meta-data.
|
void |
addColumn(java.lang.String name,
java.lang.Class columnClass,
boolean nullable,
int precision,
int scale) |
void |
addColumn(java.lang.String name,
SQLType type)
Adds column definition with specified name and SQL type to the meta data.
|
void |
addColumn(java.lang.String name,
SQLType type,
boolean nullable)
Adds a column definition with specified name, SQL type and NULLable flag to the meta-data.
|
void |
addColumn(java.lang.String name,
SQLType type,
boolean nullable,
int precision,
int scale) |
RowMetaData |
clone()
Clones the object.
|
void |
enableRowId(boolean useRID)
Enables Row Id usage.
|
int |
findColumn(java.lang.String columnName)
Returns the index of the column with a given name.
|
int |
getCapacity()
Returns capacity.
|
int |
getColumnCount()
Returns the column count.
|
ColumnDescriptor |
getColumnDescriptor(int index)
Returns a column descriptor for the specified column index.
|
ColumnDescriptor |
getColumnDescriptor(java.lang.String name)
Returns a column descriptor for the specified column name.
|
java.util.List |
getColumnDescriptors()
Return column descriptors in the order they are stored in meta data.
|
java.lang.String |
getColumnName(int colIndex)
Returns the name of the column at the index specified.
|
java.util.List |
getColumnNames()
Returns a list of column names.
|
int |
getColumnSQLType(int index)
Returns SQL type code of the column data type.
|
int |
getColumnSQLType(java.lang.String name)
Returns SQL type code of the column data type.
|
java.lang.Class |
getColumnTypeClass(int index)
Returns Java class which the column data type is represented by.
|
java.lang.Class |
getColumnTypeClass(java.lang.String name)
Returns Java class which the column data type is represented by.
|
int[] |
getKeyColumnsIndices()
Returns indices of the columns which represent primary key.
|
ColumnDescriptor |
getOutParameterColumnDescriptor(int index) |
ColumnDescriptor |
getOutParameterColumnDescriptor(java.lang.String name) |
int |
getOutParameterCount()
Returns number of out parameters (for callable statements)
|
java.lang.String[] |
getOutParameterNames()
Returns out parameter names.
|
java.lang.Class |
getOutputParameterTypeClass(int index)
Returns out parameter Java class.
|
java.lang.Class |
getOutputParameterTypeClass(java.lang.String name)
Returns out parameter Java class.
|
boolean |
hasReturnCode()
Returns value of return code.
|
boolean |
isRowIdEnabled()
Returns
true if the array has Row Id indexing enabled. |
java.util.Iterator |
iterator()
Returns an iteration of column descriptors.
|
void |
removeColumn(java.lang.String columnName)
Removes a column from the array meta-data.
|
void |
setCapacity(int capacity)
Sets the total capacity of the row meta data.
|
void |
setHasReturnCode(boolean hasReturnCode) |
void |
setKeyColumnsIndices(int[] keyIndices)
Sets the indices of columns that will be used as a searchable index (primary key).
|
void |
setOutParameterNamesAndTypes(java.lang.String[] outParams,
SQLType[] types)
Sets out parameters names and types.
|
getSerialVersionUID
public RowMetaData()
public RowMetaData(int capacity)
public RowMetaData(java.util.List columns)
public RowMetaData(ResultSet rs) throws MetaDataException
rs
- Result set for some query.MetaDataException
public void setCapacity(int capacity)
capacity
- intpublic int getCapacity()
public void setHasReturnCode(boolean hasReturnCode)
public boolean hasReturnCode()
public ColumnDescriptor getOutParameterColumnDescriptor(int index) throws MetaDataException
MetaDataException
public ColumnDescriptor getOutParameterColumnDescriptor(java.lang.String name) throws MetaDataException
MetaDataException
public java.lang.String[] getOutParameterNames()
public void setOutParameterNamesAndTypes(java.lang.String[] outParams, SQLType[] types)
outParams
- out parameter namestypes
- out parameters namespublic int getOutParameterCount()
public java.lang.Class getColumnTypeClass(int index) throws MetaDataException
index
- of the columnMetaDataException
- if specified column index is out of rangepublic java.lang.Class getOutputParameterTypeClass(int index) throws MetaDataException
index
- index of out parameterMetaDataException
- if specified index out of rangepublic java.lang.Class getOutputParameterTypeClass(java.lang.String name) throws MetaDataException
name
- name of out parameterMetaDataException
- if specified index out of rangepublic java.lang.Class getColumnTypeClass(java.lang.String name) throws MetaDataException
name
- nameMetaDataException
- if column with specified name does not existpublic int getColumnSQLType(java.lang.String name) throws MetaDataException
name
- name of the columnMetaDataException
- if column with specified name does not existpublic int getColumnSQLType(int index) throws MetaDataException
index
- of the columnMetaDataException
- if specified column index is out of rangepublic void enableRowId(boolean useRID) throws MetaDataException
row_id
in the first position as uniquely generated key. This value may be used as the
searchable key column. Additionally further calls to getKeyColumnsIndices()
will
always return -2
, to indicate that a Row Id is defined. This method
overrides any key settings that may have been enabled by setKeyColumnsIndices(int[])
.useRID
- booleanMetaDataException
public boolean isRowIdEnabled()
true
if the array has Row Id indexing enabled.public int findColumn(java.lang.String columnName)
columnName
- StringRowException
RowArrayException
public void addColumn(java.lang.String name)
public RowMetaData addColumn(java.lang.String name, java.lang.Class clazz)
public void addColumn(java.lang.String name, SQLType type)
public void addColumn(java.lang.String name, java.lang.Class columnClass, boolean nullable)
name
- StringcolumnClass
- Classnullable
- booleanpublic void addColumn(java.lang.String name, java.lang.Class columnClass, boolean nullable, int precision, int scale)
public void addColumn(java.lang.String name, SQLType type, boolean nullable)
name
- Stringtype
- SQLTypenullable
- booleanpublic void addColumn(java.lang.String name, SQLType type, boolean nullable, int precision, int scale)
public void addColumn(ColumnDescriptor columnDescriptor)
public void removeColumn(java.lang.String columnName) throws MetaDataException
columnName
- StringMetaDataException
public java.util.List getColumnNames()
public int getColumnCount()
public int[] getKeyColumnsIndices()
Row Id
is set this method returns array with
one element equals -2.
Method returns NULL if primary key is not defined.public void setKeyColumnsIndices(int[] keyIndices) throws MetaDataException
keyIndices
- int[]RowArrayException
MetaDataException
public java.lang.String getColumnName(int colIndex) throws MetaDataException
colIndex
- intRowArrayException
MetaDataException
public ColumnDescriptor getColumnDescriptor(java.lang.String name) throws MetaDataException
name
- StringRowArrayException
MetaDataException
public ColumnDescriptor getColumnDescriptor(int index)
index
- intRowArrayException
public java.util.List getColumnDescriptors()
public java.util.Iterator iterator() throws MetaDataException
RowArrayException
MetaDataException
public RowMetaData clone()
CloneableDataObject
clone
in interface CloneableObject
clone
in class CloneableDataObject
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.