ARSperl
view release on metacpan or search on metacpan
if (ARError( ret, status))
break;
if (strcmp(field_name, fieldName) == 0){
XPUSHs(sv_2mortal(newSViv(idList.internalIdList[loop])));
break;
}
}
FreeARInternalIdList(&idList, FALSE);
}
}
void
ars_GetFieldTable(ctrl,schema)
ARControlStruct * ctrl
char * schema
PPCODE:
{
int ret = 0;
unsigned int loop = 0;
HV *fields, *h;
char *hkey;
SV *hval, **hvalName;
I32 klen;
(void) ARError_reset();
fields = fieldcache_get_schema_fields( ctrl, schema, TRUE );
if( ! fields ){
goto get_fieldtable_end;
}
hv_iterinit( fields );
while( (hval = hv_iternextsv(fields,&hkey,&klen)) ){
if( strcmp(hkey,"0") == 0 ) continue;
h = (HV* ) SvRV(hval);
hvalName = hv_fetch( h, "name", 4, 0 );
XPUSHs( sv_2mortal(newSVsv(*hvalName)) );
XPUSHs( sv_2mortal(newSVpv(hkey,0)) );
}
get_fieldtable_end:;
if( ! fields ){
XSRETURN_UNDEF;
}
}
SV *
ars_CreateEntry(ctrl,schema,...)
ARControlStruct * ctrl
char * schema
CODE:
{
int a = 0,
i = 0,
c = (items - 2) / 2;
AREntryIdType entryId;
ARFieldValueList fieldList;
ARInternalIdList getFieldIds;
ARStatusList status;
int ret = 0, rv = 0;
unsigned int dataType = 0, j = 0;
HV *cacheFields;
RETVAL=NULL;
(void) ARError_reset();
Zero(&entryId, 1, AREntryIdType);
Zero(&fieldList, 1, ARFieldValueList);
Zero(&getFieldIds, 1, ARInternalIdList);
Zero(&status, 1, ARStatusList);
if (((items - 2) % 2) || c < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
} else {
cacheFields = fieldcache_get_schema_fields( ctrl, schema, FALSE );
if( ! cacheFields ){
goto create_entry_end;
}
fieldList.numItems = c;
AMALLOCNN(fieldList.fieldValueList,c,ARFieldValueStruct);
getFieldIds.numItems = 0;
getFieldIds.internalIdList = NULL;
/* try to get data type from field cache, collect fieldIds which are not cached */
for (i=0; i<c; ++i) {
ARInternalId fieldId;
a = i*2+2;
fieldId = fieldList.fieldValueList[i].fieldId = SvIV(ST(a));
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] found in cache\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto create_entry_end;
}
}else{
if( getFieldIds.numItems == 0 ){
AMALLOCNN(getFieldIds.internalIdList,c,ARInternalId);
}
/* printf( "%s [%d] collect for loading\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
getFieldIds.internalIdList[getFieldIds.numItems] = fieldId;
++getFieldIds.numItems;
}
}
/* load missing fields into cache */
if( getFieldIds.numItems > 0 ){
/* printf( "--- load missing fields ---\n" ); fflush(stdout); */ /* _DEBUG_ */
/* if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) != AR_RETURN_OK ){ */
if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) > AR_RETURN_WARNING ){
goto create_entry_end;
}
}
/* now get data type from the freshly cached fields */
i = 0;
for (j=0; j<getFieldIds.numItems; ++j) {
ARInternalId fieldId = getFieldIds.internalIdList[j];
while(fieldId != fieldList.fieldValueList[i].fieldId) ++i;
a = i*2+2;
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] freshly loaded\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto create_entry_end;
}
}else{
char errTxt[256];
sprintf( errTxt, "Failed to fetch field %d from hash", fieldId );
ARError_add(AR_RETURN_ERROR, AP_ERR_FIELD_TYPE);
ARError_add(AR_RETURN_ERROR, AP_ERR_CONTINUE, errTxt );
goto create_entry_end;
}
}
/* printf( "--------------------\n" ); fflush(stdout); */ /* _DEBUG_ */
ret = ARCreateEntry(ctrl, schema, &fieldList, entryId, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, status)) rv = 1;
create_entry_end:;
if(rv == 0) {
RETVAL = newSVsv(&PL_sv_undef);
} else {
RETVAL = newSVpv( entryId, strlen(entryId) );
}
AP_FREE(fieldList.fieldValueList);
if( getFieldIds.internalIdList != NULL ) AP_FREE(getFieldIds.internalIdList);
}
}
OUTPUT:
RETVAL
int
ars_DeleteEntry(ctrl,schema,entry_id)
ARControlStruct * ctrl
char * schema
char * entry_id
CODE:
{
int ret = 0;
ARStatusList status;
#if AR_EXPORT_VERSION >= 3
AREntryIdList entryList;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
if(perl_BuildEntryList(ctrl, &entryList, entry_id) != 0)
goto delete_fail;
ret = ARDeleteEntry(ctrl, schema, &entryList, 0, &status);
if (entryList.entryIdList) AP_FREE(entryList.entryIdList);
#else /* ARS 2 */
RETVAL = 0; /* assume error */
if(!entry_id || !*entry_id) {
ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_EID);
goto delete_fail;
}
ret = ARDeleteEntry(ctrl, schema, entry_id, &status);
#endif
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (!ARError(ret, status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl, (ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
#if AR_CURRENT_API_VERSION >= 13
hv_store(RETVAL, "errorFilterOptions", strlen("errorFilterOptions") , newSViv(errorFilterOptions), 0);
hv_store(RETVAL, "errorFilterName", strlen("errorFilterName") , newSVpv(errorFilterName, 0), 0);
#endif
FreeARFilterActionList(&actionList,FALSE);
FreeARFilterActionList(&elseList,FALSE);
FreeARWorkflowConnectStruct(&schemaList, FALSE);
FreeARPropList(&objPropList, FALSE);
if(helpText) {
AP_FREE(helpText);
}
if(changeDiary) {
AP_FREE(changeDiary);
}
}else{
XSRETURN_UNDEF;
}
}
OUTPUT:
RETVAL
void
ars_GetServerStatistics(ctrl,...)
ARControlStruct * ctrl
PPCODE:
{
ARServerInfoRequestList requestList;
ARServerInfoList serverInfo;
int i = 0, ret = 0;
unsigned int ui = 0;
ARStatusList status;
(void) ARError_reset();
Zero(&requestList, 1, ARServerInfoRequestList);
Zero(&serverInfo, 1, ARServerInfoList);
Zero(&status, 1, ARStatusList);
if(items < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
} else {
requestList.numItems = items - 1;
AMALLOCNN(requestList.requestList,(items-1),unsigned int);
if(requestList.requestList) {
for(i=1; i<items; i++) {
requestList.requestList[i-1] = SvIV(ST(i));
}
ret = ARGetServerStatistics(ctrl, &requestList, &serverInfo, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (!ARError(ret, status)) {
for(ui=0; ui<serverInfo.numItems; ui++) {
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].operation)));
switch(serverInfo.serverInfoList[ui].value.dataType) {
case AR_DATA_TYPE_ENUM:
case AR_DATA_TYPE_TIME:
case AR_DATA_TYPE_BITMASK:
case AR_DATA_TYPE_INTEGER:
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].value.u.intVal)));
break;
case AR_DATA_TYPE_REAL:
XPUSHs(sv_2mortal(newSVnv(serverInfo.serverInfoList[ui].value.u.realVal)));
break;
case AR_DATA_TYPE_CHAR:
XPUSHs(sv_2mortal(newSVpv(serverInfo.serverInfoList[ui].value.u.charVal,
strlen(serverInfo.serverInfoList[ui].value.u.charVal))));
break;
}
}
}
FreeARServerInfoList(&serverInfo, FALSE);
FreeARServerInfoRequestList(&requestList, FALSE);
} else {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_MALLOC);
}
}
}
HV *
ars_GetCharMenu(ctrl,name)
ARControlStruct * ctrl
char * name
CODE:
{
unsigned int refreshCode = 0;
ARCharMenuStruct menuDefn;
char *helpText = CPNULL;
ARTimestamp timestamp;
ARAccessNameType owner;
ARAccessNameType lastChanged;
char *changeDiary = CPNULL;
ARStatusList status;
int ret = 0, i = 0;
HV *menuDef = newHV();
/* SV *ref; */
ARDiaryList diaryList;
ARPropList objPropList;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&objPropList, 1, ARPropList);
Zero(&menuDefn, 1, ARCharMenuStruct);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(lastChanged, 1, ARAccessNameType);
Zero(&diaryList, 1, ARDiaryList);
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
ret = ARGetCharMenu(ctrl, name, &refreshCode, &menuDefn, &helpText,
×tamp, owner, lastChanged, &changeDiary,
&objPropList,
&status);
#ifdef PROFILE
FreeARInternalIdList(&adminGroupList,FALSE);
FreeAREntryListFieldList(&getListFields,FALSE);
FreeARIndexList(&indexList,FALSE);
if(helpText) {
AP_FREE(helpText);
}
if(changeDiary) {
AP_FREE(changeDiary);
}
FreeARCompoundSchema(&schema,FALSE);
FreeARSortList(&sortList,FALSE);
}
}
OUTPUT:
RETVAL
void
ars_GetListActiveLink(ctrl,schema=NULL,changedSince=0)
ARControlStruct * ctrl
char * schema
int changedSince
PPCODE:
{
ARNameList nameList;
ARStatusList status;
ARPropList propList;
int ret = 0;
unsigned int i = 0;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&nameList, 1, ARNameList);
Zero(&propList, 1, ARPropList);
#if AR_EXPORT_VERSION >= 8L
Zero(&propList, 1, ARPropList);
#endif
ret=ARGetListActiveLink(ctrl,schema,changedSince,
#if AR_EXPORT_VERSION >= 8L
&propList,
#endif
&nameList,&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret,status)) {
for (i=0; i<nameList.numItems; i++)
XPUSHs(sv_2mortal(newSVpv(nameList.nameList[i],0)));
FreeARNameList(&nameList,FALSE);
}
}
HV *
ars_GetField(ctrl,schema,id)
ARControlStruct * ctrl
char * schema
unsigned long id
CODE:
{
int ret;
ARStatusList Status;
unsigned int dataType, option, createMode;
#if AR_CURRENT_API_VERSION >= 12
unsigned int fieldOption;
#endif
ARValueStruct defaultVal;
ARPermissionList assignedGroupList;
ARPermissionList permissions;
ARFieldLimitStruct limit;
ARNameType fieldName;
ARFieldMappingStruct fieldMap;
ARDisplayInstanceList displayList;
char *helpText = CPNULL;
ARTimestamp timestamp;
ARAccessNameType owner;
ARAccessNameType lastChanged;
char *changeDiary = CPNULL;
ARDiaryList diaryList;
ARPropList objPropList;
(void) ARError_reset();
Zero(&Status, 1, ARStatusList);
Zero(&defaultVal, 1, ARValueStruct);
Zero(&assignedGroupList, 1, ARPermissionList);
Zero(&permissions, 1, ARPermissionList);
Zero(&limit, 1, ARFieldLimitStruct);
Zero(fieldName, 1, ARNameType);
Zero(&fieldMap, 1, ARFieldMappingStruct);
Zero(&displayList, 1, ARDisplayInstanceList);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(lastChanged, 1, ARAccessNameType);
Zero(&diaryList, 1, ARDiaryList);
Zero(&objPropList, 1, ARPropList);
#if AR_CURRENT_API_VERSION >= 17
ret = ARGetFieldCached(ctrl, schema, id, fieldName, &fieldMap, &dataType, &option, &createMode, &fieldOption, &defaultVal, &assignedGroupList, &permissions, &limit, &displayList, &helpText, ×tamp, owner, lastChanged, &changeDiary, &objPropLis...
#elif AR_CURRENT_API_VERSION >= 12
ret = ARGetFieldCached(ctrl, schema, id, fieldName, &fieldMap, &dataType, &option, &createMode, &fieldOption, &defaultVal, &permissions, &limit, &displayList, &helpText, ×tamp, owner, lastChanged, &changeDiary, &Status);
#else
ret = ARGetFieldCached(ctrl, schema, id, fieldName, &fieldMap, &dataType, &option, &createMode, &defaultVal, &permissions, &limit, &displayList, &helpText, ×tamp, owner, lastChanged, &changeDiary, &Status);
#endif
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, Status)) {
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
/* store field id for convenience */
hv_store(RETVAL, "fieldId", strlen("fieldId") , newSViv(id), 0);
if (createMode == AR_FIELD_OPEN_AT_CREATE)
hv_store(RETVAL, "createMode", strlen("createMode") , newSVpv("open",0), 0);
else
hv_store(RETVAL, "createMode", strlen("createMode") ,
newSVpv("protected",0), 0);
hv_store(RETVAL, "option", strlen("option") , newSViv(option), 0);
#if AR_CURRENT_API_VERSION >= 12
hv_store(RETVAL, "fieldOption", strlen("fieldOption") , newSViv(fieldOption), 0);
#endif
hv_store(RETVAL, "dataType", strlen("dataType") ,
perl_dataType_names(ctrl, &dataType), 0);
hv_store(RETVAL, "defaultVal", strlen("defaultVal") ,
perl_ARValueStruct(ctrl, &defaultVal), 0);
#if AR_CURRENT_API_VERSION >= 17
hv_store(RETVAL, "assignedGroupList", strlen("assignedGroupList") ,
perl_ARPermissionList(ctrl, &assignedGroupList, PERMTYPE_FIELD), 0);
#endif
hv_store(RETVAL, "permissions", strlen("permissions") ,
perl_ARPermissionList(ctrl, &permissions, PERMTYPE_FIELD), 0);
hv_store(RETVAL, "limit", strlen("limit") ,
perl_ARFieldLimitStruct(ctrl, &limit), 0);
hv_store(RETVAL, "fieldName", strlen("fieldName") ,
newSVpv(fieldName, 0), 0);
hv_store(RETVAL, "fieldMap", strlen("fieldMap") ,
perl_ARFieldMappingStruct(ctrl, &fieldMap), 0);
hv_store(RETVAL, "displayInstanceList", strlen("displayInstanceList") ,
perl_ARDisplayInstanceList(ctrl, &displayList), 0);
if (helpText)
hv_store(RETVAL, "helpText", strlen("helpText") ,
newSVpv(helpText, 0), 0);
hv_store(RETVAL, "timestamp", strlen("timestamp") ,
newSViv(timestamp), 0);
hv_store(RETVAL, "owner", strlen("owner") ,
newSVpv(owner, 0), 0);
hv_store(RETVAL, "lastChanged", strlen("lastChanged") ,
newSVpv(lastChanged, 0), 0);
if (changeDiary) {
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &Status);
if (!ARError(ret, Status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl, (ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
FreeARFieldLimitStruct(&limit,FALSE);
FreeARDisplayInstanceList(&displayList,FALSE);
if(helpText) {
/* AP_FREE(helpText); */ /* TS 20060207 disabled bc of memory errors with 5.8.8 */
}
if(changeDiary) {
AP_FREE(changeDiary);
}
}else{
XSRETURN_UNDEF;
}
}
OUTPUT:
RETVAL
HV*
ars_GetImage(ctrl,name)
ARControlStruct * ctrl
ARNameType name
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
perl_ARPropList(ctrl, &objPropList), 0);
hv_store(RETVAL, "timestamp", strlen("timestamp") , newSViv(timestamp), 0);
hv_store(RETVAL, "checkSum", strlen("checkSum") , newSVpv(checkSum, 0), 0);
if( description ){
hv_store(RETVAL, "description", strlen("description") , newSVpv(description, 0), 0);
}
if( helpText ){
hv_store(RETVAL, "helpText", strlen("helpText") , newSVpv(helpText, 0), 0);
}
hv_store(RETVAL, "owner", strlen("owner") , newSVpv(owner, 0), 0);
hv_store(RETVAL, "lastChanged", strlen("lastChanged") , newSVpv(lastChanged, 0), 0);
if( changeDiary ){
ret = ARDecodeDiary(ctrl, changeDiary, &diaryList, &status);
if (!ARError(ret, status)) {
hv_store(RETVAL, "changeDiary", strlen("changeDiary") ,
perl_ARList(ctrl,
(ARList *)&diaryList,
(ARS_fn)perl_diary,
sizeof(ARDiaryStruct)), 0);
FreeARDiaryList(&diaryList, FALSE);
}
}
if(helpText) { AP_FREE(helpText); }
if(changeDiary) { AP_FREE(changeDiary); }
if(imageType) { AP_FREE(imageType); }
if(checkSum) { AP_FREE(checkSum); }
if(description) { AP_FREE(description); }
FreeARImageDataStruct(&content, FALSE);
FreeARPropList(&objPropList, FALSE);
}else{
XSRETURN_UNDEF;
}
#else /* prior to ARS 7.5 */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ars_GetImage() is only available in ARS >= 7.5");
XSRETURN_UNDEF;
#endif
}
OUTPUT:
RETVAL
int
ars_SetEntry(ctrl,schema,entry_id,getTime,...)
ARControlStruct * ctrl
char * schema
char * entry_id
unsigned long getTime
CODE:
{
int a = 0, i = 0, c = (items - 4) / 2;
int offset = 4;
ARFieldValueList fieldList;
ARInternalIdList getFieldIds;
ARStatusList status;
int ret = 0;
unsigned int dataType = 0, j = 0;
unsigned int option = AR_JOIN_SETOPTION_NONE;
AREntryIdList entryList;
HV *cacheFields;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&fieldList, 1, ARFieldValueList);
Zero(&getFieldIds, 1, ARInternalIdList);
Zero(&entryList, 1,AREntryIdList);
RETVAL = 0; /* assume error */
if ((items - 4) % 2) {
option = SvIV(ST(offset));
offset ++;
}
if (c < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
goto set_entry_exit;
}
cacheFields = fieldcache_get_schema_fields( ctrl, schema, FALSE );
if( ! cacheFields ){
goto set_entry_exit;
}
fieldList.numItems = c;
AMALLOCNN(fieldList.fieldValueList,c,ARFieldValueStruct);
getFieldIds.numItems = 0;
getFieldIds.internalIdList = NULL;
for (i=0; i<c; i++) {
ARInternalId fieldId;
a = i*2+offset;
fieldId = fieldList.fieldValueList[i].fieldId = SvIV(ST(a));
if (! SvOK(ST(a+1))) {
/* pass a NULL */
fieldList.fieldValueList[i].value.dataType = AR_DATA_TYPE_NULL;
}else{
/* determine data type and pass value */
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto set_entry_end;
}
}else{
if( getFieldIds.numItems == 0 ){
AMALLOCNN(getFieldIds.internalIdList,c,ARInternalId);
}
/* printf( "%s [%d] collect for loading\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
getFieldIds.internalIdList[getFieldIds.numItems] = fieldId;
++getFieldIds.numItems;
}
}
}
/* load missing fields into cache */
if( getFieldIds.numItems > 0 ){
/* printf( "--- load missing fields ---\n" ); fflush(stdout); */ /* _DEBUG_ */
/* if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) != AR_RETURN_OK ){ */
if( fieldcache_load_schema(ctrl,schema,&getFieldIds,NULL) > AR_RETURN_WARNING ){
goto set_entry_end;
}
}
/* now get data type from the freshly cached fields */
i = 0;
for (j=0; j<getFieldIds.numItems; ++j) {
ARInternalId fieldId = getFieldIds.internalIdList[j];
while(fieldId != fieldList.fieldValueList[i].fieldId) ++i;
a = i*2+offset;
dataType = fieldcache_get_data_type( cacheFields, fieldId );
if (dataType <= AR_DATA_TYPE_MAX_TYPE) {
/* printf( "%s [%d] freshly loaded\n", schema, fieldId ); fflush(stdout); */ /* _DEBUG_ */
if (sv_to_ARValue(ctrl, ST(a+1), dataType, &fieldList.fieldValueList[i].value) < 0) {
goto set_entry_end;
}
}else{
char errTxt[256];
sprintf( errTxt, "Failed to fetch field %d from hash", fieldId );
ARError_add(AR_RETURN_ERROR, AP_ERR_FIELD_TYPE);
ARError_add(AR_RETURN_ERROR, AP_ERR_CONTINUE, errTxt );
goto set_entry_end;
}
}
/* printf( "--------------------\n" ); fflush(stdout); */ /* _DEBUG_ */
/* build entryList */
if(perl_BuildEntryList(ctrl, &entryList, entry_id) != 0){
goto set_entry_end;
}
ret = ARSetEntry(ctrl, schema, &entryList, &fieldList, getTime, option, &status);
if (entryList.entryIdList) AP_FREE(entryList.entryIdList);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, status)) {
RETVAL = 1;
}
set_entry_end:;
if (fieldList.fieldValueList) AP_FREE(fieldList.fieldValueList);
set_entry_exit:;
}
OUTPUT:
RETVAL
SV *
ars_Export(ctrl,displayTag,vuiType,...)
ARControlStruct * ctrl
char * displayTag
unsigned int vuiType
CODE:
{
int ret = 0, i = 0, a = 0, c = (items - 3) / 2, ok = 1;
ARStructItemList structItems;
char *buf = CPNULL;
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 17
unsigned int exportOption = AR_EXPORT_DEFAULT; /* TODO: support this as ars_Export() argument */
#endif
#if AR_EXPORT_VERSION >= 8L
ARWorkflowLockStruct workflowLockStruct;
#endif
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
Zero(&structItems, 1, ARStructItemList);
#if AR_EXPORT_VERSION >= 8L
Zero(&workflowLockStruct, 1, ARWorkflowLockStruct);
#endif
RETVAL = &PL_sv_undef;
if ( (items % 2 == 0) || (c < 1) ) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
ARStatusList status;
ARInternalIdList idList;
int ret = 0;
unsigned int i = 0;
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&idList, 1, ARInternalIdList);
ret = ARGetListVUI(ctrl, schema,
changedSince,
#if AR_CURRENT_API_VERSION >= 17
NULL, /* &objPropList (undocumented by BMC) */
#endif
&idList,
&status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status)) {
for(i = 0 ; i < idList.numItems ; i++) {
XPUSHs(sv_2mortal(newSViv(idList.internalIdList[i])));
}
}
FreeARInternalIdList(&idList, FALSE);
#else /* ars 2.x */
(void) ARError_reset();
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED, "Not available in 2.x");
#endif
}
void
ars_SetServerInfo(ctrl, ...)
ARControlStruct * ctrl
PPCODE:
{
ARStatusList status;
ARServerInfoList serverInfo;
int ret = 0, i = 0, count = 0;
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
Zero(&serverInfo, 1, ARServerInfoList);
if((items == 1) || ((items % 2) == 0)) {
(void) ARError_add(AR_RETURN_ERROR,
AP_ERR_BAD_ARGS);
} else {
unsigned int infoType, j = 0;
char buf[256];
serverInfo.numItems = (items - 1) / 2;
serverInfo.serverInfoList = MALLOCNN(serverInfo.numItems * sizeof(ARServerInfoStruct));
/* Zero(serverInfo.serverInfoList, 1, ARServerInfoStruct); # happens already in MALLOCNN */
for(j = 0 ; j < serverInfo.numItems ; ++j) {
i = 2 * j + 1;
infoType = lookUpServerInfoTypeHint(SvIV(ST(i)));
serverInfo.serverInfoList[j].operation = SvIV(ST(i));
serverInfo.serverInfoList[j].value.dataType = infoType;
switch(infoType) {
case AR_DATA_TYPE_CHAR:
serverInfo.serverInfoList[j].value.u.charVal = strdup(SvPV(ST(i+1), PL_na));
break;
case AR_DATA_TYPE_INTEGER:
serverInfo.serverInfoList[j].value.u.intVal = SvIV(ST(i+1));
break;
default:
sprintf( buf, "(%d) type = %d", serverInfo.serverInfoList[j].operation, serverInfo.serverInfoList[j].value.dataType );
(void) ARError_add(AR_RETURN_ERROR, AP_ERR_INV_ARGS,
buf);
FreeARServerInfoList(&serverInfo, FALSE);
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
goto SetServerInfo_fail;
}
}
ret = ARSetServerInfo(ctrl, &serverInfo, &status);
FreeARServerInfoList(&serverInfo, FALSE);
if(ARError(ret, status)) {
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
} else {
XPUSHs(sv_2mortal(newSViv(1))); /* OK */
}
}
SetServerInfo_fail:;
}
void
ars_GetServerInfo(ctrl, ...)
ARControlStruct * ctrl
PPCODE:
{
ARStatusList status;
ARServerInfoRequestList requestList;
ARServerInfoList serverInfo;
int ret = 0;
int i = 0;
unsigned int ui = 0, count = 0;
unsigned int rlist[AR_MAX_SERVER_INFO_USED];
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(&requestList, 1, ARServerInfoRequestList);
Zero(&serverInfo, 1, ARServerInfoList);
count = 0;
if(items == 1) { /* none specified.. fetch all */
for(i = 0; i < AR_MAX_SERVER_INFO_USED ; i++) {
/* we'll exclude ones that can't be retrieved to avoid errors */
switch(i+1) {
case AR_SERVER_INFO_DB_PASSWORD:
#if AR_CURRENT_API_VERSION < 17
case 332:
case 331:
case 330:
case 329:
case 328:
case 327:
case 326:
case 325:
#endif
break;
default:
rlist[count++] = i+1;
}
}
}else if(items > AR_MAX_SERVER_INFO_USED + 1) {
ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
}else { /* user has asked for specific ones */
for(i = 1 ; i < items ; i++) {
rlist[count++] = SvIV(ST(i));
}
}
if(count > 0) {
requestList.numItems = count;
requestList.requestList = rlist;
ret = ARGetServerInfo(ctrl, &requestList, &serverInfo, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if(!ARError( ret, status)) {
for(ui = 0 ; ui < serverInfo.numItems ; ui++) {
/* provided we have a mapping for the operation code,
* push out it's translation. else push out the code itself
*/
if(serverInfo.serverInfoList[ui].operation <= AR_MAX_SERVER_INFO_USED) {
/* printf( "%d %s: data type = %d\n", serverInfo.serverInfoList[ui].operation, ServerInfoMap[serverInfo.serverInfoList[ui].operation].name, serverInfo.serverInfoList[ui].value.dataType ); */
XPUSHs(sv_2mortal(newSVpv(ServerInfoMap[serverInfo.serverInfoList[ui].operation].name, 0)));
} else {
XPUSHs(sv_2mortal(newSViv(serverInfo.serverInfoList[ui].operation)));
}
XPUSHs(sv_2mortal(perl_ARValueStruct(ctrl,
&(serverInfo.serverInfoList[ui].value))));
}
}
FreeARServerInfoList(&serverInfo, FALSE);
}
}
HV *
ars_GetVUI(ctrl, schema, vuiId)
ARControlStruct * ctrl
char * schema
ARInternalId vuiId
CODE:
{
#if AR_EXPORT_VERSION >= 3
ARStatusList status;
ARNameType vuiName;
ARPropList dPropList;
char *helpText = CPNULL;
ARTimestamp timestamp;
ARAccessNameType owner;
ARAccessNameType lastChanged;
char *changeDiary = CPNULL;
int ret = 0;
ARDiaryList diaryList;
ARPropList objPropList;
# if AR_EXPORT_VERSION >= 6
unsigned int vuiType = 0;
ARLocaleType locale;
Zero(locale, 1, ARLocaleType);
# endif
RETVAL = newHV();
sv_2mortal( (SV*) RETVAL );
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(vuiName, 1, ARNameType);
Zero(&dPropList, 1, ARPropList);
Zero(&objPropList, 1, ARPropList);
Zero(×tamp, 1, ARTimestamp);
Zero(owner, 1, ARAccessNameType);
Zero(lastChanged, 1, ARAccessNameType);
ret = ARGetVUI(ctrl, schema, vuiId, vuiName,
# if AR_EXPORT_VERSION >= 6
locale, &vuiType,
# endif
&dPropList, &helpText,
×tamp, owner, lastChanged, &changeDiary,
#if AR_CURRENT_API_VERSION >= 17
&objPropList,
#endif
&status);
# ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
# endif
if(!ARError( ret, status)) {
if( rv == 0 ){
ret = ARSetCharMenu( ctrl,
name,
newNamePtr,
refreshCodePtr,
arMenuDef,
helpText,
owner,
changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
if( arMenuDef != NULL ){
FreeARCharMenuStruct( arMenuDef, TRUE );
}
if( objPropList != NULL ){
FreeARPropList( objPropList, TRUE );
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports SetCharMenu() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
#define STR_TEMP_SIZE 30
int
ars_CreateField( ctrl, schema, fieldDefRef, reservedIdOK=0 )
ARControlStruct * ctrl
ARNameType schema
SV * fieldDefRef
ARBoolean reservedIdOK
CODE:
{
#if AR_EXPORT_VERSION >= 6L
int ret = 0, rv = 0;
ARInternalId fieldId;
ARNameType fieldName;
ARFieldMappingStruct fieldMap;
unsigned int dataType;
unsigned int option;
unsigned int createMode = AR_FIELD_PROTECTED_AT_CREATE;
#if AR_EXPORT_VERSION >= 9L
unsigned int fieldOption;
#endif
ARValueStruct *defaultVal = NULL;
ARPermissionList permissions;
ARFieldLimitStruct *limit = NULL;
ARDisplayInstanceList dInstanceList;
char *helpText = NULL;
ARAccessNameType owner;
char *changeDiary = NULL;
ARPropList *objPropList = NULL;
ARStatusList status;
HV *fieldDef = NULL;
SV **pSvTemp;
char strTemp[STR_TEMP_SIZE+1];
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(owner, 1,ARAccessNameType);
Zero(fieldName, 1,ARNameType);
Zero(&status, 1,ARStatusList);
Zero(&fieldMap, 1,ARFieldMappingStruct);
Zero(&permissions, 1,ARPermissionList);
Zero(&dInstanceList, 1, ARDisplayInstanceList);
if( SvROK(fieldDefRef) && SvTYPE(SvRV(fieldDefRef)) == SVt_PVHV ){
fieldDef = (HV*) SvRV(fieldDefRef);
}else{
croak("usage: ars_CreateField(...)");
}
rv += ulongcpyHVal( fieldDef, "fieldId", &fieldId );
rv += strcpyHVal( fieldDef, "fieldName", fieldName, AR_MAX_NAME_SIZE );
fieldMap.fieldType = AR_FIELD_REGULAR;
rv += rev_ARFieldMappingStruct( ctrl, fieldDef, "fieldMap", &fieldMap );
rv += strcpyHVal( fieldDef, "dataType", strTemp, STR_TEMP_SIZE );
dataType = caseLookUpTypeNumber( (TypeMapStruct*) DataTypeMap, strTemp );
rv += uintcpyHVal( fieldDef, "option", &option );
rv += strcpyHVal( fieldDef, "createMode", strTemp, STR_TEMP_SIZE );
if( !strncmp(strTemp,"open",STR_TEMP_SIZE) ){
createMode = AR_FIELD_OPEN_AT_CREATE;
}else if( !strncmp(strTemp,"protected",STR_TEMP_SIZE) ){
createMode = AR_FIELD_PROTECTED_AT_CREATE;
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL,
"ars_CreateField: invalid createmode:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
strTemp ? strTemp : "n/a");
}
#if AR_EXPORT_VERSION >= 9L
rv += uintcpyHVal( fieldDef, "fieldOption", &fieldOption );
#endif
pSvTemp = hv_fetch( fieldDef, "defaultVal", strlen("defaultVal") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
defaultVal = (ARValueStruct*) MALLOCNN( sizeof(ARValueStruct) );
rv += rev_ARValueStruct( ctrl, fieldDef, "defaultVal", "dataType", defaultVal );
}
permissions.numItems = 0;
permissions.permissionList = NULL;
rv += rev_ARPermissionList( ctrl, fieldDef, "permissions", &permissions );
pSvTemp = hv_fetch( fieldDef, "limit", strlen("limit") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
limit = (ARFieldLimitStruct*) MALLOCNN( sizeof(ARFieldLimitStruct) );
/* rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", "dataType", limit ); */
rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", limit );
}
#if AR_CURRENT_API_VERSION >= 17
pSvTemp = hv_fetch( fieldDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
objPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
/* rv += rev_ARPropList( ctrl, fieldDef, "objPropList", "dataType", objPropList ); */
rv += rev_ARPropList( ctrl, fieldDef, "objPropList", objPropList );
}
#endif
rv += rev_ARDisplayInstanceList( ctrl, fieldDef, "displayInstanceList", &dInstanceList );
if( hv_exists(fieldDef,"helpText",8) ){
rv += strmakHVal( fieldDef, "helpText", &helpText );
}
if( hv_exists(fieldDef,"owner",5) ){
rv += strcpyHVal( fieldDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE );
}
if( hv_exists(fieldDef,"changeDiary",11) ){
rv += strmakHVal( fieldDef, "changeDiary", &changeDiary );
}
if( rv == 0 ){
ret = ARCreateField( ctrl,
schema,
&fieldId,
reservedIdOK,
fieldName,
&fieldMap,
dataType,
option,
createMode,
#if AR_EXPORT_VERSION >= 9L
fieldOption,
#endif
defaultVal,
&permissions,
limit,
&dInstanceList,
helpText,
owner,
changeDiary,
#if AR_CURRENT_API_VERSION >= 17
objPropList,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : fieldId;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( helpText != NULL ){
AP_FREE( helpText );
}
if( changeDiary != NULL ){
AP_FREE( changeDiary );
}
if( defaultVal != NULL ){
FreeARValueStruct( defaultVal, TRUE );
}
FreeARPermissionList( &permissions, FALSE );
if( limit != NULL ){
FreeARFieldLimitStruct( limit, TRUE );
}
FreeARDisplayInstanceList( &dInstanceList, FALSE );
/*
FreeARStatusList( &status, FALSE );
printf( "-- FreeARStatusList -- OK\n" ); // _DEBUG_
*/
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateField() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetField( ctrl, schema, fieldId, fieldDefRef )
ARControlStruct * ctrl
ARNameType schema
ARInternalId fieldId
SV * fieldDefRef
SV **pSvTemp;
char strTemp[STR_TEMP_SIZE+1];
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(fieldName, 1,ARNameType);
Zero(owner, 1,ARAccessNameType);
Zero(&status, 1,ARStatusList);
if( SvROK(fieldDefRef) && SvTYPE(SvRV(fieldDefRef)) == SVt_PVHV ){
fieldDef = (HV*) SvRV(fieldDefRef);
}else{
croak("usage: ars_SetField(...)");
}
/* rv += ulongcpyHVal( fieldDef, "fieldId", &fieldId ); */
pSvTemp = hv_fetch( fieldDef, "fieldName", strlen("fieldName") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += strcpyHVal( fieldDef, "fieldName", fieldName, AR_MAX_NAME_SIZE );
fieldNamePtr = fieldName;
}
pSvTemp = hv_fetch( fieldDef, "fieldMap", strlen("fieldMap") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
fieldMap = (ARFieldMappingStruct*) MALLOCNN( sizeof(ARFieldMappingStruct) );
rv += rev_ARFieldMappingStruct( ctrl, fieldDef, "fieldMap", fieldMap );
}
pSvTemp = hv_fetch( fieldDef, "option", strlen("option") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
option = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += uintcpyHVal( fieldDef, "option", option );
}
pSvTemp = hv_fetch( fieldDef, "createMode", strlen("createMode") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
createMode = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += strcpyHVal( fieldDef, "createMode", strTemp, STR_TEMP_SIZE );
if( !strncmp(strTemp,"open",STR_TEMP_SIZE) ){
*createMode = AR_FIELD_OPEN_AT_CREATE;
}else if( !strncmp(strTemp,"protected",STR_TEMP_SIZE) ){
*createMode = AR_FIELD_PROTECTED_AT_CREATE;
}else{
ARError_add(AR_RETURN_WARNING, AP_ERR_GENERAL,
"ars_CreateField: invalid createmode:");
ARError_add(AR_RETURN_WARNING, AP_ERR_CONTINUE,
strTemp ? strTemp : "n/a");
}
}
#if AR_EXPORT_VERSION >= 9L
pSvTemp = hv_fetch( fieldDef, "fieldOption", strlen("fieldOption") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
fieldOption = (unsigned int*) MALLOCNN( sizeof(unsigned int) );
rv += uintcpyHVal( fieldDef, "fieldOption", fieldOption );
}
#endif
pSvTemp = hv_fetch( fieldDef, "defaultVal", strlen("defaultVal") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
defaultVal = (ARValueStruct*) MALLOCNN( sizeof(ARValueStruct) );
rv += rev_ARValueStruct( ctrl, fieldDef, "defaultVal", "dataType", defaultVal );
}
pSvTemp = hv_fetch( fieldDef, "permissions", strlen("permissions") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
permissions = (ARPermissionList*) MALLOCNN( sizeof(ARPermissionList) );
rv += rev_ARPermissionList( ctrl, fieldDef, "permissions", permissions );
}
pSvTemp = hv_fetch( fieldDef, "limit", strlen("limit") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
limit = (ARFieldLimitStruct*) MALLOCNN( sizeof(ARFieldLimitStruct) );
/* rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", "dataType", limit ); */
rv += rev_ARFieldLimitStruct( ctrl, fieldDef, "limit", limit );
}
#if AR_CURRENT_API_VERSION >= 17
pSvTemp = hv_fetch( fieldDef, "objPropList", strlen("objPropList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
objPropList = (ARPropList*) MALLOCNN( sizeof(ARPropList) );
/* rv += rev_ARPropList( ctrl, fieldDef, "objPropList", "dataType", objPropList ); */
rv += rev_ARPropList( ctrl, fieldDef, "objPropList", objPropList );
}
#endif
pSvTemp = hv_fetch( fieldDef, "displayInstanceList", strlen("displayInstanceList") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
dInstanceList = (ARDisplayInstanceList*) MALLOCNN( sizeof(ARDisplayInstanceList) );
rv += rev_ARDisplayInstanceList( ctrl, fieldDef, "displayInstanceList", dInstanceList );
}
if( hv_exists(fieldDef,"helpText",8) ){
rv += strmakHVal( fieldDef, "helpText", &helpText );
}
if( hv_exists(fieldDef,"owner",5) ){
rv += strcpyHVal( fieldDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE );
ownerPtr = owner;
}
#if AR_EXPORT_VERSION >= 9L
pSvTemp = hv_fetch( fieldDef, "setFieldOptions", strlen("setFieldOptions") , 0 );
if( pSvTemp && *pSvTemp && SvTYPE(*pSvTemp) != SVt_NULL ){
rv += uintcpyHVal( fieldDef, "setFieldOptions", &setFieldOptions );
}
#endif
if( hv_exists(fieldDef,"changeDiary",11) ){
rv += strmakHVal( fieldDef, "changeDiary", &changeDiary );
}
if( rv == 0 ){
ret = ARSetField( ctrl,
schema,
fieldId,
fieldNamePtr,
fieldMap,
option,
createMode,
#if AR_EXPORT_VERSION >= 9L
fieldOption,
#endif
defaultVal,
permissions,
limit,
dInstanceList,
helpText,
ownerPtr,
changeDiary,
#if AR_EXPORT_VERSION >= 9L
setFieldOptions,
#endif
#if AR_CURRENT_API_VERSION >= 17
objPropList,
#endif
&status );
RETVAL = ARError(ret,status) ? 0 : fieldId;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
RETVAL = 0;
}
if( createMode != NULL ){
AP_FREE( createMode );
#if AR_EXPORT_VERSION >= 3
ARInternalId controlField = 0;
ARInternalId focusField = 0;
#else /* 2.x */
ARInternalId field = 0;
ARDisplayList displayList;
#endif
unsigned int enable = 0;
ARQualifierStruct *query;
ARActiveLinkActionList actionList;
#if AR_EXPORT_VERSION >= 3
ARActiveLinkActionList elseList;
#endif
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
#if AR_EXPORT_VERSION >= 5
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(schema, 1, ARNameType);
Zero(name, 1, ARNameType);
Zero(&groupList, 1,ARInternalIdList);
Zero(&actionList, 1,ARActiveLinkActionList);
Zero(owner, 1, ARAccessNameType);
#if AR_EXPORT_VERSION >= 3
Zero(&elseList, 1,ARActiveLinkActionList);
#else
Zero(&displayList, 1,ARDisplayList);
#endif
#if AR_EXPORT_VERSION >= 5
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
#endif
if(SvTYPE((SV *)SvRV(alDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *alDef = (HV *)SvRV(alDefRef);
SV **qhv = hv_fetch(alDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, alDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( alDef, "name", name, AR_MAX_NAME_SIZE);
#if AR_EXPORT_VERSION >= 5
rv += rev_ARNameList( ctrl, alDef, "schemaList", schemaList.u.schemaList );
#else
rv += strcpyHVal( alDef, "schema", schema, AR_MAX_NAME_SIZE);
#endif
rv += uintcpyHVal( alDef, "order", &order);
rv += rev_ARInternalIdList(ctrl, alDef, "groupList", &groupList);
rv += uintcpyHVal( alDef, "executeMask", &executeMask);
rv += uintcpyHVal( alDef, "enable", &enable);
if(hv_exists(alDef, "owner", strlen("owner") ))
rv += strcpyHVal( alDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(alDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( alDef, "changeDiary", &changeDiary);
if(hv_exists(alDef, "helpText", strlen("helpText") ))
rv += strmakHVal( alDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
rv += rev_ARActiveLinkActionList(ctrl, alDef, "actionList",
&actionList);
#if AR_EXPORT_VERSION >= 3
rv += rev_ARActiveLinkActionList(ctrl, alDef, "elseList",
&elseList);
if((executeMask & AR_EXECUTE_ON_RETURN)
|| (executeMask & AR_EXECUTE_ON_MENU_CHOICE)
#if AR_EXPORT_VERSION >= 4
|| (executeMask & AR_EXECUTE_ON_GAIN_FOCUS)
|| (executeMask & AR_EXECUTE_ON_LOSE_FOCUS)
#endif
)
rv += ulongcpyHVal( alDef, "focusField",
&focusField);
if(executeMask & AR_EXECUTE_ON_BUTTON)
rv += ulongcpyHVal( alDef, "controlField",
&controlField);
#else /* 2.x */
if((executeMask & AR_EXECUTE_ON_RETURN) ||
(executeMask & AR_EXECUTE_ON_MENU_CHOICE))
rv += ulongcpyHVal( alDef, "field", &field);
if(executeMask & AR_EXECUTE_ON_BUTTON)
rv += rev_ARDisplayList(ctrl, alDef, "displayList",
&displayList);
#endif
#if AR_EXPORT_VERSION >= 5
if(hv_exists(alDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, alDef, "objPropList",
&objPropList);
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* active link.
*/
if(rv == 0) {
#if AR_EXPORT_VERSION >= 5
ret = ARCreateActiveLink(ctrl, name, order, &schemaList,
&groupList, executeMask,
&controlField, &focusField,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 14
0, /* errorActlinkOptions, reserved for future use */
NULL, /* errorActlinkName, reserved for future use */
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
#elif AR_EXPORT_VERSION >= 3
ret = ARCreateActiveLink(ctrl, name, order, schema,
&groupList, executeMask,
&controlField, &focusField,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&status);
#else /* 2.x */
#endif
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARInternalIdList(&groupList, FALSE);
FreeARActiveLinkActionList(&actionList, FALSE);
#if AR_EXPORT_VERSION >= 3
FreeARActiveLinkActionList(&elseList, FALSE);
#else /* 2.x */
FreeARDisplayList(&displayList, FALSE);
#endif
#if AR_EXPORT_VERSION >= 5
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#endif
}
OUTPUT:
RETVAL
int
ars_SetActiveLink(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARInternalIdList *groupList = NULL;
unsigned int *executeMask = NULL;
unsigned int *order = NULL;
ARInternalId *controlField = NULL;
ARInternalId *focusField = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARActiveLinkActionList *actionList = NULL;
ARActiveLinkActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"order",5) ){
order = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "order", order );
}
if( hv_exists(objDef,"groupList",9) ){
groupList = (ARInternalIdList*) MALLOCNN(sizeof(ARInternalIdList));
rv += rev_ARInternalIdList(ctrl, objDef, "groupList", groupList);
}
if( hv_exists(objDef,"executeMask",11) ){
executeMask = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "executeMask", executeMask);
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
if(hv_exists(objDef, "actionList", strlen("actionList") )){
actionList = (ARActiveLinkActionList*) MALLOCNN(sizeof(ARActiveLinkActionList));
rv += rev_ARActiveLinkActionList(ctrl, objDef, "actionList", actionList);
}
if(hv_exists(objDef, "elseList", strlen("elseList") )){
elseList = (ARActiveLinkActionList*) MALLOCNN(sizeof(ARActiveLinkActionList));
rv += rev_ARActiveLinkActionList(ctrl, objDef, "elseList", elseList);
}
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
if( executeMask != NULL ){
if((*executeMask & AR_EXECUTE_ON_RETURN) ||
(*executeMask & AR_EXECUTE_ON_MENU_CHOICE)) {
focusField = (ARInternalId*) MALLOCNN(sizeof(ARInternalId));
rv += ulongcpyHVal( objDef, "focusField", focusField);
}
if(*executeMask & AR_EXECUTE_ON_BUTTON) {
controlField = (ARInternalId*) MALLOCNN(sizeof(ARInternalId));
rv += ulongcpyHVal( objDef, "controlField", controlField);
}
}
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to modify the workflow object
*/
if(rv == 0) {
ret = ARSetActiveLink(ctrl, name, newNamePtr, order, schemaList,
groupList, executeMask,
controlField, focusField,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 14
NULL, /* errorActlinkOptions, reserved for future use */
NULL, /* errorActlinkName, reserved for future use */
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( order != NULL ) { AP_FREE(order); }
if( executeMask != NULL ) { AP_FREE(executeMask); }
if( enable != NULL ) { AP_FREE(enable); }
if( focusField != NULL ) { AP_FREE(focusField); }
if( controlField != NULL ) { AP_FREE(controlField); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( groupList != NULL ) { FreeARInternalIdList( groupList, TRUE ); }
if( actionList != NULL ) { FreeARActiveLinkActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARActiveLinkActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateFilter(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType schema, name;
unsigned int opSet, order;
unsigned int enable = 0;
ARQualifierStruct *query;
ARFilterActionList actionList;
ARFilterActionList elseList;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
#if AR_CURRENT_API_VERSION >= 13
unsigned int errorFilterOptions = 0;
ARNameType errorFilterName;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(schema, 1, ARNameType);
Zero(name, 1, ARNameType);
Zero(&actionList, 1,ARFilterActionList);
Zero(&elseList, 1,ARFilterActionList);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
#if AR_CURRENT_API_VERSION >= 13
Zero(errorFilterName, 1, ARNameType);
#endif
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList.u.schemaList );
rv += uintcpyHVal( objDef, "order", &order);
rv += uintcpyHVal( objDef, "opSet", &opSet);
rv += uintcpyHVal( objDef, "enable", &enable);
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
rv += rev_ARFilterActionList(ctrl, objDef, "actionList",
&actionList);
rv += rev_ARFilterActionList(ctrl, objDef, "elseList",
&elseList);
if(hv_exists(objDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, objDef, "objPropList",
&objPropList);
#if AR_CURRENT_API_VERSION >= 13
if( hv_exists(objDef, "errorFilterOptions", strlen("errorFilterOptions")) )
rv += uintcpyHVal( objDef, "errorFilterOptions", &errorFilterOptions );
if( hv_exists(objDef, "errorFilterName", strlen("errorFilterName")) )
rv += strcpyHVal( objDef, "errorFilterName", errorFilterName, AR_MAX_NAME_SIZE );
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* filter.
*/
if(rv == 0) {
ret = ARCreateFilter(ctrl, name, order, &schemaList,
opSet,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 13
errorFilterOptions,
errorFilterName,
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARFilterActionList(&actionList, FALSE);
FreeARFilterActionList(&elseList, FALSE);
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetFilter(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
unsigned int *opSet = NULL;
unsigned int *order = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARFilterActionList *actionList = NULL;
ARFilterActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
#if AR_CURRENT_API_VERSION >= 13
unsigned int *errorFilterOptions = NULL;
ARNameType errorFilterName;
char *errorFilterNamePtr = NULL;
#endif
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
#if AR_CURRENT_API_VERSION >= 13
Zero(errorFilterName, 1, ARNameType);
#endif
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"order",5) ){
order = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "order", order );
}
if( hv_exists(objDef,"opSet",5) ){
opSet = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "opSet", opSet);
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
if(hv_exists(objDef, "actionList", strlen("actionList") )){
actionList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "actionList", actionList);
}
if(hv_exists(objDef, "elseList", strlen("elseList") )){
elseList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "elseList", elseList);
}
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
#if AR_CURRENT_API_VERSION >= 13
if( hv_exists(objDef,"errorFilterOptions",18) ){
errorFilterOptions = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "errorFilterOptions", errorFilterOptions);
}
if(hv_exists(objDef, "errorFilterName", strlen("errorFilterName") )){
rv += strcpyHVal( objDef, "errorFilterName", errorFilterName, AR_MAX_NAME_SIZE);
errorFilterNamePtr = errorFilterName;
}
#endif
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to modify the workflow object
*/
if(rv == 0) {
ret = ARSetFilter(ctrl, name, newNamePtr, order, schemaList,
opSet,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 13
errorFilterOptions,
errorFilterNamePtr,
#endif
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( order != NULL ) { AP_FREE(order); }
if( enable != NULL ) { AP_FREE(enable); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( actionList != NULL ) { FreeARFilterActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARFilterActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateEscalation(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType name;
unsigned int enable = 0;
AREscalationTmStruct escalationTm;
ARQualifierStruct *query;
ARFilterActionList actionList;
ARFilterActionList elseList;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARNameList schemaNameList;
ARWorkflowConnectStruct schemaList;
ARPropList objPropList;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(name, 1, ARNameType);
Zero(&actionList, 1,ARFilterActionList);
Zero(&elseList, 1,ARFilterActionList);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
Zero(&schemaList, 1, ARWorkflowConnectStruct);
Zero(&schemaNameList, 1, ARNameList);
Zero(&escalationTm, 1, AREscalationTmStruct);
schemaList.type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList.u.schemaList = &schemaNameList;
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if(qhv && *qhv && SvROK(*qhv)) {
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
} else {
query = (ARQualifierStruct *)NULL;
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList.u.schemaList );
rv += uintcpyHVal( objDef, "enable", &enable);
/* rv += rev_AREscalationTmStruct( ctrl, objDef, "escalationTm", &escalationTm ); */
rv += uintcpyHVal( objDef, "TmType", &(escalationTm.escalationTmType) );
switch( escalationTm.escalationTmType ){
case AR_ESCALATION_TYPE_INTERVAL:
rv += longcpyHVal( objDef, "TmInterval", &(escalationTm.u.interval) );
break;
case AR_ESCALATION_TYPE_TIMEMARK:
rv += longcpyHVal( objDef, "TmMonthDayMask", &(escalationTm.u.date.monthday) );
rv += longcpyHVal( objDef, "TmWeekDayMask", &(escalationTm.u.date.weekday) );
rv += longcpyHVal( objDef, "TmHourMask", &(escalationTm.u.date.hourmask) );
rv += uintcpyHVal( objDef, "TmMinute", &(escalationTm.u.date.minute) );
break;
default:
rv += (-1);
}
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
rv += rev_ARFilterActionList(ctrl, objDef, "actionList",
&actionList);
rv += rev_ARFilterActionList(ctrl, objDef, "elseList",
&elseList);
if(hv_exists(objDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, objDef, "objPropList",
&objPropList);
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* escalation.
*/
if(rv == 0) {
ret = ARCreateEscalation(ctrl, name,
&escalationTm,
&schemaList,
enable, query,
&actionList, &elseList,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
FreeARFilterActionList(&actionList, FALSE);
FreeARFilterActionList(&elseList, FALSE);
FreeARPropList(&objPropList, FALSE);
FreeARNameList(&schemaNameList, FALSE);
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_SetEscalation(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
#if AR_EXPORT_VERSION >= 5
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
AREscalationTmStruct *escalationTm = NULL;
unsigned int *enable = NULL;
ARQualifierStruct *query = NULL;
ARFilterActionList *actionList = NULL;
ARFilterActionList *elseList = NULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
char *objectModificationLogLabel = NULL;
ARStatusList status;
ARWorkflowConnectStruct *schemaList = NULL;
ARPropList *objPropList = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
SV **qhv = hv_fetch(objDef, "query", strlen("query") , 0);
/* dereference the qual pointer */
if( qhv && *qhv && SvROK(*qhv) ){
query = (ARQualifierStruct *)SvIV((SV *)SvRV(*qhv));
/* query = (ARQualifierStruct*) MALLOCNN( sizeof(ARQualifierStruct) );
rv += rev_ARQualifierStruct( ctrl, objDef, "query", query ); */
}
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if( hv_exists(objDef,"schemaList",10) ){
schemaList = (ARWorkflowConnectStruct*) MALLOCNN(sizeof(ARWorkflowConnectStruct));
schemaList->type = AR_WORKFLOW_CONN_SCHEMA_LIST;
schemaList->u.schemaList = (ARNameList*) MALLOCNN( sizeof(ARNameList) );
rv += rev_ARNameList( ctrl, objDef, "schemaList", schemaList->u.schemaList );
}
if( hv_exists(objDef,"enable",6) ){
enable = (unsigned int*) MALLOCNN(sizeof(unsigned int));
rv += uintcpyHVal( objDef, "enable", enable);
}
if( hv_exists(objDef,"TmInterval",10) ){
escalationTm = (AREscalationTmStruct*) MALLOCNN(sizeof(AREscalationTmStruct));
escalationTm->escalationTmType = AR_ESCALATION_TYPE_INTERVAL;
rv += longcpyHVal( objDef, "TmInterval", &(escalationTm->u.interval) );
}else if( hv_exists(objDef,"TmHourMask",10) ){
escalationTm = (AREscalationTmStruct*) MALLOCNN(sizeof(AREscalationTmStruct));
escalationTm->escalationTmType = AR_ESCALATION_TYPE_TIMEMARK;
rv += longcpyHVal( objDef, "TmMonthDayMask", &(escalationTm->u.date.monthday) );
rv += longcpyHVal( objDef, "TmWeekDayMask", &(escalationTm->u.date.weekday) );
rv += longcpyHVal( objDef, "TmHourMask", &(escalationTm->u.date.hourmask) );
rv += uintcpyHVal( objDef, "TmMinute", &(escalationTm->u.date.minute) );
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
/* now handle the action & else (3.x) lists */
if(hv_exists(objDef, "actionList", strlen("actionList") )){
actionList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "actionList", actionList);
}
if(hv_exists(objDef, "elseList", strlen("elseList") )){
elseList = (ARFilterActionList*) MALLOCNN(sizeof(ARFilterActionList));
rv += rev_ARFilterActionList(ctrl, objDef, "elseList", elseList);
}
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to modify the workflow object
*/
if(rv == 0) {
ret = ARSetEscalation(ctrl, name, newNamePtr,
escalationTm,
schemaList,
enable, query,
actionList, elseList,
helpText, ownerPtr, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
} else
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if( enable != NULL ) { AP_FREE(enable); }
/* if( query != NULL ) { FreeARARQualifierStruct( query, TRUE ); } */
if( schemaList != NULL ) { FreeARWorkflowConnectStruct( schemaList, TRUE ); }
if( actionList != NULL ) { FreeARFilterActionList( actionList, TRUE ); }
if( elseList != NULL ) { FreeARFilterActionList( elseList, TRUE ); }
if( objPropList != NULL ) { FreeARPropList( objPropList, TRUE ); }
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ARSperl supports CreateContainer() only for ARSystem >= 5.0");
RETVAL = AR_RETURN_ERROR;
#endif
}
OUTPUT:
RETVAL
int
ars_CreateImage(ctrl, objDefRef)
ARControlStruct * ctrl
SV * objDefRef
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
int ret = 0, rv = 0;
ARNameType name;
ARImageDataStruct imageBuf;
char *imageType = CPNULL;
char *description = CPNULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *changeDiary = CPNULL;
ARPropList objPropList;
char *objectModificationLogLabel = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(name, 1, ARNameType);
Zero(&imageBuf, 1,ARImageDataStruct);
Zero(owner, 1, ARAccessNameType);
Zero(&objPropList, 1, ARPropList);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
rv += strcpyHVal( objDef, "name", name, AR_MAX_NAME_SIZE);
rv += rev_ARImageDataStruct( ctrl, objDef, "imageData", &imageBuf );
rv += strmakHVal( objDef, "imageType", &imageType);
if(hv_exists(objDef, "description", strlen("description") ))
rv += strmakHVal( objDef, "description", &description);
if(hv_exists(objDef, "owner", strlen("owner") ))
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
else
strncpy(owner, ctrl->user, sizeof(ARAccessNameType));
/* these two are optional, so if the calls return warnings
* it probably indicates that the hash keys don't exist and
* we'll ignore it unless an actual failure code is returned.
*/
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
if(hv_exists(objDef, "objPropList", strlen("objPropList") ))
rv += rev_ARPropList(ctrl, objDef, "objPropList",
&objPropList);
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* image.
*/
if( rv == 0 ){
ret = ARCreateImage( ctrl, name,
&imageBuf,
imageType,
description,
helpText, owner, changeDiary,
&objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if (description) {
AP_FREE(description);
}
if (imageType) {
AP_FREE(description);
}
FreeARImageDataStruct(&imageBuf, FALSE);
FreeARPropList(&objPropList, FALSE);
#else /* prior to ARS 7.5 */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ars_CreateImage() is only available in ARS >= 7.5");
XSRETURN_UNDEF;
#endif
}
OUTPUT:
RETVAL
int
ars_SetImage(ctrl, name, objDefRef)
ARControlStruct * ctrl
ARNameType name
SV * objDefRef
CODE:
{
ARStatusList status;
#if AR_CURRENT_API_VERSION >= 14
int ret = 0, rv = 0;
ARNameType newName;
char *newNamePtr = NULL;
ARImageDataStruct *imageBuf = NULL;
char *imageType = CPNULL;
char *description = CPNULL;
char *helpText = CPNULL;
ARAccessNameType owner;
char *ownerPtr = NULL;
char *changeDiary = CPNULL;
ARPropList *objPropList = NULL;
char *objectModificationLogLabel = NULL;
RETVAL = 0; /* assume error */
(void) ARError_reset();
Zero(&status, 1,ARStatusList);
Zero(newName, 1, ARNameType);
Zero(owner, 1, ARAccessNameType);
if(SvTYPE((SV *)SvRV(objDefRef)) != SVt_PVHV) {
ARError_add( AR_RETURN_ERROR, AP_ERR_EXPECT_PVHV);
} else {
HV *objDef = (HV *)SvRV(objDefRef);
/* copy the various hash entries into the appropriate
* data structure. if any are missing, we fail.
*/
rv = 0;
if( hv_exists(objDef,"name",4) ){
rv += strcpyHVal( objDef, "name", newName, AR_MAX_NAME_SIZE );
newNamePtr = newName;
}
if(hv_exists(objDef, "owner", strlen("owner") )){
rv += strcpyHVal( objDef, "owner", owner, AR_MAX_ACCESS_NAME_SIZE);
ownerPtr = owner;
}
if(hv_exists(objDef, "changeDiary", strlen("changeDiary") ))
rv += strmakHVal( objDef, "changeDiary", &changeDiary);
if(hv_exists(objDef, "helpText", strlen("helpText") ))
rv += strmakHVal( objDef, "helpText", &helpText);
if(hv_exists(objDef, "imageType", strlen("imageType") ))
rv += strmakHVal( objDef, "imageType", &imageType);
if(hv_exists(objDef, "imageData", strlen("imageData") )){
imageBuf = (ARImageDataStruct*) MALLOCNN(sizeof(ARImageDataStruct));
rv += rev_ARImageDataStruct(ctrl, objDef, "imageData", imageBuf);
}
if(hv_exists(objDef, "description", strlen("description") ))
rv += strmakHVal( objDef, "description", &description);
if(hv_exists(objDef, "objPropList", strlen("objPropList") )){
objPropList = (ARPropList*) MALLOCNN(sizeof(ARPropList));
rv += rev_ARPropList(ctrl, objDef, "objPropList", objPropList);
}
/* at this point all datastructures (hopefully) are
* built. we can call the api routine to create the
* image.
*/
if( rv == 0 ){
ret = ARSetImage( ctrl, name,
newNamePtr,
imageBuf,
imageType,
description,
helpText, owner, changeDiary,
objPropList,
#if AR_CURRENT_API_VERSION >= 17
objectModificationLogLabel,
#endif
&status);
if(!ARError( ret, status))
RETVAL = 1;
}else{
ARError_add( AR_RETURN_ERROR, AP_ERR_PREREVFAIL);
}
}
if (helpText) {
AP_FREE(helpText);
}
if (changeDiary) {
AP_FREE(changeDiary);
}
if (description) {
AP_FREE(description);
}
if (imageType) {
AP_FREE(description);
}
if( imageBuf != NULL ) { FreeARImageDataStruct(imageBuf, TRUE); }
if( objPropList != NULL ) { FreeARPropList(objPropList, TRUE); }
#else /* prior to ARS 7.5 */
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"ars_SetImage() is only available in ARS >= 7.5");
XSRETURN_UNDEF;
#endif
}
OUTPUT:
RETVAL
char *
ars_MergeEntry(ctrl, schema, mergeType, ...)
ARControlStruct * ctrl
char * schema
unsigned int mergeType
CODE:
{
int a, i, c = (items - 3) / 2;
ARFieldValueList fieldList;
ARStatusList status;
int ret = 0;
unsigned int dataType = 0;
AREntryIdType entryId;
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
Zero(&fieldList, 1, ARFieldValueList);
Zero(&entryId, 1, AREntryIdType);
RETVAL = "";
if ((items - 3) % 2 || c < 1) {
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_BAD_ARGS);
goto merge_entry_exit;
}
fieldList.numItems = c;
AMALLOCNN(fieldList.fieldValueList, c, ARFieldValueStruct);
for (i = 0; i < c; i++) {
a = i*2 + 3;
fieldList.fieldValueList[i].fieldId = SvIV(ST(a));
if (! SvOK(ST(a+1))) {
/* pass a NULL */
fieldList.fieldValueList[i].value.dataType =
AR_DATA_TYPE_NULL;
} else {
#if AR_CURRENT_API_VERSION >= 17
ret = ARGetFieldCached(ctrl, schema,
fieldList.fieldValueList[i].fieldId,
NULL, NULL, &dataType, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &status);
#elif AR_EXPORT_VERSION >= 9
ret = ARGetFieldCached(ctrl, schema,
fieldList.fieldValueList[i].fieldId,
NULL, NULL, &dataType, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, &status);
#elif AR_EXPORT_VERSION >= 3
ret = ARGetFieldCached(ctrl, schema,
fieldList.fieldValueList[i].fieldId,
NULL, NULL, &dataType, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, &status);
#else
ret = ARGetFieldCached(ctrl, schema,
fieldList.fieldValueList[i].fieldId, &dataType,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, &status);
#endif
if (ARError( ret, status)) {
DBG( ("GetFieldCached failed %d\n", ret) );
goto merge_entry_end;
}
if (sv_to_ARValue(ctrl, ST(a+1), dataType,
&fieldList.fieldValueList[i].value) < 0) {
DBG( ("failed to convert to ARValue struct stack %d\n", a+1) );
goto merge_entry_end;
}
}
}
ret = ARMergeEntry(ctrl, schema, &fieldList, mergeType,
#if AR_CURRENT_API_VERSION >= 18
NULL, /* ARQualifier *query */
0, /* unsigned int multimatchOption */
#endif
entryId, &status);
#ifdef PROFILE
((ars_ctrl *)ctrl)->queries++;
#endif
if (! ARError( ret, status)) {
DBG( ("MergeEntry returned %d\n", ret) );
DBG( ("entryId %s\n", SAFEPRT(entryId)) );
RETVAL = entryId;
}
merge_entry_end:;
if (fieldList.fieldValueList) AP_FREE(fieldList.fieldValueList);
merge_entry_exit:;
}
OUTPUT:
RETVAL
void
ars_GetMultipleEntries(ctrl,schema,...)
ARControlStruct * ctrl
char * schema
PPCODE:
{
int ret = 0;
unsigned int c = items - 3, i;
AREntryIdListList entryList;
ARInternalIdList idList;
ARFieldValueListList fieldList;
ARBooleanList existList;
ARStatusList status;
AV *entryList_array;
entryList.entryIdList = NULL;
idList.internalIdList = NULL;
fieldList.valueListList = NULL;
existList.booleanList = NULL;
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
Zero(&entryList, 1, AREntryIdListList);
Zero(&idList, 1, ARInternalIdList);
Zero(&fieldList, 1, ARFieldValueListList);
Zero(&existList, 1, ARBooleanList);
/*
* build list of field Id's
*/
if (c < 1) {
idList.numItems = 0; /* get all fields */
} else {
char *fileName;
STRLEN len;
fileName = SvPV(ST(2),len);
if( logFilePtr != NULL ){
fclose( logFilePtr );
logFilePtr = NULL;
}
whereToWriteMask = AR_WRITE_TO_FILE;
logFilePtr = fopen( fileName, "a" );
if( logFilePtr == NULL ){
char buf[2048];
sprintf( buf, "Cannot open file: %s", fileName );
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_INV_ARGS, buf);
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
goto SetLogging_fail;
}
set_logging_file_ptr( logFilePtr );
/* printf( "SET logging_file_ptr = %p\n", logFilePtr ); */
}
ret = ARSetLogging( ctrl, logTypeMask, whereToWriteMask, logFilePtr, &status );
if( logTypeMask == 0 && logFilePtr != NULL ){
fclose( logFilePtr );
set_logging_file_ptr( NULL );
}
if(ARError(ret, status)) {
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
} else {
XPUSHs(sv_2mortal(newSViv(1))); /* OK */
}
SetLogging_fail:;
#else /* < 4.5 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"SetLogging() is only available in ARSystem >= 4.5");
#endif
}
void
ars_SetSessionConfiguration( ctrl, variableId, value )
ARControlStruct * ctrl
unsigned int variableId
long value
PPCODE:
{
#if AR_EXPORT_VERSION >= 6
ARStatusList status;
ARValueStruct variableValue;
int ret;
char numToCharBuf[32];
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
variableValue.dataType = AR_DATA_TYPE_INTEGER;
variableValue.u.intVal = value;
if (variableId == 12 || variableId == 13)
{
// just a quick and dirty solution because those variables need to be characters
sprintf(numToCharBuf, "%ld", value);
variableValue.dataType = AR_DATA_TYPE_CHAR;
variableValue.u.charVal = numToCharBuf;
}
ret = ARSetSessionConfiguration( ctrl, variableId, &variableValue, &status );
if(ARError(ret, status)) {
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
} else {
XPUSHs(sv_2mortal(newSViv(1))); /* OK */
}
#else /* < 5.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"SetSessionConfiguration() is only available in ARSystem >= 5.0");
#endif
}
void
ars_SetImpersonatedUser( ctrl, impersonatedUser )
ARControlStruct * ctrl
ARAccessNameType impersonatedUser
PPCODE:
{
#if AR_EXPORT_VERSION >= 9
ARStatusList status;
int ret;
(void) ARError_reset();
Zero(&status, 1, ARStatusList);
if( strcmp("",impersonatedUser) == 0 ){
ret = ARSetImpersonatedUser( ctrl, NULL, &status );
}else{
ret = ARSetImpersonatedUser( ctrl, impersonatedUser, &status );
}
if(ARError(ret, status)) {
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
} else {
XPUSHs(sv_2mortal(newSViv(1))); /* OK */
}
#else /* < 7.0 */
XPUSHs(sv_2mortal(newSViv(0))); /* ERR */
(void) ARError_add( AR_RETURN_ERROR, AP_ERR_DEPRECATED,
"SetImpersonatedUser() is only available in ARSystem >= 7.0");
#endif
}
void
ars_BeginBulkEntryTransaction( ctrl )
ARControlStruct * ctrl
PPCODE:
{
#if AR_CURRENT_API_VERSION >= 11
ARStatusList status;
( run in 0.722 second using v1.01-cache-2.11-cpan-39bf76dae61 )