- 论坛徽章:
- 0
|
char *XmlTemp=NULL;
char *XmlData=NULL;
int XmlLength=4001;
init(v_det_flag);
strncpy(v_det_flag,v_order_data[i].det_flag,1);
if (strcmp(v_det_flag,ORDERDETFLAG_Y)==0) /*如果有明细数据*/
{
EXEC SQL SELECT LENGTH(INTERFACE_DATA) INTO :XmlLength FROM wOrderReceiptDet WHERE ORDER_ACCEPT=:v_order_data[i].order_accept;
XmlTemp=NULL;
XmlTemp=(char *)malloc((XmlLength+128)*sizeof(char));
memset(XmlTemp,'3',sizeof(char)*XmlLength+128);
if(XmlTemp==NULL)
{
PRINTLOG("D[%s][%s][%d]分配内存失败\n",__FILE__,__FUNC__,__LINE__);
continue;
}
EXEC SQL SELECT NVL(TRIM(INTERFACE_DATA),' ') INTO :XmlTemp FROM WORDERRECEIPTDET WHERE ORDER_ACCEPT=:v_order_data[i].order_accept;
sqlcode=SQLCODE;
if (sqlcode!=SQLOK)
{
EXEC SQL ROLLBACK;
free(XmlTemp);
XmlTemp=NULL;
printlog("D[%s][%s][%d]Select wOrderReceiptDet Error,SQLCODE=[%d],SQLERRMSG=[%s]\n",__FILE__,__FUNC__,__LINE__,sqlcode,SQLERRMSG);
continue;
}
strim(XmlTemp);
XmlData=XmlTemp;
}
else
{
XmlData=&v_order_data[i].interface_data;
}
/*解析工单*/
MsgBodyType vMsgBodyType;
memset(&vMsgBodyType,0,sizeof(MsgBodyType));
int RecordNum=0;
v_ret=OrderParseXml(&vMsgBodyType,XmlData,v_order_data[i].order_type,XmlLength,&RecordNum);
XmlData=NULL;
if (v_ret!=0)
{
OrderDestroyMsgBody(&vMsgBodyType);
if(XmlTemp!=NULL)
{
free(XmlTemp);
XmlTemp=NULL;
}
printlog("D[%s][%s][%d]Process [%s] order_accept=[%ld] OrderParseXml error[%d]\n",
__FILE__,__FUNC__,__LINE__,i_table_label, v_order_data[i].order_accept, v_ret);
continue;
}
if(XmlTemp !=NULL)
{
free(XmlTemp); /*就是在这个释放会Core,不是程序一跑就Core,一般都是跑7-8条数据就Core*/
XmlTemp=NULL;
}
这是这块的代码,大家还有没有别的思路。
[[i] 本帖最后由 Hex_water 于 2009-11-7 20:38 编辑 [/i]] |
|