Resources

ISASDataSetInfo90 Custom Interface

The ISASDataSetInfo90 interface provides a way to return data set metadata that does not directly map to OLE DB constructs. This extension to the ISASDataSetInfo interface supports four methods:

Method Description
GetDataSetInfo Returns file metadata that is specific to SAS.
GetRecordCounts Returns information about the number of records that are associated with a file.
GetDataSetInfo_2 Returns file metadata that is specific to SAS. This is a revised version of GetDataSetInfo, which permits larger record counts.
GetRecordCounts_2 Returns information about the number of records that are associated with a file. This is a revised version of GetRecordCounts, which permits larger record counts.


The GetDataSetInfo_2 Method

As part of the ISASDataSetInfo90 custom interface, the GetDataSetInfo_2 method returns SAS file metadata that is not supported by predefined OLE DB constructs.

HRESULT GetDataSetInfo_2(
        SASDATASETINFO90 **     ppDataSetInfo,
        OLECHAR **              ppStringsBuffer );

Parameters

ppDataSetInfo
[out]
A pointer to the memory where a SASDATASETINFO90 structure will be returned. If *ppDataSetInfo is NULL when GetDataSetInfo_2 is executed, then the provider allocates memory for this structure and returns the address to the memory location specified by this pointer. When the memory is no longer needed, you use IMalloc::Free to free the memory. As an alternative to depending on the provider to allocate memory for the SASDATASETINFO90 structure, the consumer can allocate memory for this structure and pass in the address as *ppDataSetInfo.
ppStringsBuffer
[out]
A pointer to the memory where column string names will be returned. All of the column string values (names) are stored within a single allocation block. If no returned columns have string names, or if this method terminates as the result of an error, *ppStringsBuffer will be set to NULL. If one or more columns has a string name, then the specified memory location contains the string values (names) for the columns. When the names are no longer needed, you use IMalloc::Free to release the memory. If *pcColumns is 0 when calculated or this method terminates as the result of an error, the provider does not allocate any memory and ensures that *ppStringsBuffer is a NULL pointer. Each string value stored in this buffer is terminated by a null-termination character.

Return Codes

S_OK
indicates that the method succeeded.
E_FAIL
indicates that a provider-specific error occurred.
E_INVALIDARG
indicates that ppDataSetInfo or ppStringsBuffer was a null pointer.
E_OUTOFMEMORY
indicates that the provider was unable to allocate sufficient memory for the data set information structures.

Usage Notes

This method makes no logical change to the state of the object.

Under some circumstances, the actual values for the llLogicalRecordCount and llPhysicalRecordCount members of the SASDATASETINFO90 structure will not be immediately available. This is the case when the underlying data set is something other than a physical SAS data file (for example, a SAS data view, a WHERE clause, or a SAS/ACCESS file). In those cases, the members return a -1. To determine the actual values, call ISASDataSetInfo90::GetRecordCounts_2.

The SASDATASETINFO90 Structure

The GetDataSetInfo_2 method returns file metadata in a SASDATASETINFO90 structure.

typedef struct tagSASDATASETINFO90 {
        LONGLONG llLogicalRecordCount;
        LONGLONG llPhysicalRecordCount;
        LONG lRecordLength;
        DATE dDateCreated;
        DATE dDateModified;
        LPOLESTR pwszLabel;
        LPOLESTR pwszCompressionRoutine;
        BOOL fIsIndexed;
} SASDATASETINFO90;

The elements (members) of the SASDATASETINFO90 structure are described in the following table:

Element Description
llLogicalRecordCount The number of logical records in the data set. This is the number of records that are returned if the caller sequentially reads through the entire data set. If this value is not immediately available, a value of -1 is returned in this field. This is the case when the data set is not a physical file (for example, a SAS data view or a WHERE clause). In such cases, you can use the GetRecordCounts_2 method to computationally determine this value.
llPhysicalRecordCount The number of physical records in the data set. This number can be greater than the number of logical records and can indicate the magnitude of the physical file size. If this value is not immediately available, a value of -1 is returned in this field; this is the case when the data set is not a physical SAS file (for example, a SAS data view or a SAS/ACCESS table). In such cases, you can use the GetRecordCounts_2 method to computationally determine this value.
lRecordLengthThe physical record length in bytes.
dDateCreatedThe date that the data set was created.
dDateModifiedThe date that the data set was last modified.
pwszLabelThe data set label. NULL if none is set.
pwszCompressionRoutineThe name of the compression algorithm used. NO if none is set.
fIsIndexedTRUE if an index exists on the data set.


The GetRecordCounts_2 Method

As part of the ISASDataSetInfo90 custom interface, the GetRecordCounts_2 method forces a count of the number of logical and physical records in a data set. Call this method only when GetDataSetInfo_2 returns -1 in the SASDATASETINFO90 llLogicalRecordCount and llPhysicalRecordCount fields.

HRESULT GetRecordCounts_2(
        LONGLONG *          pllLogicalRecordCount,
        LONGLONG *          pllPhysicalRecordCount );

Parameters

pllLogicalRecordCount
[out]
A pointer to the memory where the logical number of records in the data set will be returned. This number indicates how many rows are returned if every row is read once.
pllPhysicalRecordCount
[out]
A pointer to the memory where the physical number of records in the data set will be returned. This number might be greater than the number of logical records. It indicates how many records are allocated in the data set. This value multiplied by the length of an individual record (lRecordLength returned by GetDataSetInfo_2) approximates the magnitude of the physical size of the data set.

Return Codes

S_OK
indicates that the method succeeded.
E_FAIL
indicates that a provider-specific error occurred.
E_INVALIDARG
indicates that pllLogicalRecordCount or pllPhysicalRecordCount was a null pointer.

Usage Notes

This method determines record counts by forcing a sequential read of the data set. If the underlying data set is large, the read can take a significant amount of time.

CAUTION:
Some data sets contain millions of records. Executing this method on a very large data set may incur a significant performance cost.


See Also:

About Custom Interfaces
ISASDataSetInfo Custom Interface
ISASColumnsInfo Custom Interface