?? omcdr.cpp
字號:
#include "oradb.h"/********************************************************* filename :OMCDR.pc* function descrpition :insert data into database OMCDRxxxxxxxxxx * input :struct S_OMCDR * * output :SQL_OK ( operation sucess) SQL_RET_ERRO (operation failed)* date :2006-05-22**********************************************************/void C_MYSQL::DbOMCDRTest(){ S_OMCDR pIn4; S_RESULT pOut4; memset(&pIn4,0,sizeof(pIn4)); pIn4.RecordType=2; memcpy(pIn4.ServedIMSI,"111111111111111",5); memcpy(pIn4.ServedIMEI,"111111111111111",5); snprintf(pIn4.SGSNIPAddress,LEN_IpAddr+1,"2"); snprintf(pIn4.MSNetworkCapability,LEN_MSNetworkCapability+1,"2"); memcpy(pIn4.RoutingAreaCode,"1111111111111",5); memcpy(pIn4.LocationAreaCode,"11111111111",5); memcpy(pIn4.CellIdentity,"11111111111111",5); snprintf(pIn4.RecordOpenTime,LEN_DATETIME + 1,"2"); memcpy(pIn4.CallDuration,"11111111111111",5); pIn4.SGSNChange=2; memcpy(pIn4.CauseForRecClosing,"111111",2); snprintf(pIn4.Diagnostics,LEN_Diagnostics+1,"2"); memcpy(pIn4.RecordSequenceNumber,"1111111111",5); memcpy(pIn4.NodeId,"1111111111",5); snprintf(pIn4.RecordExtensions,LEN_RecordExtensions+1,"2"); memcpy(pIn4.LocalRecordSequeceNumnber,"11111111111",5); snprintf(pIn4.ServedMSISDN,LEN_ServedMSISDN+1,"2"); snprintf(pIn4.ChargingCharacteristics,LEN_ChargingCharacteristics+1,"2"); snprintf(pIn4.SCFAddress,LEN_SCFAddress+1,"2"); snprintf(pIn4.ServiceKey,LEN_ServiceKey+1,"2"); pIn4.DefaultTransacHandling=2; memcpy(pIn4.CAMELAPNNI,"1111111111111",5); memcpy(pIn4.CAMELAPNOI,"111111111111111",5); memcpy(pIn4.NumberOfDPEncounter,"11111111111",5); memcpy(pIn4.LevelOfCamelService,"111111111",3); memcpy(pIn4.FreeFormatData,"111111111111",5); pIn4.FFDAppendIndicator=2; pIn4.DefaultSMSHandling=2; memcpy(pIn4.CAMELCallingPartyNumber,"111111111111",5); memcpy(pIn4.CAMELAccessDestinationSubNumber,"1111111111111",5); memcpy(pIn4.CAMELSMSAdress,"11111111111111111",5); memcpy(pIn4.SmsReferenceNumber,"11111111111",5); pIn4.SystemType=2; pIn4.FlagRead=2; snprintf(pIn4.SeqId,LEN_SEQ + 1,"2"); snprintf(pIn4.GtpName,LEN_TABLENAME + 1,"2"); snprintf(pIn4.GtpId,LEN_SEQ + 1,"2"); pIn4.FlagRepeat=2; pIn4.FlagR499=2; snprintf(pIn4.GsnId,LEN_GSNID+1,"2"); snprintf(pIn4.TableName,LEN_TABLENAME + 1,"OMCDR"); pIn4.ChargingCharacterSelectionMode=2; DbOMCDRInsert(&pIn4, &pOut4);}int C_MYSQL::DbOMCDRInsert(struct S_OMCDR* pIn, struct S_RESULT* pOut){ short RecordType; char *GtpName=(char *)pIn->GtpName; char *GtpId=(char *)pIn->GtpId; int FlagRead = pIn->FlagRead; int FlagRepeat=pIn->FlagRepeat; int FlagR499=pIn->FlagR499; int SystemType=pIn->SystemType; char *ServedIMSI=(char *)pIn->ServedIMSI; char *ServedIMEI=(char *)pIn->ServedIMEI; char *ServedMSISDN=(char *)pIn->ServedMSISDN; char *SGSNIPAddress=(char *)pIn->SGSNIPAddress; char *MSNetworkCapability=(char *)pIn->MSNetworkCapability; char *RoutingAreaCode=(char *)pIn->RoutingAreaCode; char *LocationAreaCode=(char *)pIn->LocationAreaCode; char *CellIdentity=(char *)pIn->CellIdentity; char *NodeId=(char *)pIn->NodeId;/* add by xxh 2006.5.15*/ char *RecordOpenTime=(char *)pIn->RecordOpenTime; char *CallDuration=(char *)pIn->CallDuration; int SGSNChange=pIn->SGSNChange; char *CauseForRecClosing=(char *)pIn->CauseForRecClosing; char *Diagnostics = pIn->Diagnostics; char *RecordSequenceNumber=(char *)pIn->RecordSequenceNumber; char *LocalRecordSequeceNumnber=(char *)pIn->LocalRecordSequeceNumnber; /* CAMEL Information*/ char *SCFAddress=(char *)pIn->SCFAddress; char *ServiceKey=(char *)pIn->ServiceKey; /*char */ int DefaultTransacHandling=pIn->DefaultTransacHandling; char *CAMELAPNNI=(char *)pIn->CAMELAPNNI; char *CAMELAPNOI=(char *)pIn->CAMELAPNOI; char *NumberOfDPEncounter=(char *)pIn->NumberOfDPEncounter; char *LevelOfCamelService=(char *)pIn->LevelOfCamelService; char *FreeFormatData=(char *)pIn->FreeFormatData; /*char */int FFDAppendIndicator=pIn->FFDAppendIndicator; /*char*/int DefaultSMSHandling=pIn->DefaultSMSHandling; char *CAMELCallingPartyNumber=(char *)pIn->CAMELCallingPartyNumber; char *CAMELAccessDestination=(char *)pIn->CAMELAccessDestinationSubNumber; char *CAMELSMSAdress=(char *)pIn->CAMELSMSAdress; char *SmsReferenceNumber=(char *)pIn->SmsReferenceNumber; /*char *DateCreated[LEN_DATETIME + 1]=(char *)pIn->;*/ char *GsnId=(char *)pIn->GsnId; char *TableName=(char *)pIn->TableName; char *RecordExtensions = pIn->RecordExtensions;#ifdef EXT10om int ChargingCharacterSelectionMode = pIn->ChargingCharacterSelectionMode;#endif char *ChargingCharacteristics=(char *)pIn->ChargingCharacteristics; char szMsg[512]; char szSQL[SQLMAX]; char SeqId[LEN_SEQ + 1];snprintf(szSQL,SQLMAX,"INSERT INTO %s(" "GTPID,GTPLTABLE,FLAGR499," "FLAGREPEAT," "SERVEDIMSI,SERVEDIMEI,SERVEDMSISDN,SGSNIPADDRESS," "MSNNETWORKCAPABILITY,ROUTINGAREACODE,LOCATIONAREACODE," "CAUSEFORRECCLOSING,DIAGNOSITICS,RECORDSEQUENCENUMBER,NODEID," "LOCALRECORDSEQUECENUMBER,SYSTEMTYPE,SCFADDRESS,SERVICEKEY," "DEFAULTTRANSACHANDLING,CAMELAPNNI,CAMELAPNOI,NUMBEROFDPENCOUNTER," "LEVELOFCAMELSERVICE,FREEFORMATDATA,FFDAPPENDINDICATOR,DEFAULTSMSHANDLING," "CAMELCALLINGPARTYNUMBER,CAMELACCESSDESTNO,CAMELSMSADDRESS,SMSREFERENCENUMBER," "DATECREATED,GSNID,FLAGREAD,CALLDURATION "#ifdef EXT10om",RECORDEXTENSIONS"",CHARGINGCHARACTERSELECTIONMODE"",CELLIDENTITY"",EVENTSTAMPTIME"",SGSNCHANGE"",CHARGINGCHARACTERISTICS"#endif ") VALUES(" " %s,'%s',%d," "%d," " '%s','%s','%s','%s'," " '%s','%s','%s'," " %s,%s,%s,'%s'," " %s,%d,'%s',%s," " %d,'%s','%s',%s," " '%s','%s',%d,%d," " '%s','%s','%s','%s'," " NOW(),%s,%d,%d"#ifdef EXT10om",'%s'"",%d"",'%s'"",'%s'"",%d"",'%s'"#endif ")" , TableName, GtpId[0]==0?"NULL":GtpId,GtpName,FlagR499, FlagRepeat, ServedIMSI,ServedIMEI,ServedMSISDN,SGSNIPAddress, MSNetworkCapability,RoutingAreaCode,LocationAreaCode, CauseForRecClosing[0]==0?"NULL":CauseForRecClosing, Diagnostics[0]==0?"NULL":Diagnostics, RecordSequenceNumber[0]==0?"NULL":RecordSequenceNumber, NodeId, LocalRecordSequeceNumnber[0]==0?"NULL":LocalRecordSequeceNumnber, SystemType,SCFAddress,ServiceKey[0]==0?"NULL":ServiceKey, DefaultTransacHandling,CAMELAPNNI,CAMELAPNOI,NumberOfDPEncounter[0]==0?"NULL":NumberOfDPEncounter, LevelOfCamelService,FreeFormatData,FFDAppendIndicator,DefaultSMSHandling, CAMELCallingPartyNumber,CAMELAccessDestination,CAMELSMSAdress,SmsReferenceNumber, GsnId[0]==0?"NULL":GsnId,FlagRead,CallDuration #ifdef EXT10om ,RecordExtensions ,ChargingCharacterSelectionMode ,CellIdentity ,RecordOpenTime ,SGSNChange ,ChargingCharacteristics #endif ); #ifdef _DEBUG logOra(sErrLog, szSQL);#endif Lock(); int res=0; res =mysql_real_query(myConnect, szSQL, strlen(szSQL)); if(res != 0) { Unlock(); logOra(sErrLog, "%d %s\n", mysql_errno(myConnect), mysql_error(myConnect)); return -1; } if(GetSeq(pIn->SeqId) != 0) { Unlock(); logOra(sErrLog, "%d %s\n", mysql_errno(myConnect), mysql_error(myConnect)); return -2; } Unlock(); return 0;}/************************************************************************ filename :OMCDR.pc* function descrpition :get records from database OMCDRxxxxxxxxxx * input :Tablename,Condition; * output :S_OMCDR is record set to store what we want, nItems is counter of those record set,S_RESULT is flag to tell us about operation is sucessful or not;* date :2006-05-22*************************************************************************************/int C_MYSQL::DbOMCDRSelect(char* pInSzTableName, char* pWhere, struct S_OMCDR_LOAD** pOutCDR, int *nItems, struct S_RESULT* pOut){ short ind[55]; short id[2]; short RecordType; char SeqId[LEN_SEQ + 1];
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -