# EssLROPurgeObjects

Description

EssLROPurgeObjects() deletes all objects linked to cells in the active database for a given user name and/or modification date.

Syntax

    ESS_FUNC_M EssLROPurgeObjects (hCtx, userName, purgeDate, pulLROCount, pLRODescList);

ESS_HCTX_T | hCtx
ESS_STR_T | userName
ESS_TIME_T | purgeDate
ESS_ULONG_T | pulLROCount
ESS_PLRODESC_API_T | pLRODescList

Parameters

hCtx | Essbase API context handle.
userName | Pointer to a user name. If specified, deletes all objects last modified by the given user.
purgeDate | A modification date. If specified, returns a list of all objects modified before the given date. The date is a ULONG representing the number of seconds since January 1, 1970.
pulLROCount | Number of LRO catalog entries purged.
pLRODescList | Address of pointer to the list of LRO catalog entries purged.

Return Value

If successful, returns ESS_STS_NOERR. Otherwise, returns an error code.

Notes

- If you specify both the userName and purgeDate parameters, objects meeting both criteria are deleted.
- The caller is responsible for freeing memory allocated for pLRODescList.

Access

A call to this function requires design privileges (ESS_PRIV_DBDESIGN) for the active database.

Example

    ESS_FUNC_M ESS_LRO PurgeObjects (ESS_HCTX_T hCtx, ESS_HINST_T hInst)
    {
    	ESS_FUNC_M 		sts = ESS_STS_NOERR;
    	ESS_LRODESC_API_T	plroDescList=NULL;
    	ESS_ULONG_T		ulLroCount;
    	ESS_CHAR_T		userName[ESS_USERNAMELEN];
    	ESS_CHAR_T		purgeDate[ESS_DATESIZE];
    	ESS_CHAR_T		buf[ESS_DATESIZE];
    	ESS_TIME_T		timestamp;
    	struct tm 		*pTmStruct, time_str;
    	strcpy( userName, "user1");
    	strcpy( purgeDate, "09/05/1997");
    	time(×tamp);
    	pTmStruct = localtime((ESS_PLONG_T)×tamp);
    	memset(&time_str, 0, sizeof(struct tm));
    	strncpy (buf, (const char *)&purgeDate[8], 2);
    	time_str.tm_year = atoi(buf);
    	strncpy(buf, listDate, 2);
    	time_str.tm_mon = atoi(buf)-1;
    	strncpy(buf, (const char *)&purgeDate[3], 2);
    	time_str.tm_mday = atoi(buf);
    	time_str.tm_hour = 0;
    	time_str.tm_min = 0;
    	time_str.tm_sec = 1;
    	time_str.tm_isdst = -1;
    	if ((time_str.tm_mon != pTmStruct->tm_mon) ||
    		(time_str.tm_year != pTmStruct->tm_year) ||
    		(time_str.tm_mday != pTmStruct->tm_mday))
    	{
    		time_str.tm_mday++;
    		timestamp = mktime(&time_str);
    	}
    	sts = EssLROPurgeObjects(hCtx, userName, timestamp, &ulLroCount, &plroDescList);
    	if(sts)
    	{
    		printf("Could not purge linked objects. \n");
    	}
    	if (plroDescList)
    		EssFree(hInst, plroDescList);
    	return sts;
    }

See Also

LRO Constant and Structure Definitions
EssLROGetCatalog()
EssLRODeleteObject()
EssLRODeleteCellObjects()