Level 1 subroutine
Return a list of table names stored in a specific data source.
call EDSTables(HSTMT_IV, TABLE_STRUCT, MAXROWS_IV, NUMROWS_IV, ARRAY_STRUCT)
•HSTMT_IV An input integer value that indicates the statement handle.
•TABLE_STRUCT An input EDSTABLEDEF_STRUCT structure containing the TABLE.QUALIFIER, TABLE.OWNER, TABLE.NAME, and TABLE.TYPE. TABLE.REMARKS is an output-only field.
•MAXROWS_IV An input integer value indicating the maximum number of rows in the result array.
•NUMROWS_IV An output integer value indicating the actual number of rows in the result array.
•ARRAY_STRUCT An output array of EDSTABLEDEF_STRUCT structures. Refer to "Description" for more information about the format of the output.
Description
EDSTables lists all tables in the requested range. A user may or may not have SELECT privileges to any of these tables. To check accessibility, your application can do one of the following:
•Call EDSGetInfo and check the EDS_ACCESSIBLE_TABLES result column.
•Call EDSTablePrivileges to check the privileges for each table.
Otherwise, your application must be able to handle a situation in which the user selects a table for which SELECT privileges are not granted.
The TABLE.QUALIFIER, TABLE.OWNER, and TABLE.NAME arguments constrain the search for table names. Each of these arguments supports a character string search pattern. For more information about valid search patterns, see Catalog Commands.
To support enumeration of qualifiers and owners, EDSTables defines the following special semantics for the QUALIFIER, OWNER, and NAME arguments. If QUALIFIER is a string containing a single percent (“%”) and OWNER and NAME are empty strings, then the results set contains a list of valid qualifiers for the data source. If OWNER is a string containing a single percent (“%”) and QUALIFIER and NAME are empty strings, then the results set contains a list of valid owners for the data source.
If TABLE.TYPE is not an empty string, it must contain a list of comma-separated, single quoted values for the types of interest (for example, "'TABLE' and 'VIEW'"). Valid table type identifiers may include 'TABLE', 'VIEW', 'SYSTEM TABLE', 'ALIAS', 'SYNONYM', or other data source-specific identifiers.
If MAXROWS_IV=NUMROWS_IV, then there were more rows of data to fetch than there were structures in the array. To retrieve the full set of results, the user must RESIZE the array and call the function again.
EDSTables returns results as an array of structures. The following table describes each element returned in a structure.
Element |
Comments |
TABLE.QUALIFIER |
The table qualifier identifier. |
TABLE.OWNER |
The table owner identifier. |
TABLE.NAME |
The table identifier. |
TABLE.TYPE |
The table type identifier, which must be one of the following: TABLE, VIEW, SYSTEM TABLE, ALIAS, SYNONYM, or a data-source specific type of identifier. |
TABLE.REMARKS |
A description of the table. |
Use a null string value for TABLE.QUALIFIER and TABLE.OWNER to retrieve all qualifiers or all owners, respectively.
Return Value
EDSTables returns EDS_SUCCESS, EDS_ERROR, or EDS_INVALID_HANDLE.
When EDSTables returns EDS_ERROR, you can obtain an associated SQLSTATE value with more specific information by calling EDSError. The following table lists each typical SQLSTATE value and explains each one in the context of the command EDSTables.
The following table lists possible SQLSTATE values:
SQL STATE |
Error |
Description |
08S01 |
Communication link failure |
The communication link between the driver and the data source to which the driver was connected failed before the function completed processing. |
24000 |
Invalid cursor state |
Results were pending on the statement handle from a previous SELECT statement or a cursor associated with the statement handle had not been closed. |
IM001 |
Driver does not support this function |
The driver associated with the statement handle does not support the function. |
S1000 |
General error |
An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. The error message returned by EDSError in the argument ERRORTEXT describes the error and its cause. |
S1001 |
Memory allocation failure |
The driver was unable to allocate the memory required to support execution or completion of the function. |
S1008 |
Operation cancelled |
Asynchronous processing was enabled for the statement handle. The function was called and before it completed execution, EDSCancel was called on the statement handle. Then the function was called again on the statement handle. |
S1010 |
Function sequence error |
An asynchronously executing function (not this one) was called for the statement handle and was still executing when this function was called. |
S1090 |
Invalid string or buffer length |
The value of one of the name length arguments was less than 0. |
S1102 |
Table type out of range |
An invalid TABLE.TYPE value was specified. |
S1C00 |
Driver not capable |
A table qualifier or a table owner was specified and the driver or data source does not support one or both of the qualifiers. A string search pattern was specified for the table owner or table name, and the data source does not support search patterns for one or more of those arguments. |
S1T00 |
Timeout expired |
The timeout period expired before the data source returned the requested result set. The timeout period is set through EDSSetStmtOption, EDS_QUERY_TIMEOUT. |
See Also
EDSColumns returns a list of columns for a specified table or tables.
EDSTablePrivileges returns privileges for a table.
EDSGetInfo determines whether or not the user has access to all tables in the result set.