Stat Extended (65)
The Stat Extended operation (B_EXTENDED_STAT) has several subfunctions that allow an application to gather information about an open file.
See the following subfunction topics for more information on each one.
Parameters
 
Prerequisites
The file must be open.
Procedure
1
2
3
4
5
Subfunction 1: Extended File Information
For the file specified by the input position block, this subfunction returns information about the extension files associated with the specified data file. Returned information includes number of extension files that exist, number returned by the function, and file names for the returned files.
Input Data Buffer Structure
To receive information about extension files, you must create an extended files descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the extended files subfunction, the MicroKernel Engine updates the value of the data buffer length parameter and returns an extended files structure in the data buffer, as illustrated in Table 32.
Subfunction 2: System Data Information
For the file specified by the input position block, this subfunction returns information about whether there is a system key defined on a file, and whether the file can be logged (transaction durable).
Input Data Buffer Structure
To receive information about a file’s use of system data, you must create a system data descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the system data subfunction, the MicroKernel Engine returns a system data structure in the data buffer, as follows.
Subfunction 3: Duplicate Record Conflict Information
For the file specified by the input position block, this subfunction returns information about duplicate record conflicts. Returned information includes the record address and key number that caused a Status Code 5 (Duplicate Key) on a previous failed insert or update operation.
Input Data Buffer Structure
To receive information about the record address and key number that caused the most recent Status Code 5 (Duplicate Key), you must create a duplicate record information descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the system data subfunction, the MicroKernel Engine returns a system data structure in the data buffer, as follows.
Subfunction 4: File Information
For the file specified by the input position block, this subfunction returns file information. Returned information includes: the internal file ID used by the MicroKernel Engine to identify the file, the number of file handles currently open, the timestamp of the last time the file was opened, and a variety of flags indicating file properties.
Input Data Buffer Structure
To receive information about an open file, you must create a file information descriptor in the data buffer, as follows.
Additional bytes needed for returned information. See Output Data Buffer Structure. For the file information subfunction, the MicroKernel Engine returns a file information structure in the data buffer.
Output Data Buffer Structure
For the file information subfunction, the MicroKernel Engine returns a file information structure in the data buffer, as follows.
The permitted values for the Flags field are described in the following tables.
Subfunction 5: Gateway Information
For the file specified by the input position block, this subfunction returns information about the Gateway engine that has control of the file.
Input Data Buffer Structure
To receive information about the Gateway engine that is responsible for the specified file, you must create a gateway information descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the gateway information subfunction, the MicroKernel Engine modifies the data buffer length parameter and returns a file information structure in the data buffer, as follows.
Subfunction 6: Lock Owner Identification
For the file specified by the input position block, this subfunction returns information about the cause of the most recent Status Code 84 or 85 that occurred when accessing the file.
Input Data Buffer Structure
To receive information about the cause of a Status Code 84 or 85, you must create a lock owner information descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the lock owner information subfunction, the MicroKernel Engine modifies the data buffer length parameter and returns a file information structure in the data buffer, as follows.
If there is no record in the MicroKernel Engine of a previous blocking client, then the output data buffer length is set to zero.
The permitted values for the Flags field are described in the following table.
Table 44
Subfunction 7: Security Information
This subfunction returns information about how the client was Authenticated and Authorized to access the current file. It also shows information about the Current Database being used for Security.
Input Data Buffer Structure
To receive Security information about how this handle is Authenticated what permissions it has, you must create a security information descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the security information subfunction, the MicroKernel modifies the data buffer length parameter and returns a file information structure in the data buffer, as follows.
Length of the buffer used to store the null terminated Handle Table Name string. Note: The table name will not be known unless the file is bound to a database (Referential Constraints, for example), or the file was opened using a URI connection string that referred to the file by its Table Name. For details about URI connection strings, see Database URIs in PSQL Programmer's Guide.
The permitted values for the two Flags fields are described in the following tables.
Table 47
 
Table 48
Subfunction 8: Listing of Table or File Name Causing a Status Code 71
This subfunction returns information on the table or data file that caused a status code 71, a violation of the referential integrity definitions. Returned information includes the file name, Btrieve operation code, and position of the record that caused the referential integrity error.
Input Data Buffer Structure
To receive information about an open file, you must create a file information descriptor in the data buffer, as follows.
Output Data Buffer Structure
For the file information subfunction, the MicroKernel Engine returns a file information structure in the data buffer, as follows. The data buffer supplied must be large enough to hold the data returned.
Result
If the Stat Extended operation is unsuccessful, the MicroKernel Engine returns one of the following status codes: