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);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

userName

ESS_STR_T

Pointer to a user name. If specified, deletes all objects last modified by the given user.

purgeDate

ESS_TIME_T

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

ESS_ULONG_T

Number of LRO catalog entries purged.

pLRODescList

ESS_LRODESC_API_T

Address of pointer to the list of LRO catalog entries purged.

Notes

Return Value

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

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(&timestamp); 
        pTmStruct = localtime((ESS_PLONG_T)&timestamp);
        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