Please enable JavaScript to view this site.

ESL Documentation

Level 2 subroutine

Return a list of tables and their associated privileges.

call EDSTablePrivileges(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 EDSTABLE_STRUCT structure containing table information.

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 EDSTABLEPRIV_STRUCT structures that contain the list of tables and the privileges associated with each table.

Description

The TABLE.OWNER and TABLE.NAME arguments accept search patterns.

EDSTablePrivileges returns the results as a standard result set, ordered by TABLE_QUALIFIER, TABLE_OWNER, TABLE_NAME, and PRIVILEGE. The following table lists the columns in the result set. This information is arranged as an array of EDSTABLEPRIV_STRUCT structures.

Column Name

Data Type

Comments

TABLE_QUALIFIER

string

Table qualifier identifier; NULL if not applicable to the data source.

TABLE_OWNER

string

Table owner identifier; NULL if not applicable to the data source.

TABLE_NAME

string not NULL

Table identifier.

GRANTOR

string

Identifier of the user who granted the privilege; NULL if not applicable to the data source.

GRANTEE

string not NULL

Identifier of the user to whom the privilege was granted.

PRIVILEGE

string not NULL

Identifies the table privilege. May be one of the following or a data source–specific privilege.

SELECT: the grantee is permitted to retrieve data for one or more columns of the table.

INSERT: the grantee is permitted to insert new rows containing data for one or more columns into the table.

UPDATE: the grantee is permitted to update the data in one or more columns of the table.

DELETE: the grantee is permitted to delete rows of data from the table.

REFERENCES: the grantee is permitted to refer to one or more columns of the table within a constraint  (for example, a unique, referential, or table check constraint).

The scope of action permitted the grantee by a given table privilege is data-source dependent. For example, the UPDATE  privilege might permit the grantee to update all columns in a table on one data source, and only those columns for which the grantor has the UPDATE privilege on another data source.

IS_GRANTABLE

Varchar(3)

Indicates whether the grantee is permitted to grant the privilege to other users: “YES”, “NO” or NULL if unknown or not applicable to the data source.

Return Value

EDSTablePrivileges returns EDS_SUCCESS, EDS_ERROR, or EDS_INVALID_HANDLE.

When EDSTablePrivileges 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 EDSTablePrivileges.

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.

S1C00

Driver not capable

A table qualifier or a table owner was specified and the driver or data source does not support one or either of the qualifiers. A string search pattern was specified for the table owner, table name, or column name, and the driver or 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 result set. The timeout period is set through EDSSetStmtOption, EDS_QUERY_TIMEOUT.

Example

For a code example of a similar function, see EDSColumns.

See Also

EDSBindCol assigns an ESL variable for a column in a result set.

EDSCancel cancels statement processing.

EDSColumnPrivileges returns privileges for a column or columns.

EDSExtendedFetch fetches a block of data or scrolls through a result set.

EDSFetch fetches a row of data.

EDSStatistics returns table statistics and indexes.

EDSTables returns a list of tables in a data source.