PreviousData Provider for .NET Guide (9.1 revision 1) Next

PsqlDataReader Object

Show this topic in Library frames

The PsqlDataReader object is a forward-only cursor that retrieves read-only records from a database. Performance is better than using PsqlDataAdapter, but the result set cannot be modified.

Table 4-9 describes the public properties of PsqlDataReader.

Table 4-9 Public Properties of the PsqlDataReader Object 
Property
Description
Depth
Gets a value indicating the depth of nesting for the current row.
HasRows
Gets a value indicating whether the PsqlDataReader contains one or more rows.
IsClosed
Gets a value indicating whether the data reader is closed.
RecordsAffected
Gets the number of rows that were changed, inserted, or deleted by execution of the SQL statement.

Table 4-10 describes the public methods of the PsqlDataReader.

Table 4-10 Supported Methods of the PsqlDataReader Object
Method
Description
Close
Closes the DataReader. Always call the Close method when you finish using the DataReader object.
GetSchemaTable
Returns a DataTable that describes the column metadata of the PsqlDataReader. For more information, see Table 4-11.
NextResult
Advances the data reader to the next result when reading the results of batch SQL statements.
Read
Advances the IDataReader to the next result.

The result set produced for the PsqlDataReader.GetSchemaTable() returns the columns described in Table 4-11, in the order specified.

Table 4-11 Columns Returned by GetSchemaTable on Psql.DataReader  
Column
Description
ColumnName
Specifies the name of the column, which might not be unique. If the name cannot be determined, a null value is returned. This name reflects the most recent renaming of the column in the current view or command text.
ColumnOrdinal
Specifies the ordinal of the column, which cannot be null. The bookmark column of the row, if any, is 0. Other columns are numbered starting with 1.
ColumnSize
Specifies the maximum possible length of a value in the column. For columns that use a fixed-length data type, this is the size of the data type.
NumericPrecision
Specifies the precision of the column, which depends on how the column is defined in ProviderType (page 4-12).
If ProviderType is a numeric data type, this is the maximum precision of the column.
If ProviderType is not a numeric data type, the value is null.
NumericScale
Specifies the number of digits to the right of the decimal point. If ProviderType is DBTYPE_DECIMAL or DBTYPE_NUMERIC. Otherwise, this is a null value.
The value depends on how the column is defined in ProviderType (page 4-12).
DataType
Maps to the .NET Framework type of the column.
ProviderType
Specifies the indicator of the column's data type. This column cannot contain a null value.
If the data type of the column varies from row to row, this must be Object.
IsLong
Set if the column contains a Binary Long Object (BLOB) that contains very long data. The setting of this flag corresponds to the value of the IS_LONG column in the PROVIDER_TYPES rowset for the data type.
The definition of very long data is provider-specific.
AllowDBNull
Set if the consumer can set the column to a null value, or if the data provider cannot determine whether or not the consumer can set the column to a null value. Otherwise, no value is set.
A column can contain null values, even if it cannot be set to a null value.
IsReadOnly
Determines whether a column can be changed.
The value is true if the column can be modified; otherwise, the value is false.
IsRowVersion
Set if the column contains a persistent row identifier that cannot be written to, and has no meaningful value except to identify the row.
IsUnique
Specifies whether the column constitutes a key by itself or if there is a constraint of type UNIQUE that applies only to this column.
The value is true if no two rows in the base table (the table returned in BaseTableName (page 4-14)) can have the same value in this column.
The default for this column is false. The column can contain duplicate values in the base table.
IsKeyColumn
Specifies whether a set of columns uniquely identifies a row in the rowset. This set of columns may be generated from a base table primary key, a unique constraint, or a unique index.
The value is true if the column is one of a set of columns in the rowset that, taken together, uniquely identify the row. The value is false if the column is not required to uniquely identify the row.
IsAutoIncrement
Specifies whether the column assigns values to new rows in fixed increments.
The value is TRUE when the column assigns values to new rows in fixed increments.
The value is FALSE when the column does not assign values to new rows in fixed increments.
The default value of this column is FALSE.
BaseSchemaName
Specifies the name of the schema in the database that contains the column. The value is null if the base schema name cannot be determined.
The default value of this column is null.
BaseCatalogName
Specifies the name of the catalog in the data store that contains the column. A null value if the base catalog name cannot be determined.
The default value of this column is null.
BaseTableName
Specifies the name of the table or view in the data store that contains the column. A null value is used if the base table name cannot be determined.
The default value of this column is null.
BaseColumnName
Specifies the name of the column in the data store. This might be different than the column name returned in the ColumnName column if an alias was used. A null value is used if the base column name cannot be determined or if the rowset column is derived from, but is not identical to, a column in the database.
The default value of this column is null.


Chapter contents
Publication contents

Prev topic: PsqlDataAdapter Object
Next topic: PsqlError Object