Implementing DCL support
- Last Updated: May 12, 2026
- 2 minute read
- OpenAccess SDK
- Version 8.1
- Documentation
The DCL function allows setting up user accounts and defining user privileges. To implement the DCL function:
- In C/C++ register the ip_dcl() function in the dcl slot.
- Have the IP (the ip_getSupport () routine) return TRUE for the DCL commands you wish to support. This can be done by updating the support array in the ip_drv.c file to mark support for IP_SUPPORT_CREATE_USER, IP_SUPPORT_DROP_USER, IP_SUPPORT_CREATE_ROLE, IP_SUPPORT_DROP_ROLE, IP_SUPPORT_GRANT and IP_SUPPORT_REVOKE.
- Implement ip_dcl () to check the type of command and use the Privilege Management functions of the OpenAccess SDK SQL engine to get details about the DCL command. If the command is GRANT or REVOKE, get the list of privileges, using the
dam_getFirstPrivilege()anddam_nextPrivilege()functions. Check the type of privilege (system privilege, object privilege or role name). If the Privileges are Object Privileges, check the object names by usingdam_getFirstGrantedObject()anddam_getNextGrantedobject(). Get the list of Grantee(s) by the usingdam_getFirstGrantee()anddam_getNextGrantee(). Grant or revoke the specified privilege(s) from the grantee(s) that are referred to in the command. The Grantee can be a user name, role name or PUBLIC.
Summary of privilege management functions
| Function | Description |
| dam_getUser | Get the user information that is given in the CREATE USER and DROP USER commands. |
| dam_getRole | Get the role name that is given in the CREATE ROLE and DROP ROLE commands. |
| dam_firstPrivilege | Get the first privilege that are specified in GRANT and REVOKE commands. |
| dam_nextPrivilege | Get the next privilege that is specified in GRANT and REVOKE commands. |
| dam_firstGrantee | Get the name of the user/role that is specified in GRANT and REVOKE commands. |
| dam_nextGrantee | Get the next name of the user/role that is specified in GRANT and REVOKE commands. |
| dam_firstGrantedObject | Get the first object that is specified in GRANT and REVOKE commands. |
| dam_nextGrantedObject | Get the next object that is specified in GRANT and REVOKE commands. |