16.10.1 SQLColumnPrivileges, SQLColumnPrivilegesW
- Organization of this subsection
(1) Function
These functions return a list of privileges that are associated with the columns of the specified table. The result is output in the form of an SQL result set.
(2) Format
-
For SQLColumnPrivileges
SQLRETURN SQLColumnPrivileges ( SQLHSTMT StatementHandle, /* In */ SQLCHAR * CatalogName, /* In */ SQLSMALLINT NameLength1, /* In */ SQLCHAR * SchemaName, /* In */ SQLSMALLINT NameLength2, /* In */ SQLCHAR * TableName, /* In */ SQLSMALLINT NameLength3, /* In */ SQLCHAR * ColumnName, /* In */ SQLSMALLINT NameLength4 /* In */ )
-
For SQLColumnPrivilegesW
SQLRETURN SQLColumnPrivilegesW ( SQLHSTMT StatementHandle, /* In */ SQLWCHAR * CatalogName, /* In */ SQLSMALLINT NameLength1, /* In */ SQLWCHAR * SchemaName, /* In */ SQLSMALLINT NameLength2, /* In */ SQLWCHAR * TableName, /* In */ SQLSMALLINT NameLength3, /* In */ SQLWCHAR * ColumnName, /* In */ SQLSMALLINT NameLength4 /* In */ )
(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 for the table.
The specified information is ignored, but the specification itself is required. Therefore, when you use this function, specify a null character string ("") or NULL.
- NameLength1
-
Specifies either the length of *CatalogName#1 or the keyword SQL_NTS.
The specified information is ignored, but specification itself is required. Therefore, to use this function, specify 0.
- SchemaName
-
Specifies the schema name of a table. You can use a pattern character string#2 to specify the schema name.
If a NULL pointer or empty string ("") only is specified for SchemaName, the function assumes that only the pattern character string '%' is specified for SchemaName.
- NameLength2
-
Specifies either the length of *SchemaName#1 or the keyword SQL_NTS.
If 0 is specified for NameLength2, the function assumes that only the pattern character string '%' is specified for SchemaName.
- TableName
-
Specifies a table name. The table name can be specified by using a pattern character string#2.
If a NULL pointer or empty string ("") only is specified for TableName, the function assumes that only the pattern character string '%' is specified for TableName.
- NameLength3
-
Specifies either the length of *TableName#1 or the keyword SQL_NTS.
If 0 is specified for NameLength3, the function assumes that only the pattern character string '%' is specified for TableName.
- ColumnName
-
Specifies the column name. The column name can be specified by using a pattern character string#2.
If a NULL pointer or empty string ("") only is specified for ColumnName, the function assumes that the pattern character string '%' is specified for ColumnName.
- NameLength4
-
Specifies either the length of *ColumnName#1 or the keyword SQL_NTS.
If 0 is specified for NameLength4, the function assumes that only the pattern character string '%' is specified for ColumnName.
- #1
-
The length must be in bytes for SQLColumnPrivileges and in characters for SQLColumnPrivilegesW.
- #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_ERROR, or SQL_INVALID_HANDLE.
The following table describes the format of the result set that is returned when this function is executed.
Column No. |
Data type |
Column name |
Description |
---|---|---|---|
1 |
Varchar |
TABLE_CAT |
Catalog name (A null value is always returned.) |
2 |
Varchar |
TABLE_SCHEM |
Schema name |
3 |
Varchar |
TABLE_NAME |
Table name |
4 |
Varchar |
COLUMN_NAME |
Column name |
5 |
Varchar |
GRANTOR |
User who granted the access privilege |
6 |
Varchar |
GRANTEE |
User whom the access privilege is granted to |
7 |
Varchar |
PRIVILEGE |
The granted access privilege is returned.
|
8 |
Varchar |
IS_GRANTABLE |
Whether the access privilege grantee (user whom the access privilege is granted to) can grant the access privilege to other users is returned.
|
(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 |
The value of an argument that stores a name length either exceeds the maximum length of the corresponding name or is a negative value other than SQL_NTS. |
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