borland Packages Class Hierarchy dx.dataset Package
java.lang.Object +----com.borland.dx.dataset.ReadRow +----com.borland.dx.dataset.ReadWriteRow +----com.borland.dx.dataset.DataRow
Constructors Properties Methods
Implements Serializable
The DataRow
contains one row's worth of storage for
Column
components
of the DataSet
it is constructed from. It is useful for adding, updating, and locating rows in a
DataSet
.
A DataRow
must be created with the DataSet
it is used with. If
the structure of a DataSet
changes, old DataRow
objects will not
work with the updated DataSet
and a new DataRow
must be created for it.
When using a DataRow
to locate data, all columns in the DataRow
are included in the locate operation. To limit the locate to include only specified
columns, use a "scoped" DataRow
. A scoped DataRow
includes only
specified columns and is created using the
DataRow(DataSet, String)
or the DataRow(DataSet, String[])
constructor.
To write code that handles columns of any data type, use the
setVariant(String, Variant)
or the
setVariant(int, Variant)
method and the
getVariant(String, Variant)
or
getVariant(int, Variant)
method.
For example, use these methods when writing code for locating data that is not
data type dependent.
Setting values in a DataRow
does not automatically perform Column
level constraint checks such
as minimum value, maximum value or readOnly.
This allows you to use the DataRow
, for example, when locating a value in a calculated (readOnly) column.
To explicitly apply constraint tests on all columns, call the DataRow.validate()
method.
When working with DataRows
and calling superclass methods such as ReadRow.getBigDecimal(int)
which refer
to a Column
ordinal (int
), the ordinal is the position of the Column
in the DataRow
and not of the original DataSet
. In addition, Column
numbering begins with zero (0) as the first Column
. To avoid hard-coding the mapping between the DataSet
Column
order and scoped Column
order, use the following syntax:
dataRow1.setString(dataset.getColumn(ordinal).getColumnName(),"test")
For most methods taking an ordinal parameter there is an equivalent one taking a String
parameter. The latter is preferred over the ordinal one since column names are more readable and are not affected by changes in column order.
public DataRow(DataSet dataSet)Constructs a
DataRow
containing all the Column
components of the
specified DataSet
, but no data values. On error, this constructor throws
a DataSetException
.
dataSet
DataSet
component from which to clone the structure for the DataRow
. All Column
components of the DataSet
are included in the DataRow
.
public DataRow(DataSet dataSet, String columnName)Creates a "scoped"
DataRow
containing the structure of (but no data from)
the specified column of the current row position.
On error, this constructor throws a DataSetException
.
dataSet
DataSet
component from which to clone the structure for the DataRow
. Only the Column
component specified in the columnName
parameter is included in the DataRow
.
columnName
String
name of the Column
to include in the DataRow
.
public DataRow(DataSet dataSet, String[] columnNames)Constructs a "scoped"
DataRow
containing the data structure (but no data)
from specified columns of the DataSet
. On error, this constructor throws
a DataSetException
.
dataSet
DataSet
component from which to clone the structure for
the DataRow
. All Column
components of the DataSet
are included
in the DataRow
.
columnNames
String
names of the Column
components to
include in the DataRow
.
public final void validate()Tests all columns in the
DataRow
for constraints on the data such as minimum or
maximum value, readOnly, and so on.