Optim Data Privacy Providers  11.7.0
 All Data Structures Files Functions Variables Macros Groups Pages
Example for GetInfo()
In the following example shows how to get column information
RETVAL retval = ODPPSUCCESS;
short sCount = 0; // To loop through src col
short *pIndex = NULL; // Holds value of index
short sSrcColCount = 0;
int iBufLen = 0;
DP_MYCTRL_DEF *pMyCtrlBlk = NULL;
DP_SRCCOL_DEF_X *pSrcCol = NULL;
// Get the CtrlBlk allocated in Init
pMyCtrlBlk = (DP_MYCTRL_DEF*)pCtrlBlk->pExt;
if(NULL == pMyCtrlBlk)
{
return MY_ERR_MYCTRLBLK_NOT_FOUND;
}
// Check the requested info and return information
switch(sRequest)
{
{
sSrcColCount = pCtrlBlk->sSrcColCount;
// Check if pointer is NULL
if(NULL == ptr)
{
// Just Return the buffer size required
*pBufLen = (int)(sSrcColCount * sizeof(short));
}
else
{
//Check if buffer length is less than then size required
//for total number of source column(s)
if(*pBufLen < (int)(sSrcColCount * sizeof(short)))
{
return MY_ERR_GETINFO_BUFFER_SHORT;
}
// Get source column list address
pSrcCol = &pCtrlBlk->SrcCol;
if(pSrcCol == NULL)
{
// Source column list is empty
return ODPPFAILURE;
}
pIndex = (short *)ptr;
for(sCount = 0;
sCount < pCtrlBlk->sSrcColCount && (pIndex != NULL);
sCount++)
{
// Store source column index
*pIndex = pSrcCol->sColIndex;
pIndex++;
// move to next column
pSrcCol = pSrcCol->pNext;
iBufLen = iBufLen + (int)sizeof(short);
}
// return total size required for source columns
*pBufLen = iBufLen;
}
}
break;
{
// Get the destination col Index and return
if(NULL == ptr)
{
// Just Return the buffer size required
*pBufLen = sizeof(short);
}
else
{
// Check if buffer length is less than size of dest col
if(*pBufLen < sizeof(short))
{
return MY_ERR_GETINFO_BUFFER_SHORT;
}
// Store source column index and size
pIndex = (short *)ptr;
*pIndex = pMyCtrlBlk->sDestColIndex;
*pBufLen = sizeof(short);
}
}
break;
default :
// Requested Information not supported
retval = MY_INFO_REQUEST_NOT_SUPPORTED;
break;
}
return retval;