Optim Data Privacy Providers  11.7.0
 All Data Structures Files Functions Variables Macros Groups Pages
Example
Collaboration diagram for Example:

Example for Lookup Service Provider with a Hash Lookup.

Service Provider Initialization:

DP_SVC_DEF SvcDef; //Service Definition structure
DP_FIELD_DEF FldDef[MAX_COLUMNS]; //Array of DP_FIELD_DEF structures
DP_INIT_OP_DEF InitParameters[PARAMETER_MAX_SIZE]; //Array of DP_INIT_OP_DEF structures
DP_ROWSET_DEF rowSet; //RowSet which contains the rows to be masked
DP_ROW_DEF **pRow; //Pointer used to create the list of rows in rowSet
DP_FIELD_DATA_DEF *pData; //Pointer used to create the list of data fields
int iSvcToken; //Service Token
RETVAL retVal; //return code
short sMethod; //Method to use for masking
char Line[INPUT_LINE_MAX_SIZE]; //character buffer used to store the input value read from the CSV file
int *piRows = NULL; //Integer pointer to hold the row count in rowSet
int i = 0; //Counter
int j = 0; //Counter
int iLen = 0; //Length of the buffer
int iCnt = 0; //Count of rows in the rowSet
FILE *fin = NULL; //File handle for input CSV file
char PrvName[] = "LKP"; //Provider name in MBCS
DP_ROWSET_DEF *pRowSet = NULL; //RowSet pointer
DP_ROW_DEF *pCurRow = NULL; //Row pointer
DP_ROW_DEF *pPrevRow = NULL; //Row pointer
DP_FIELD_DATA_DEF *pPrev = NULL; //data field pointer
#ifndef USE_ODPP_MBCS_CHAR_CALLS
ODPP_WCHAR LdsId[] = L"EMP_LKP"; //Lookup data source name(LDS identifier string)
ODPP_WCHAR ConnStr[] = L"SAMPLE"; //connection string to connect to database
ODPP_WCHAR LDSSchema[] = L"ODPP"; //LDS table schema name
ODPP_WCHAR SearchCols[] = L"EMPNONUM, FIRSTNME" // Search Column names
ODPP_WCHAR ReplaceCols[] = L"LASTNAME, HIREDATE, SALARY" // Replace column names
#else
char LdsId[] = "EMP_LKP"; //Lookup data source name(LDS identifier string)
char ConnStr[] = "SAMPLE"; //connection string to connect to database
char LDSSchema[] = "ODPP"; //LDS table schema name
char SearchCols[] = "EMPNONUM, FIRSTNME" // Search Column names
char ReplaceCols[] = "LASTNAME, HIREDATE, SALARY" // Replace column names
#endif
//Clear the Field Definition
memset(FldDef, 0, MAX_COLUMNS * sizeof(DP_FIELD_DEF));
//Clear the Parameter definition
memset(InitParameters, 0, PARAMETER_MAX_SIZE * sizeof(DP_INIT_OP_DEF));
//Clear the Service Definition
memset(&SvcDef, 0, sizeof(DP_SVC_DEF));
//Initialize the DP_FIELD_DEF structure
for(iTempCnt=0; iTempCnt < MAX_COLUMNS; iTempCnt++)
{
}
//Initialize the DP_INIT_OP_DEF structure
for(iTempCnt=0; iTempCnt < PARAMETER_MAX_SIZE; iTempCnt++)
{
INITIALIZE_ODPP_STRUCT(InitParameters[iTempCnt], DP_INIT_OP_DEF)
}
//Initialize the DP_SVC_DEF structure
//list of operands
//Set the parameter list to the Service Definition
SvcDef.pParams = &InitParameters[0];
//Set the field list to the field definition
SvcDef.pFldDef = &FldDef[0];
//Set this value to FALSE to return the masked value in the source buffer of the destination column
SvcDef.bCopyToDest = FALSE;
//Create the list of Field Defines
#ifndef USE_ODPP_MBCS_CHAR_CALLS
//For wide character (Unicode) format
//Column 1
//To indicate that column name is in wide character format and USE_ODPP_MBCS_CHAR_CALLS is not defined
FldDef[0].cSubType = 'W';
//Allocate the pWC struct
FldDef[0].CN.pWC = (DPFD_WC_SS *) malloc(sizeof(DPFD_WC_SS));
if(NULL == FldDef[0].CN.pWC)
{
printf("\nFailed to allocate pWC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
memset(FldDef[0].CN.pWC, 0, sizeof(DPFD_WC_SS));
//Code page
FldDef[0].iDataCodePage = 0;
//DBMS type
FldDef[0].cDataDBMSType = 0;
//Store the maximum size for column name buffer in bytes
FldDef[0].iColNameBytes = (MAX_COLNAME_SIZE + 1) * sizeof(ODPP_WCHAR);
//Allocate buffer for column name in wide character (Unicode) format
FldDef[0].CN.pWC->pColName = (ODPP_WCHAR *) malloc(FldDef[0].iColNameBytes);
if(NULL == FldDef[0].CN.pWC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[0].CN.pWC->pColName, 0, FldDef[0].iColNameBytes);
//Set the column name in FldDef
wcscpy(FldDef[0].CN.pWC->pColName, L"EMPNONUM");
//Set the data type for the EMPNONUM column
FldDef[0].sDatatype = ODPPDATATYPE_INTEGER;
//Column 2
//To indicate that column name is in wide character(Unicode) format and USE_ODPP_MBCS_CHAR_CALLS is not defined
FldDef[1].cSubType = 'W';
//Allocate the pWC struct
FldDef[1].CN.pWC = (DPFD_WC_SS *) malloc(sizeof(DPFD_WC_SS));
if(NULL == FldDef[1].CN.pWC)
{
printf("\nFailed to allocate pWC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
memset(FldDef[1].CN.pWC, 0, sizeof(DPFD_WC_SS));
//code page
FldDef[1].iDataCodePage = 0;
//DBMS type
FldDef[1].cDataDBMSType = 0;
//Store the maximum size for column name buffer in bytes
FldDef[1].iColNameBytes = (MAX_COLNAME_SIZE + 1) * sizeof(ODPP_WCHAR);
//Allocate buffer for column name in wide character (Unicode) format
FldDef[1].CN.pWC->pColName = (ODPP_WCHAR *) malloc(FldDef[1].iColNameBytes);
if(NULL == FldDef[1].CN.pWC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[1].CN.pWC->pColName, 0, FldDef[1].iColNameBytes);
//Set the column name in FldDef
wcscpy(FldDef[1].CN.pWC->pColName, L"FIRSTNME");
//Set the data type for the FIRSTNME column
FldDef[1].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
//Column 3
//To indicate that column name is in wide character(Unicode) format and USE_ODPP_MBCS_CHAR_CALLS is not defined
FldDef[2].cSubType = 'W';
//Allocate the pWC struct
FldDef[2].CN.pWC = (DPFD_WC_SS *) malloc(sizeof(DPFD_WC_SS));
if(NULL == FldDef[2].CN.pWC)
{
printf("\nFailed to allocate pWC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
memset(FldDef[2].CN.pWC, 0, sizeof(DPFD_WC_SS));
//code page
FldDef[2].iDataCodePage = 0;
//DBMS type
FldDef[2].cDataDBMSType = 0;
//Store the maximum size for column name buffer in bytes
FldDef[2].iColNameBytes = (MAX_COLNAME_SIZE + 1) * sizeof(ODPP_WCHAR);
//Allocate buffer for column name in wide character (Unicode) format
FldDef[2].CN.pWC->pColName = (ODPP_WCHAR *) malloc(FldDef[2].iColNameBytes);
if(NULL == FldDef[2].CN.pWC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[2].CN.pWC->pColName, 0, FldDef[2].iColNameBytes);
//Set the column name in FldDef
wcscpy(FldDef[2].CN.pWC->pColName, L"LASTNAME");
//Set the data type for the LASTNAME column
FldDef[2].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
//Column 4
//To indicate that column name is in wide character(Unicode) format and USE_ODPP_MBCS_CHAR_CALLS is not defined
FldDef[3].cSubType = 'W';
//Allocate the pWC struct
FldDef[3].CN.pWC = (DPFD_WC_SS *) malloc(sizeof(DPFD_WC_SS));
if(NULL == FldDef[3].CN.pWC)
{
printf("\nFailed to allocate pWC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
memset(FldDef[3].CN.pWC, 0, sizeof(DPFD_WC_SS));
//code page
FldDef[3].iDataCodePage = 0;
//DBMS type
FldDef[3].cDataDBMSType = 0;
//Store the maximum size for column name buffer in bytes
FldDef[3].iColNameBytes = (MAX_COLNAME_SIZE + 1) * sizeof(ODPP_WCHAR);
//Allocate buffer for column name in wide character (Unicode) format
FldDef[3].CN.pWC->pColName = (ODPP_WCHAR *) malloc(FldDef[3].iColNameBytes);
if(NULL == FldDef[3].CN.pWC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[3].CN.pWC->pColName, 0, FldDef[3].iColNameBytes);
//Set the column name in FldDef
wcscpy(FldDef[3].CN.pWC->pColName, L"HIREDATE");
//Set the data type for the HIREDATE column
FldDef[3].sDatatype = ODPPDATATYPE_ODBC_DATE; //Set the data type for the source column
//Column 5
//To indicate that column name is in wide character(Unicode) format and USE_ODPP_MBCS_CHAR_CALLS is not defined
FldDef[4].cSubType = 'W';
//Allocate the pWC struct
FldDef[4].CN.pWC = (DPFD_WC_SS *) malloc(sizeof(DPFD_WC_SS));
if(NULL == FldDef[4].CN.pWC)
{
printf("\nFailed to allocate pWC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
memset(FldDef[4].CN.pWC, 0, sizeof(DPFD_WC_SS));
//code page
FldDef[4].iDataCodePage = 0;
//DBMS type
FldDef[4].cDataDBMSType = 0;
//Store the maximum size for column name buffer in bytes
FldDef[4].iColNameBytes = (MAX_COLNAME_SIZE + 1) * sizeof(ODPP_WCHAR);
//Allocate buffer for column name in wide character (Unicode) format
FldDef[4].CN.pWC->pColName = (ODPP_WCHAR *) malloc(FldDef[4].iColNameBytes);
if(NULL == FldDef[4].CN.pWC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[4].CN.pWC->pColName, 0, FldDef[4].iColNameBytes);
//Set the column name in FldDef
wcscpy(FldDef[4].CN.pWC->pColName, L"SALARY");
//Set the data type for the SALARY column
FldDef[4].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
#else
//For mixed character (SBCS/MBCS) format
//Column 1
//To indicate that column name is in mixed character (SBCS/MBCS) format and USE_ODPP_MBCS_CHAR_CALLS is defined
FldDef[0].cSubType = 'M';
//Allocate the pMC struct
FldDef[0].CN.pMC = (DPFD_MC_SS *) malloc(sizeof(DPFD_MC_SS));
if(NULL == FldDef[0].CN.pMC)
{
printf("\nFailed to allocate pMC struct of DP_FIELD_DEF\n");
return ODPPFAILURE;
}
//Clear the DPFD_MC_SS structure
memset(FldDef[0].CN.pMC, 0, sizeof(DPFD_MC_SS));
//For system default codepage
FldDef[0].iDataCodePage = -1;
//DBMS type code
FldDef[0].cDataDBMSType = RDB_NONE;
//Store the maximum size for column name buffer
FldDef[0].iColNameBytes = (MAX_COLNAME_SIZE + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate buffer for column name is in mixed character (SBCS/MBCS) format
FldDef[0].CN.pMC->pColName = (char *) malloc(FldDef[0].iColNameBytes);
if(NULL == FldDef[0].CN.pMC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[0].CN.pMC->pColName, 0, FldDef[0].iColNameBytes);
//Set the column name in FldDef
strcpy(FldDef[0].CN.pMC->pColName, "EMPNONUM");
//Set the data type for the EMPNONUM column
FldDef[0].sDatatype = ODPPDATATYPE_INTEGER; //Set the data type for the source column
//Column 2
// To indicate that column name is mixed character (SBCS/MBCS) format and USE_ODPP_MBCS_CHAR_CALLS is defined
FldDef[1].cSubType = 'M';
//Allocate the pMC struct
FldDef[1].CN.pMC = (DPFD_MC_SS *) malloc(sizeof(DPFD_MC_SS));
if(NULL == FldDef[1].CN.pMC)
{
printf("\nFailed to allocate pMC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
//Clear the DPFD_MC_SS structure
memset(FldDef[1].CN.pMC, 0, sizeof(DPFD_MC_SS));
//For system default codepage
FldDef[1].iDataCodePage = -1;
//DBMS type code
FldDef[1].cDataDBMSType = RDB_NONE;
//Store the maximum size for column name buffer in bytes
FldDef[1].iColNameBytes = (MAX_COLNAME_SIZE + 1) * ODPP_MBCS_CHAR_BYTES ;
//Allocate buffer for column name in mixed character (SBCS/MBCS) format
FldDef[1].CN.pMC->pColName = (char *) malloc(FldDef[1].iColNameBytes);
if(NULL == FldDef[1].CN.pMC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[1].CN.pMC->pColName, 0, FldDef[1].iColNameBytes);
//Set the column name in FldDef
strcpy(FldDef[1].CN.pMC->pColName, "FIRSTNME");
//Set the data type for the FIRSTNME column
FldDef[1].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
//Column 3
//To indicate that column name is mixed character (SBCS/MBCS) format and USE_ODPP_MBCS_CHAR_CALLS is defined
FldDef[2].cSubType = 'M';
//Allocate the pMC struct
FldDef[2].CN.pMC = (DPFD_MC_SS *) malloc(sizeof(DPFD_MC_SS));
if(NULL == FldDef[2].CN.pMC)
{
printf("\nFailed to allocate pMC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
//Clear the DPFD_MC_SS structure
memset(FldDef[2].CN.pMC, 0, sizeof(DPFD_MC_SS));
//For system default codepage
FldDef[2].iDataCodePage = -1;
//DBMS type code
FldDef[2].cDataDBMSType = RDB_NONE;
//Store the maximum size for column name buffer
FldDef[2].iColNameBytes = (MAX_COLNAME_SIZE + 1) * ODPP_MBCS_CHAR_BYTES ;
//Allocate buffer for column name in mixed character (SBCS/MBCS) format
FldDef[2].CN.pMC->pColName = (char *) malloc(FldDef[2].iColNameBytes);
if(NULL == FldDef[2].CN.pMC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[2].CN.pMC->pColName, 0, FldDef[2].iColNameBytes);
//Set the column name in FldDef
strcpy(FldDef[2].CN.pMC->pColName, "LASTNAME");
//Set the data type for the LASTNAME column
FldDef[2].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
//Column 4
// To indicate that column name is mixed character (SBCS/MBCS) format and USE_ODPP_MBCS_CHAR_CALLS is defined
FldDef[3].cSubType = 'M';
//Allocate the pMC struct
FldDef[3].CN.pMC = (DPFD_MC_SS *) malloc(sizeof(DPFD_MC_SS));
if(NULL == FldDef[3].CN.pMC)
{
printf("\nFailed to allocate pMC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
//Clear the DPFD_MC_SS structure
memset(FldDef[3].CN.pMC, 0, sizeof(DPFD_MC_SS));
//For system default codepage
FldDef[3].iDataCodePage = -1;
//DBMS type code
FldDef[3].cDataDBMSType = RDB_NONE;
//Store the maximum size for column name buffer
FldDef[3].iColNameBytes = (MAX_COLNAME_SIZE + 1) * ODPP_MBCS_CHAR_BYTES ;
//Allocate buffer for column name in mixed character (SBCS/MBCS) format
FldDef[3].CN.pMC->pColName = (char *) malloc(FldDef[3].iColNameBytes);
if(NULL == FldDef[3].CN.pMC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[3].CN.pMC->pColName, 0, FldDef[3].iColNameBytes);
//Set the column name in FldDef
strcpy(FldDef[3].CN.pMC->pColName, "HIREDATE");
//Set the data type for the HIREDATE column
FldDef[3].sDatatype = ODPPDATATYPE_ODBC_DATE; //Set the data type for the source column
//Column 5
//To indicate that column name is mixed character (SBCS/MBCS) format and USE_ODPP_MBCS_CHAR_CALLS is defined
FldDef[4].cSubType = 'M';
//Allocate the pMC struct
FldDef[4].CN.pMC = (DPFD_MC_SS *) malloc(sizeof(DPFD_MC_SS));
if(NULL == FldDef[4].CN.pMC)
{
printf("\nFailed to allocate pMC struct of DP_FIELD_DEF\n");
goto CleanSvcDef;
}
//Clear the DPFD_MC_SS structure
memset(FldDef[4].CN.pMC, 0, sizeof(DPFD_MC_SS));
//For system default codepage
FldDef[4].iDataCodePage = -1;
//DBMS type code
FldDef[4].cDataDBMSType = RDB_NONE;
//Store the maximum size for column name buffer
FldDef[4].iColNameBytes = (MAX_COLNAME_SIZE + 1) * ODPP_MBCS_CHAR_BYTES ;
//Allocate buffer for column name in mixed character (SBCS/MBCS) format
FldDef[4].CN.pMC->pColName = (char *) malloc(FldDef[4].iColNameBytes);
if(NULL == FldDef[4].CN.pMC->pColName)
{
printf("\nFailed to allocate memory for Column name\n");
goto CleanSvcDef;
}
memset(FldDef[4].CN.pMC->pColName, 0, FldDef[4].iColNameBytes);
//Set the column name in FldDef
strcpy(FldDef[4].CN.pMC->pColName, "SALARY");
//Set the data type for the SALARY column
FldDef[4].sDatatype = ODPPDATATYPE_VARCHAR_SZ; //Set the data type for the source column
#endif
SvcDef.sFldCount = 5; //Set the Field count to 5 since five columns are being supplied.
//Create the list of Operands
//Parameter 1
//Switch is not needed but it is a mandatory operand so set it to ODPP_OPR_SWITCH_NA (Switch Not Applicable)
InitParameters[0].usParameterID = ODPP_OPR_SWITCH_NA;
//To indicate that current parameter does not hold any value.
InitParameters[0].iValueSubType = PARAM_VAL_NONE;
#ifndef USE_ODPP_MBCS_CHAR_CALLS
//For wide character (Unicode) format
//Parameter 2
//Set the parameter which specifies the search column names
InitParameters[1].usParameterID = ODPP_OPR_LOOKUP_SEARCH_COLS;
//To indicate that current parameter will hold wide character (Unicode)string value
InitParameters[1].iValueBufBytes = PARAM_VAL_WC;
//Allocate the pWC struct DPPRM_VAL_WC_SS
InitParameters[1].PV.pWC = (DPPRM_VAL_WC_SS *) malloc(sizeof(DPPRM_VAL_WC_SS));
if(NULL == InitParameters[1].PV.pWC)
{
printf("Failed to allocate memory for pWC->DPPRM_VAL_WC_SS");
goto CleanSvcDef;
}
memset(InitParameters[1].PV.pWC, 0, sizeof(DPPRM_VAL_WC_SS));
//Get length of search column name
iLen = wcslen(SearchCols);
//Set the size of the parameter value buffer in bytes
InitParameters[1].iValueBufBytes = (iLen + 1) * sizeof(ODPP_WCHAR);
//Allocate memory for the search column name in wide character (Unicode) format
InitParameters[1].PV.pWC->pParamVal = (ODPP_WCHAR *) malloc(InitParameters[1].iValueBufBytes);
if(NULL == InitParameters[1].PV.pWC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[1].PV.pWC->pParamVal, 0, (iLen +1));
// Copy search column name to pParmVal
wcsncpy(InitParameters[1].PV.pWC->pParamVal, SearchCols, iLen);
// NULL terminate the pParmVal buffer
InitParameters[1].PV.pWC->pParamVal[iLen] = '\0';
//Parameter 3
//This parameter specifies the replace column names
InitParameters[2].usParameterID = ODPP_OPR_LOOKUP_REPLACE_COLS;
//To indicate that current parameter will hold wide character (Unicode) string value
InitParameters[2].iValueSubType = PARAM_VAL_WC;
// Allocate the pWC struct DPPRM_VAL_WC_SS
InitParameters[2].PV.pWC = (DPPRM_VAL_WC_SS *) malloc(sizeof(DPPRM_VAL_WC_SS));
if(NULL == InitParameters[2].PV.pWC)
{
printf("Failed to allocate memory for pWC->DPPRM_VAL_WC_SS");
goto CleanSvcDef;
}
memset(InitParameters[2].PV.pWC, 0, sizeof(DPPRM_VAL_WC_SS));
//Get length of replace column name
iLen = wcslen(ReplaceCols);
//Set the size of the parameter value buffer in bytes
InitParameters[2].iValueBufBytes = (iLen + 1) * sizeof(ODPP_WCHAR);
//Allocate memory for the replace column names in wide character (Unicode) format
InitParameters[2].PV.pWC->pParamVal = (ODPP_WCHAR *) malloc(InitParameters[2].iValueBufBytes);
if(NULL == InitParameters[2].PV.pWC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[2].PV.pWC->pParamVal, 0, (iLen+1));
//Copy replace column names to pParmVal
wcsncpy(InitParameters[2].PV.pWC->pParamVal, ReplaceCols, iLen);
//NULL terminate the pParmVal buffer
InitParameters[2].PV.pWC->pParamVal[iLen] = '\0';
//Parameter 4
//This parameter is used to specify the lookup data source name(LDS identifier string).
InitParameters[3].usParameterID = ODPP_OPR_LDS_ID ;
//To indicate that current parameter will hold wide character (Unicode) string value
InitParameters[3].iValueSubType = PARAM_VAL_WC;
//Allocate the pWC struct DPPRM_VAL_WC_SS
InitParameters[3].PV.pWC = (DPPRM_VAL_WC_SS *) malloc(sizeof(DPPRM_VAL_WC_SS));
if(NULL == InitParameters[3].PV.pWC)
{
printf("Failed to allocate memory for pWC->DPPRM_VAL_WC_SS");
goto CleanSvcDef;
}
memset(InitParameters[3].PV.pWC, 0, sizeof(DPPRM_VAL_WC_SS));
//Get length of lDS ID
iLen = wcslen(LdsId);
//Set the size of the parameter value buffer in bytes
InitParameters[3].iValueBufBytes = (iLen + 1) * sizeof(ODPP_WCHAR);
//Allocate memory for the lds id in wide character (Unicode) format
InitParameters[3].PV.pWC->pParamVal = (ODPP_WCHAR *) malloc(InitParameters[3].iValueBufBytes);
if(NULL == InitParameters[3].PV.pWC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[3].PV.pWC->pParamVal, 0, (iLen+1));
//Copy LDS ID to pParmVal
wcsncpy(InitParameters[3].PV.pWC->pParamVal, LdsId, iLen);
//NULL terminate the pParmVal buffer
InitParameters[3].PV.pWC->pParamVal[iLen] = '\0';
//Parameter 5
//This parameter is used to provide connection string to connect to database.
InitParameters[4].usParameterID = ODPP_OPR_LDS_CONN_STRING;
//To indicate that current parameter will hold wide character (Unicode) string value
InitParameters[4].iValueSubType = PARAM_VAL_WC;
//Allocate the pWC struct DPPRM_VAL_WC_SS
InitParameters[4].PV.pWC = (DPPRM_VAL_WC_SS *) malloc(sizeof(DPPRM_VAL_WC_SS));
if(NULL == InitParameters[4].PV.pWC)
{
printf("Failed to allocate memory for pWC->DPPRM_VAL_WC_SS");
goto CleanSvcDef;
}
memset(InitParameters[4].PV.pWC, 0, sizeof(DPPRM_VAL_WC_SS));
//Get length of connection string
iLen = wcslen(ConnStr);
//Set the size of the parameter value buffer in bytes
InitParameters[4].iValueBufBytes = (iLen + 1) * sizeof(ODPP_WCHAR);
//Allocate memory for the connection string in wide character (Unicode) format
InitParameters[4].PV.pWC->pParamVal = (ODPP_WCHAR *) malloc(InitParameters[4].iValueBufBytes);
if(NULL == InitParameters[4].PV.pWC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[4].PV.pWC->pParamVal, 0, (iLen+1));
//Copy replace connection string to pParmVal
wcsncpy(InitParameters[4].PV.pWC->pParamVal, ConnStr, iLen);
//NULL terminate the pParmVal buffer
InitParameters[4].PV.pWC->pParamVal[iLen] = '\0';
//Parameter 6
//This parameter is used to provide the name of the table schema.
InitParameters[5].usParameterID = ODPP_OPR_LDS_SCHEMA;
//To indicate that current parameter will hold wide character (Unicode) string value
InitParameters[5].iValueSubType = PARAM_VAL_WC;
//Allocate the pWC struct DPPRM_VAL_WC_SS
InitParameters[5].PV.pWC = (DPPRM_VAL_WC_SS *) malloc(sizeof(DPPRM_VAL_WC_SS));
if(NULL == InitParameters[5].PV.pWC)
{
printf("Failed to allocate memory for pWC->DPPRM_VAL_WC_SS");
goto CleanSvcDef;
}
memset(InitParameters[5].PV.pWC, 0, sizeof(DPPRM_VAL_WC_SS));
//Get the length of LDS schema
iLen = wcslen(LDSSchema);
//Set the size of the parameter value buffer in bytes
InitParameters[5].iValueBufBytes = (iLen + 1) * sizeof(ODPP_WCHAR);
//Allocate memory for the LDS schema name in wide character (Unicode) format
InitParameters[5].PV.pWC->pParamVal = (ODPP_WCHAR *) malloc(InitParameters[5].iValueBufBytes);
if(NULL == InitParameters[5].PV.pWC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[5].PV.pWC->pParamVal, 0, (iLen+1));
//Copy lds schema to pParmVal
wcsncpy(InitParameters[5].PV.pWC->pParamVal, LDSSchema, iLen);
//NULL terminate the pParmVal buffer
InitParameters[5].PV.pWC->pParamVal[iLen] = '\0';
#else
//For mixed character (MBCS/SBCS) format
//Parameter 2
//Set the parameter which specifies the search column names
InitParameters[1].usParameterID = ODPP_OPR_LOOKUP_SEARCH_COLS;
//To indicate that current parameter will hold mixed character (MBCS/SBCS) string value
InitParameters[1].iValueSubType = PARAM_VAL_MC;
//Allocate the pMC struct DPPRM_VAL_MC_SS
InitParameters[1].PV.pMC = (DPPRM_VAL_MC_SS *) malloc(sizeof(DPPRM_VAL_MC_SS));
if(NULL == InitParameters[1].PV.pMC)
{
printf("Failed to allocate memory for pMC->DPPRM_VAL_MC_SS");
goto CleanSvcDef;
}
memset(InitParameters[1].PV.pMC, 0, sizeof(DPPRM_VAL_MC_SS));
//Get search column name length
iLen = (int)strlen(SearchCols);
//Set the size of the parameter value buffer in bytes
InitParameters[1].iValueBufBytes = (iLen + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate memory for the search column name in mixed character (MBCS/SBCS) format
InitParameters[1].PV.pMC->pParamVal = (char *) malloc(InitParameters[1].iValueBufBytes);
if(NULL == InitParameters[1].PV.pMC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[1].PV.pMC->pParamVal, 0, (iLen+1));
//Copy search column name to pParmVal
strncpy(InitParameters[1].PV.pMC->pParamVal, SearchCols, iLen);
//NULL terminate the pParmVal buffer
InitParameters[1].PV.pMC->pParamVal[iLen] = '\0';
//For system default codepage
InitParameters[1].PV.pMC->iParamValCodePage = -1;
//DBMS Type code
InitParameters[1].PV.pMC->cParamValDBMSType = RDB_NONE;
//Parameter 3
//Set the parameter which specifies the replace column names
InitParameters[2].usParameterID = ODPP_OPR_LOOKUP_REPLACE_COLS;
//To indicate that current parameter will hold mixed character (SBCS/MBCS)string value
InitParameters[2].iValueSubType = PARAM_VAL_MC;
//Allocate the pMC struct DPPRM_VAL_MC_SS
InitParameters[2].PV.pMC = (DPPRM_VAL_MC_SS *) malloc(sizeof(DPPRM_VAL_MC_SS));
if(NULL == InitParameters[2].PV.pMC)
{
printf("Failed to allocate memory for pMC->DPPRM_VAL_MC_SS");
goto CleanSvcDef;
}
memset(InitParameters[2].PV.pMC, 0, sizeof(DPPRM_VAL_MC_SS));
//Get length of replace column name
iLen = (int)strlen(ReplaceCols);
//Set the size of the parameter value buffer in bytes
InitParameters[2].iValueBufBytes = (iLen + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate memory for the replace column names in mixed character (SBCS/MBCS) format
InitParameters[2].PV.pMC->pParamVal = (char *) malloc(InitParameters[2].iValueBufBytes);
if(NULL == InitParameters[2].PV.pMC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[2].PV.pMC->pParamVal, 0, (iLen+1));
//Copy replace column name to pParmVal
strncpy(InitParameters[2].PV.pMC->pParamVal, ReplaceCols, iLen);
//NULL terminate the pParmVal buffer
InitParameters[2].PV.pMC->pParamVal[iLen] = '\0';
//For system default codepage
InitParameters[2].PV.pMC->iParamValCodePage = -1;
//DBMS Type code
InitParameters[2].PV.pMC->cParamValDBMSType = RDB_NONE;
//Parameter 4
//This parameter is used to specify the lookup data source name(LDS identifier string).
InitParameters[3].usParameterID = ODPP_OPR_LDS_ID ;
//To indicate that current parameter will hold mixed character (SBCS/MBCS)string value
InitParameters[3].iValueSubType = PARAM_VAL_MC;
//Allocate the pMC struct DPPRM_VAL_MC_SS
InitParameters[3].PV.pMC = (DPPRM_VAL_MC_SS *) malloc(sizeof(DPPRM_VAL_MC_SS));
if(NULL == InitParameters[3].PV.pMC)
{
printf("Failed to allocate memory for pMC->DPPRM_VAL_MC_SS");
goto CleanSvcDef;
}
memset(InitParameters[3].PV.pMC, 0, sizeof(DPPRM_VAL_MC_SS));
//Get length of LDS ID
iLen = (int)strlen(LdsId);
//Set the size of the parameter value buffer in bytes
InitParameters[3].iValueBufBytes = (iLen + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate memory for the destination column name in mixed character (SBCS/MBCS) format
InitParameters[3].PV.pMC->pParamVal = (char *) malloc(InitParameters[3].iValueBufBytes);
if(NULL == InitParameters[3].PV.pMC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[3].PV.pMC->pParamVal, 0, (iLen+1));
//Copy LdsId from to pParmVal
strncpy(InitParameters[3].PV.pMC->pParamVal, LdsId, iLen);
//NULL terminate the pParmVal buffer
InitParameters[3].PV.pMC->pParamVal[iLen] = '\0';
//For system default codepage
InitParameters[3].PV.pMC->iParamValCodePage = -1;
//DBMS Type code
InitParameters[3].PV.pMC->cParamValDBMSType = RDB_NONE;
//Parameter 5
//This parameter is used to provide connection string to connect to database.
InitParameters[4].usParameterID = ODPP_OPR_LDS_CONN_STRING;
//To indicate that current parameter will hold mixed character (SBCS/MBCS)string value
InitParameters[4].iValueSubType = PARAM_VAL_MC;
//Allocate the pMC struct DPPRM_VAL_MC_SS
InitParameters[4].PV.pMC = (DPPRM_VAL_MC_SS *) malloc(sizeof(DPPRM_VAL_MC_SS));
if(NULL == InitParameters[4].PV.pMC)
{
printf("Failed to allocate memory for pMC->DPPRM_VAL_MC_SS");
goto CleanSvcDef;
}
memset(InitParameters[4].PV.pMC, 0, sizeof(DPPRM_VAL_MC_SS));
//Get length of LDS connection string
iLen = (int)strlen(ConnStr);
//Set the size of the parameter value buffer in bytes
InitParameters[4].iValueBufBytes = (iLen + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate memory for the ConnStr in mixed character (SBCS/MBCS) format
InitParameters[4].PV.pMC->pParamVal = (char *) malloc(InitParameters[4].iValueBufBytes);
if(NULL == InitParameters[4].PV.pMC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[4].PV.pMC->pParamVal, 0, (iLen+1));
//Copy ConnStr to pParmVal
strncpy(InitParameters[4].PV.pMC->pParamVal, ConnStr, iLen);
//NULL terminate the pParmVal buffer
InitParameters[4].PV.pMC->pParamVal[iLen] = '\0';
//For system default codepage
InitParameters[4].PV.pMC->iParamValCodePage = -1;
//DBMS Type code
InitParameters[4].PV.pMC->cParamValDBMSType = RDB_NONE;
//Parameter 6
//This parameter is used to provide the name of the table schema.
InitParameters[5].usParameterID = ODPP_OPR_LDS_SCHEMA;
//To indicate that current parameter will hold mixed character (SBCS/MBCS)string value
InitParameters[5].iValueSubType = PARAM_VAL_MC;
//Allocate the pMC struct DPPRM_VAL_MC_SS
InitParameters[5].PV.pMC = (DPPRM_VAL_MC_SS *) malloc(sizeof(DPPRM_VAL_MC_SS));
if(NULL == InitParameters[5].PV.pMC)
{
printf("Failed to allocate memory for pMC->DPPRM_VAL_MC_SS");
goto CleanSvcDef;
}
memset(InitParameters[5].PV.pMC, 0, sizeof(DPPRM_VAL_MC_SS));
//Get length of LDS schema
iLen = (int)strlen(LDSSchema);
//Set the size of the parameter value buffer in bytes
InitParameters[5].iValueBufBytes = (iLen + 1) * ODPP_MBCS_CHAR_BYTES;
//Allocate memory for the LDSSchema in mixed character (SBCS/MBCS) format
InitParameters[5].PV.pMC->pParamVal = (char *) malloc(InitParameters[5].iValueBufBytes);
if(NULL == InitParameters[5].PV.pMC->pParamVal)
{
printf("Failed to allocate memory for parameter value pParamVal");
goto CleanSvcDef;
}
memset(InitParameters[5].PV.pMC->pParamVal, 0, (iLen+1));
//Copy LDSSchema to pParmVal
strncpy(InitParameters[5].PV.pMC->pParamVal, LDSSchema, iLen);
//NULL terminate the pParmVal buffer
InitParameters[5].PV.pMC->pParamVal[iLen] = '\0';
//For system default codepage
InitParameters[5].PV.pMC->iParamValCodePage = -1;
//DBMS Type code
InitParameters[5].PV.pMC->cParamValDBMSType = RDB_NONE;
#endif
//Parameter 7
//Method to choose during masking
InitParameters[6].usParameterID = ODPP_OPR_METHOD;
//To indicate that current parameter will hold numeric value.
InitParameters[6].iValueSubType = PARAM_VAL_NUM;
//Generates a consistently masked output
InitParameters[6].PV.uiVal = ODPP_METHOD_MASK;
//Parameter 8
//This parameter is used to provide the name of the LDS library.
InitParameters[7].usParameterID = ODPP_OPR_LDS_LIB;
//To indicate that current parameter will hold numeric value.
InitParameters[7].iValueSubType = PARAM_VAL_NUM;
//Generates the standard DB2 library name (ODPPLDSDB2LIB.2.1.dll)
InitParameters[7].PV.uiVal = ODPP_LDS_DB2_LUW;
//Parameter 9
//This parameter is used to specify Lookup specific flags
InitParameters[8].usParameterID = ODPP_OPR_LOOKUP_FLAGS;
//To indicate that current parameter will hold numeric value.
InitParameters[8].iValueSubType = PARAM_VAL_NUM;
//For HASH lookup
InitParameters[8].PV.uiVal = ODPP_FLAG_LOOKUP_HASH;
SvcDef.sOprCount = 9; //Set the parameter count to 9 since nine parameters are being supplied
//Initialize the Service Provider
retVal = Provider_Init(&iSvcToken, &PrvName[0], strlen(PrvName), &SvcDef, FALSE);
if(ODPPSUCCESS != retVal)
{
printf("Provider Init Failed Err=%#x", retVal);
goto CleanSvcDef;
}


Service Provider Execution:

memset(&rowSet, 0, sizeof(DP_ROWSET_DEF)); //Clear the DP_ROWSET_DEF structure
pRow = &rowSet.pRowDefine; //Set pRow to point to the address of the first element in the list of Row Defines
piRows = &rowSet.iCount; //Set piRows to point to the address of the rowSet count
fin = fopen(&SourceFilePath[0],"r"); //Open the source CSV data file containing the lookup source data
iCnt = 0; //Set row count to zero

Loop through each line of the source CSV file creating the field data for each row.

Loop BEGIN

Here the rowSet is created as a List of rows and not as an Array. An application can also allocate a fixed size array of DP_ROW_DEF structures, fill it with data and pass it to Provider_Service.

(*pRow) = (DP_ROW_DEF*)malloc(sizeof(DP_ROW_DEF)); //Allocate memory for the Row Define
if(NULL == (*pRow)) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for the row");
goto CleanRowSet;
}
memset(*pRow, 0, sizeof(DP_ROW_DEF)); //Clear the allocated memory for the Row Define
//copy the search columns value into buffer Line and let iLen be the length of the search Col value
pData = (DP_FIELD_DATA_DEF*)malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
if(NULL == pData) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for pData");
goto CleanRowSet;
}
memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
pData->iSrcBufLen = sizeof(int); // Source is INTEGER
pData->pSrcBuf = (unsigned char*)malloc(pData->iSrcBufLen); //Allocate memory for the source buffer
if(NULL == pData->pSrcBuf) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for source buffer");
goto CleanRowSet;
}
memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
// Convert the value read from the CSV file to INTEGER data type and store it in pData->pSrcBuf
// memcpy(pData->pSrcBuf, &EmpNo, pData->iSrcBufLen);
// EmpNo contains integer value read from CSV file
(*pRow)->pFldDataDefine = pData; //Copy the pData pointer to the Field Data Define
// Copy Next Search Column value into buffer Line and let iLen be the length of the search Col value
pData->pNext = (DP_FIELD_DATA_DEF*)malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
if(NULL == pData->pNext) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for pData");
goto CleanRowSet;
}
pData = pData->pNext;
memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
pData->iSrcBufLen = iLen; //Copy iLen, the length of the Search Col value read from CSV file, to pData
pData->pSrcBuf = (unsigned char*)malloc(pData->iSrcBufLen + 1); //Allocate memory for the source buffer
if(NULL == pData->pSrcBuf) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for source buffer");
goto CleanRowSet;
}
memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
strncpy((char*)pData->pSrcBuf, &Line[0], iLen); //Copy the Search Col value from Line (the value read from CSV file), having length iLen, to the source buffer
//Replace Cols - copy the value into buffer Line and let iLen be the length of the Replace Col value
pData->pNext = (DP_FIELD_DATA_DEF*)malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
if(NULL == pData->pNext) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for pData");
goto CleanRowSet;
}
pData = pData->pNext;
memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
pData->iSrcBufLen = iLen; //Copy iLen, the length of the Replace Col value read from CSV file, to pData
pData->pSrcBuf = (unsigned char*)malloc(pData->iSrcBufLen + 1); //Allocate memory for the source buffer
if(NULL == pData->pSrcBuf) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for source buffer");
goto CleanRowSet;
}
memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
strncpy((char*)pData->pSrcBuf, &Line[0], iLen); //Copy the Replace Col value from Line (the value read from CSV file), having length iLen, to the source buffer
//Next Replace Cols - copy the value into buffer Line and let iLen be the length of the Replace col value
pData->pNext = (DP_FIELD_DATA_DEF*)malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
if(NULL == pData->pNext) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for pData");
goto CleanRowSet;
}
pData = pData->pNext;
memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
pData->iSrcBufLen = iLen; //Copy iLen, the length of the Replace Col value read from CSV file, to pData
pData->pSrcBuf = (unsigned char*)malloc(pData->iSrcBufLen + 1); //Allocate memory for the source buffer
if(NULL == pData->pSrcBuf) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for source buffer");
goto CleanRowSet;
}
memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
// Convert the value read from CSV file to ODPPDATATYPE_ODBC_DATE and copy it to pData->pSrcBuf
//Next Replace Cols - copy the value into buffer Line and let iLen be the length of the Replace col value
pData->pNext = (DP_FIELD_DATA_DEF*)malloc(sizeof(DP_FIELD_DATA_DEF)); //Allocate memory for the data field
if(NULL == pData->pNext) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for pData");
goto CleanRowSet;
}
pData = pData->pNext;
memset(pData, 0, sizeof(DP_FIELD_DATA_DEF)); //Clear the allocated memory for the data field
pData->iSrcBufLen = iLen; //Copy iLen, the length of the Replace Col value read from CSV file, to pData
pData->pSrcBuf = (unsigned char*)malloc(pData->iSrcBufLen + 1); //Allocate memory for the source buffer
if(NULL == pData->pSrcBuf) //Check if memory was allocated successfully
{
printf("Failed to allocate memory for source buffer");
goto CleanRowSet;
}
memset(pData->pSrcBuf, 0, pData->iSrcBufLen + 1); //Clear the source buffer
strncpy((char*)pData->pSrcBuf, &Line[0], iLen); //Copy the Replace Col value from Line (the value read from CSV file), having length iLen, to the source buffer
(*pRow)->sCount = 5; //Set the field count to 5 since there are five columns
iCnt++; //Increment the row count
pRow = &(*pRow)->pNext; //Move to the next row in the list and continue the loop to create the list of rows

Loop END

After the rowSet has been created invoke the Service Provider to mask the source data

fclose(fin); //Close the source CSV file
*piRows = iCnt; //Set the count of rows in the rowSet
sMethod = ODPP_METHOD_DEFAULT; //Set sMethod to the default
retVal = Provider_Service(iSvcToken, sMethod, NULL, &rowSet); //Invoke the Service Provider
if(ODPPSUCCESS != retVal) //Check if the Service call was successful
{
printf("Provider service failed %d", retVal);
goto CleanRowSet;
}


Service Provider Termination:

retVal = Provider_Term(iSvcToken); //Terminate the provider after all rows have been masked in Provider_Service
if(ODPPSUCCESS != retVal) //Check for successful termination of the Service Provider
{
printf("Provider Terminate failed %d", retVal);
goto CleanRowSet;
}

Free the memory that has been allocated if an error occured.

//Free the memory allocated in the rowSet
CleanRowSet:
pRowSet = &rowSet; //Pointer to the rowSet
pCurRow = pRowSet->pRowDefine; //Set pCurRow to point to the first Row Define
for(i = 0; ((i < pRowSet->iCount) && (NULL != pCurRow)); i++)
{
pPrevRow = pCurRow; //pPrevRow points to the current row
pData = pCurRow->pFldDataDefine; //Set pData to point to the first Field Data Define
for(j = 0; ((j < pCurRow->sCount) && (NULL != pData)); j++)
{
pPrev = pData; //pPrev points to the current Field Data Define
if(pData->pSrcBuf != NULL)
free(pData->pSrcBuf); //Free the source buffer
if(pData->pDstBuf != NULL)
free(pData->pDstBuf); //Free the destination buffer
pData = pData->pNext; //Move to the next data field
free(pPrev); //Free the previous Field Data Define
}
pCurRow = pCurRow->pNext; //Move to the next row
free(pPrevRow); //Free the previous row
}
//Free the memory allocated in the Service Definition
CleanSVCDef:
//Clear the field definition
for(i=0; i < MAX_COLUMNS; i++)
{
#ifndef USE_ODPP_MBCS_CHAR_CALLS
if(NULL != FldDef[i].CN.pWC)
{
if(NULL != FldDef[i].CN.pWC->pColName)
{
free(FldDef[i].CN.pWC->pColName);
FldDef[i].CN.pWC->pColName = NULL;
free(FldDef[i].CN.pWC);
FldDef[i].CN.pWC = NULL;
}
}
#else
if(NULL != FldDef[i].CN.pMC)
{
if(NULL != FldDef[i].CN.pMC->pColName)
{
free(FldDef[i].CN.pMC->pColName);
FldDef[i].CN.pMC->pColName = NULL;
free(FldDef[i].CN.pMC);
FldDef[i].CN.pMC = NULL;
}
}
#endif
}
//clear the Initialization parameter definition
for(i=0; i<PARAMETER_MAX_SIZE; i++)
{
#ifndef USE_ODPP_MBCS_CHAR_CALLS
if(PARAM_VAL_WC == InitParameters[i].iValueSubType)
{
if(NULL != InitParameters[i].PV.pWC)
{
if(NULL != InitParameters[i].PV.pWC->pParamVal)
{
free(InitParameters[i].PV.pWC->pParamVal);
InitParameters[i].PV.pWC->pParamVal = NULL;
free(InitParameters[i].PV.pWC);
InitParameters[i].PV.pWC = NULL;
}
}
}
#else
if(PARAM_VAL_MC == InitParameters[i].iValueSubType)
{
if(NULL != InitParameters[i].PV.pMC)
{
if(NULL != InitParameters[i].PV.pMC->pParamVal)
{
free(InitParameters[i].PV.pMC->pParamVal);
InitParameters[i].PV.pMC->pParamVal = NULL;
free(InitParameters[i].PV.pMC);
InitParameters[i].PV.pMC = NULL;
}
}
}
#endif
}
return retVal; //Return the error code