MQSeries
view release on metacpan or search on metacpan
MQClient/MQSeries.xs.in/35MQPUT1-v5 view on Meta::CPAN
# -*-c-*-
#
# $Id: 35MQPUT1-v5,v 33.6 2012/09/26 16:10:04 jettisu Exp $
#
# (c) 1999-2012 Morgan Stanley & Co. Incorporated
# See ..../src/LICENSE for terms of distribution.
#
void
MQPUT1(Hconn,ObjDesc,MsgDesc,PutMsgOpts,Msg,CompCode,Reason)
MQHCONN Hconn
MQOD ObjDesc
MQMD MsgDesc
MQPMO PutMsgOpts
SV * Msg
MQLONG CompCode = NO_INIT
MQLONG Reason = NO_INIT
PREINIT:
SV **svp;
AV *ObjectRecs, *ObjectRecsArrayEntry;
AV *PutMsgRecs, *ValidPutMsgRecFieldsArray;
AV *ResponseRecArray;
HV *ObjectRecsHashEntry, *ResponseRecHash;
HV *PutMsgRecFields = NULL, *PutMsgRecHash;
HV *ValidPutMsgRecFieldsHash;
HV *ValidPutMsgRecFieldsSubHash;
PMQRR pResponseRecPtr = NULL;
PMQOR pObjectRecPtr;
char *Key, *pPutMsgRecPtr = NULL, *String;
STRLEN KeyLength, StringLength;
int index, subindex;
size_t FieldSize;
int PutMsgRecSize = 0;
PMQCHAR Buffer;
#ifdef MQOD_VERSION_4
MQCHAR resolved_object_string[MQ_TOPIC_STR_LENGTH];
#endif
PPCODE:
CompCode = MQCC_FAILED;
Reason = MQRC_UNEXPECTED_ERROR;
sv_setiv(ST(5),(IV)CompCode);
sv_setiv(ST(6),(IV)Reason);
/*
* We set the MQMD version to 2, so users of segmentation or
* grouping won't have to do this manually.
*/
if (MsgDesc.Version < MQMD_VERSION_2) {
MsgDesc.Version = MQMD_VERSION_2;
}
/*
If there is a list of ObjectRecs, then we are dealing with a
distribution list.
*/
if ( hv_exists((HV*)SvRV(ST(1)),"ObjectRecs",10) ) {
svp = hv_fetch((HV*)SvRV(ST(1)),"ObjectRecs",10,FALSE);
if ( svp == NULL ) {
warn("Unable to fetch value for key ObjectRecs\n");
XSRETURN_EMPTY;
}
if (!SvROK(*svp) ||
(SvROK(*svp) && SvTYPE(SvRV(*svp)) != SVt_PVAV )) {
warn("Invalid data for 'ObjectRecs', not an ARRAY reference\n");
XSRETURN_EMPTY;
}
ObjectRecs = (AV*)SvRV(*svp);
/* Override this, even if it was provided by the user */
ObjDesc.RecsPresent = av_len(ObjectRecs) + 1;
/*
* If this is NOT set, then MQOPEN() will puke. One more
* thing the user doesn't have to care about...
*
* PMR 31824,7TD and fix IY49267: MQPUT1 with a distribution
* list returns reason code 2136 except when MQOD_VERSION_3
* is specified. As MQOD_VERSION_3 is supported with
* queue managers and clients >= 5.1, it is safe to use
* this when defined. We try and support 5.0 clients as best
* we can.
*/
#ifdef MQOD_VERSION_3
if (ObjDesc.Version < MQOD_VERSION_3) {
ObjDesc.Version = MQOD_VERSION_3;
}
#else
/* Limited support for MQ 5.0 clients */
if (ObjDesc.Version < MQOD_VERSION_2) {
ObjDesc.Version = MQOD_VERSION_2;
}
#endif
/*
* Also force the PMO to version 2...
*/
( run in 0.437 second using v1.01-cache-2.11-cpan-5511b514fd6 )