skip to main content
Interface Provider API : Reference : OAIP_privilege and OAIP_privilegeW
 

OAIP_privilege and OAIP_privilegeW

One of these functions must be implemented by the IP, if the IP is to support privileges. This function is called before the SQL engine processes any commands. It is passed in the user name, the operation code, and the fully qualified object name. The function should return TRUE if the specified user is allowed to perform the requested operation on the object.
The GETSUPPORT function should return true for IP_SUPPORT_PRIVILEGE.
Refer to the "Implementing Privilege Support" section in the OpenAccess SDK SQL Engine Programmer's Guide for more information.

OAIP_privilege (8-bit character version)

int OAIP_privilege(
    IP_HDBC ip_hdbc,
    int iCmdType,
    char * pcUserName,
    char * pcQualifier,
    char * pcOwner,
    char * pcName)
Table 21. Parameters for OAIP_privilege (8-bit Character Version)
Parameter
Type
Description
IN
ip_hdbc
IP_HDBC
The connection handle as defined by the IP.
iCmdType
int
The type of DCL operation.
pcUserName
char *
The name of the connected user.
pcQualifier
char *
The name of the database in which the table falls. This parameter can be used to distribute tables into physically different databases.
pcOwner
char *
The owner of this object.
pcName
char *
The name of this object.
RETURN
int
DAM_TRUE - the SQL engine can perform the requested operation.
DAM_FALSE - the operation is not authorized.

OAIP_privilegeW (Unicode version)

int OAIP_privilegeW(
    IP_HDBC ip_hdbc,
    int iCmdType,
    OAWCHAR * pcUserName,
    OAWCHAR * pcQualifier,
    OAWCHAR * pcOwner,
    OAWCHAR * pcName)
Table 22. Parameters for OAIP_privilegeW (Unicode Version)
Parameter
Type
Description
IN
ip_hdbc
IP_HDBC
The connection handle as defined by the IP.
iCmdType
int
The type of DCL operation.
pcUserName
OAWCHAR *
The name of the connected user.
pcQualifier
OAWCHAR *
The name of the database in which the table falls. This parameter can be used to distribute tables into physically different databases.
pcOwner
OAWCHAR *
The owner of this object.
pcName
OAWCHAR *
The name of this object.
RETURN
int
DAM_TRUE - the SQL engine can perform the requested operation.
DAM_FALSE - the operation is not authorized.
When calling the OAIP_privilege or OAIP_privilegeW function, the OpenAccess SDK SQL engine passes the full object information (qualifier.owner.name) for the following commands: CREATE TABLE, ALTER TABLE, DROP TABLE, CREATE VIEW, DROP VIEW.