DB_TablePrivileges Function

Action

Returns a list of tables and the privileges associated with each one. The information is returned as a result set on the specified statement handle.

Syntax

hstmnt = DB_TablePrivileges (hdbc, catalog-name, schema-name, table-name)
Variable Description
hstmnt

The returned handle to the executed SQL statement. This is an input parameter for other DBTester functions, for example DB_FetchNext. HSQL.

hdbc

The handle to a database as returned by DB_Connect. HDATABASE.

catalog-name

Catalog name. STRING.

schema-name

String search pattern for schema names. STRING.

table-name

String search pattern for table names. STRING.

Notes

  • DB_TablePrivileges corresponds to SQLTablePrivileges. For additional information about SQLTablePrivileges, see SQLTablePrivileges.

  • The following wildcard characters are supported for arguments:
    Wildcard character Matches
    % The percent sign matches any character sequence.
    _ The underscore matches any single character.
  • To omit catalog-name or schema-name, specify the arguments as an empty string ("").

  • When you receive a valid statement handle, you can call DB_FetchNext or DB_FetchPrevious to manipulate the information.

Example

[ ] STRING cat, sch, tab, ignore, name, grantor,grantee, priv
[ ] hstmnt = DB_TablePrivileges (hdbc, cat, sch, tab)
[ ] 
[ ] // retrieve tables, privilege grantee/grantee,& privileges; ignore rest.
[-] while (DB_FetchNext (hstmt, ignore, ignore, name,grantor, grantee, priv) == TRUE) { 
	[ ] //print table names, privilege grantee/grantee,& privileges... 
[ ] }