DataTableReader

Inheritance: java.lang.Object, com.groupdocs.assembly.system.data.common.DbDataReader

public final class DataTableReader extends DbDataReader

The DataTableReader obtains the contents of one or more DataTable objects in the form of one or more read-only, forward-only result sets.

Constructors

Constructor Description
DataTableReader(DataTable dataTable) Initializes a new instance of the DataTableReader class by using data from the supplied DataTable.
DataTableReader(DataTable[] dataTables) Initializes a new instance of the DataTableReader class using the supplied array of DataTable objects.

Methods

Method Description
getFieldCount() Returns the number of columns in the current row.
isClosed() Gets a value that indicates whether the DataTableReader is closed.
get(int ordinal) Gets the value of the specified column in its native format given the column ordinal.
getName(int ordinal) Gets the value of the specified column as a java.lang.String.
getFieldType(int ordinal) Gets the java.lang.Class that is the data type of the object.
getValue(int ordinal) Gets the value of the specified column in its native format.
read() Advances the DataTableReader to the next record.
getDepth() The depth of nesting for the current row of the DataTableReader.
getRecordsAffected() Gets the number of rows inserted, changed, or deleted by execution of the SQL statement.
close() Closes the current DataTableReader.
getSchemaTable() Returns a DataTable that describes the column metadata of the DataTableReader.
nextResult() Advances the DataTableReader to the next result set, if any.
hasRows() Gets a value that indicates whether the DataTableReader contains one or more rows.
iterator() Returns an enumerator that can be used to iterate through the item collection.
get(String name) Gets the value of the specified column in its native format given the column name.

DataTableReader(DataTable dataTable)

public DataTableReader(DataTable dataTable)

Initializes a new instance of the DataTableReader class by using data from the supplied DataTable.

Parameters:

Parameter Type Description
dataTable DataTable The DataTable from which the new DataTableReader obtains its result set.

DataTableReader(DataTable[] dataTables)

public DataTableReader(DataTable[] dataTables)

Initializes a new instance of the DataTableReader class using the supplied array of DataTable objects.

Parameters:

Parameter Type Description
dataTables DataTable[] The array of DataTable objects that supplies the results for the new DataTableReader object.

getFieldCount()

public final int getFieldCount()

Returns the number of columns in the current row.

Returns: int - When not positioned in a valid result set, 0; otherwise the number of columns in the current row.

isClosed()

public final boolean isClosed()

Gets a value that indicates whether the DataTableReader is closed.

Returns: boolean - Returns true if the DataTableReader is closed; otherwise, false.

get(int ordinal)

public final Object get(int ordinal)

Gets the value of the specified column in its native format given the column ordinal.

Parameters:

Parameter Type Description
ordinal int The zero-based column ordinal.

Returns: java.lang.Object - The value of the specified column in its native format.

getName(int ordinal)

public final String getName(int ordinal)

Gets the value of the specified column as a java.lang.String.

Parameters:

Parameter Type Description
ordinal int The zero-based column ordinal

Returns: java.lang.String - The name of the specified column.

getFieldType(int ordinal)

public final Class getFieldType(int ordinal)

Gets the java.lang.Class that is the data type of the object.

Parameters:

Parameter Type Description
ordinal int The zero-based column ordinal.

Returns: java.lang.Class - The java.lang.Class that is the data type of the object.

getValue(int ordinal)

public final Object getValue(int ordinal)

Gets the value of the specified column in its native format.

Parameters:

Parameter Type Description
ordinal int The zero-based column ordinal

Returns: java.lang.Object - The value of the specified column. This method returns DBNull for null columns.

read()

public final boolean read()

Advances the DataTableReader to the next record.

Returns: boolean - true if there was another row to read; otherwise false.

getDepth()

public final int getDepth()

The depth of nesting for the current row of the DataTableReader.

Returns: int - The depth of nesting for the current row; always zero.

getRecordsAffected()

public final int getRecordsAffected()

Gets the number of rows inserted, changed, or deleted by execution of the SQL statement.

Returns: int - The DataTableReader does not support this property and always returns 0.

close()

public final void close()

Closes the current DataTableReader.

getSchemaTable()

public final DataTable getSchemaTable()

Returns a DataTable that describes the column metadata of the DataTableReader.

Returns: DataTable - A DataTable that describes the column metadata.

nextResult()

public final boolean nextResult()

Advances the DataTableReader to the next result set, if any.

Returns: boolean - true if there was another result set; otherwise false.

hasRows()

public final boolean hasRows()

Gets a value that indicates whether the DataTableReader contains one or more rows.

Returns: boolean - true if the DataTableReader contains one or more rows; otherwise false.

iterator()

public final Iterator iterator()

Returns an enumerator that can be used to iterate through the item collection.

Returns: java.util.Iterator - An java.util.Iterator object that represents the item collection.

get(String name)

public final Object get(String name)

Gets the value of the specified column in its native format given the column name.

Parameters:

Parameter Type Description
name java.lang.String The name of the column.

Returns: java.lang.Object - The value of the specified column in its native format.