Hitachi

Hitachi Advanced Database Application Development Guide


16.10.9 SQLTablePrivileges, SQLTablePrivilegesW

Organization of this subsection

(1) Function

This ODBC function returns a list of tables and a list of access privileges associated with each table. The driver returns the information as a result set for the specified SQL statement.

(2) Format

(3) Arguments

StatementHandle

Specifies a statement handle.

Specify a value that was output by *OutputHandlePtr of SQLAllocHandle before this function is executed.

CatalogName

Specifies a catalog name of the table.

This argument is ignored, if specified. When you use this function, specify a null character string ("") or NULL.

NameLength1

Specifies the length of *CatalogName#1 or SQL_NTS.

This argument is ignored, if specified. When you use this function, specify 0.

SchemaName

Specifies a pattern character string#2 for schema names of the table. If NULL is specified, all schema names are processed.

NameLength2

Specifies the length of *SchemaName#1 or SQL_NTS. If 0 is specified, the search is not narrowed by the specification of SchemaName.

TableName

Specifies a pattern character string#2 for table names. If NULL is specified, all table names are processed.

NameLength3

Specifies the length of *TableName#1 or SQL_NTS. If 0 is specified, the search is not narrowed by the specification of TableName.

#1

The length must be in bytes for SQLTablePrivileges and in characters for SQLTablePrivilegesW.

#2

For details about the special characters that can be specified in pattern character strings, see Table 16‒10: Special characters that can be specified in pattern character strings.

(4) Return value

This ODBC function returns SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.

When SQLTablePrivileges or SQLTablePrivilegesW is executed, a result set is created. The following table shows the format of the result set that is returned.

Table 16‒16: Format of the result set that is returned.

Column No.

Type

Column name

Description

1

Varchar

TABLE_CAT

Catalog name

The function always returns a null value.

2

Varchar

TABLE_SCHEM

Schema name

3

Varchar

TABLE_NAME

Table name

4

Varchar

GRANTOR

User who grants access privileges

5

Varchar

GRANTEE

User who receives access privileges

6

Varchar

PRIVILEGE

Granted access privileges:

  • "SELECT": SELECT privilege

  • "INSERT": INSERT privilege

  • "UPDATE": UPDATE privilege

  • "DELETE": DELETE privilege

  • "TRUNCATE": TRUNCATE privilege

  • "REFERENCES": REFERENCES privilege

  • "IMPORT TABLE": IMPORT TABLE privilege

  • "REBUILD INDEX": REBUILD INDEX privilege

  • "GET COSTINFO": GET COSTINFO privilege

  • "EXPORT TABLE": EXPORT TABLE privilege

  • "MERGE CHUNK": MERGE CHUNK privilege

  • "CHANGE CHUNK COMMENT": CHANGE CHUNK COMMENT privilege

  • "CHANGE CHUNK STATUS": CHANGE CHUNK STATUS privilege

  • "ARCHIVE CHUNK": ARCHIVE CHUNK privilege

  • "UNARCHIVE CHUNK": UNARCHIVE CHUNK privilege

7

Varchar

IS_GRANTABLE

Whether a user who has received an access privilege can grant the access privilege to other HADB users

  • "YES": The user can grant the access privilege to other HADB users.

  • "NO": The user cannot grant the access privilege to other HADB users.

(5) SQLSTATE

This ODBC function returns one of the following SQLSTATE values:

SQLSTATE

Description

Remarks

Returned

01000

General warning

--

N

08S01

Communication link failure

N

24000

Invalid cursor status

The function was executed while a cursor was open.

Y

40001

Serialization failure

--

N

40003

Statement completion unknown

N

HY000

General error

N

HY001

Memory allocation error

Y

HY008

Operation cancelled

N

HY009

Invalid use of null pointer

N

HY010

Function sequence error

Y

HY013

Memory management error

N

HY090

Invalid string or buffer length

One of the arguments that stores a name length exceeded the maximum length for the corresponding name.

Y

HY117

Connection suspended

--

N

HYC00

Optional feature not implemented

N

HYT00

Timeout expired

N

HYT01

Connection timeout expired

N

IM001

Driver does not support this function

N

IM017

Invalid asynchronous polling

N

IM018

Incomplete asynchronous execution

N

Legend:

Y: This SQLSTATE might be returned by the HADB ODBC driver.

N: This SQLSTATE is not returned by the HADB ODBC driver.

--: None

(6) Notes

The information that can be acquired depends on the privileges of the HADB user who executes this method. For details about the relationship between privileges and the information that can be acquired, see the topic Scope of information in dictionary tables and system tables that can be referenced by HADB users in the HADB Setup and Operation Guide.