?? cscdr.cpp
字號:
#include "oradb.h"void C_MYSQL::DbCSCDRTest(S_CSCDR &pIn11){S_RESULT pOut11;memset(&pIn11,0,sizeof(pIn11));pIn11.RecordType=1;pIn11.NetworkInitiatedPDPContext=2;snprintf(pIn11.ServedIMSI,LEN_ServedIMSI+1,"21");snprintf(pIn11.ServedIMEI,LEN_ServedIMEI+1,"22");snprintf(pIn11.SGSNIPAddress,LEN_IpAddr+1,"210.40.7.188");snprintf(pIn11.MSNetworkCapability,LEN_MSNetworkCapability+1,"ABC");memcpy(pIn11.RoutingAreaCode,"DEF",5);memcpy(pIn11.LocationAreaCode,"GHI",5);memcpy(pIn11.CellIdentity,"JKL",5);memcpy(pIn11.ChargingID,"123",5);snprintf(pIn11.GGSNAddress,LEN_IpAddr+1,"192.168.9.10");memcpy(pIn11.AccessPointNameNI,"MNO",5);memcpy(pIn11.PDPTypeNumber,"PQR",5);snprintf(pIn11.ServedPDPAddress,LEN_IpAddr+1,"10.87.89.76");snprintf(pIn11.RecordOpenTime,LEN_DATETIME + 1,"0809121230");memcpy(pIn11.CallDuration,"456",5);snprintf(pIn11.Diagnostics,LEN_Diagnostics+1,"8");pIn11.APNSelectionMode=3;memcpy(pIn11.AccessPointNameOI,"STU",5);snprintf(pIn11.ServedMSISDN,LEN_ServedMSISDN+1,"2-2-2");snprintf(pIn11.ChargingCharacteristics,LEN_ChargingCharacteristics+1,"VWX");memcpy(pIn11.ConsolidationResult,"9",2);pIn11.ChargingCharacterSelectionMode=6;snprintf(pIn11.SCFAddress,LEN_SCFAddress+1,"shanghai");snprintf(pIn11.ServiceKey,LEN_ServiceKey+1,"2006");pIn11.DefaultTransacHandling=5;memcpy(pIn11.CAMELAPNNI,"CAMELAPNNI",5);memcpy(pIn11.CAMELAPNOI,"CAMELAPNOI",5);memcpy(pIn11.NumberOfDPEncounter,"99999",5);memcpy(pIn11.LevelOfCamelService,"321",3);memcpy(pIn11.FreeFormatData,"FreeFormatData",5);pIn11.FFDAppendIndicator=7;pIn11.DefaultSMSHandling=8;memcpy(pIn11.CAMELCallingPartyNumber,"CAMELCallingPartyNumber",5);memcpy(pIn11.CAMELAccessDestinationSubNumber,"CAMELAccessDestinationSubNumber",5);memcpy(pIn11.CAMELSMSAdress,"255.255.255.255",5);memcpy(pIn11.SmsReferenceNumber,"SmsReferenceNumber",5);pIn11.DynamicAddressFlag=8;pIn11.AnonyAccessIndicator=9;//memcpy(pIn11.APNOperatorIdentifier,"11111111111",5);pIn11.SystemType=5;pIn11.SGSNChange=6;memcpy(pIn11.CauseForRecClosing,"9",2);memcpy(pIn11.RecordSequenceNumber,"99999",5);snprintf(pIn11.NodeID,LEN_NodeID+1,"NodeID");memcpy(pIn11.LocalRecordSequeceNumnber,"88888",5);memcpy(pIn11.UnsentDownlinkVolume,"777777",5);snprintf(pIn11.RecordExtensions,LEN_RecordExtensions+1,"RecordExtensions");pIn11.FlagRead=9;//snprintf(pIn11.SeqId,LEN_SEQ + 1,"2");snprintf(pIn11.TableName,LEN_TABLENAME + 1,"CSCDR");pIn11.FlagRepeat=3;pIn11.FlagR499=4;snprintf(pIn11.DateCreated,LEN_DATETIME + 1,"080910181830");snprintf(pIn11.GsnId,LEN_GSNID+1,"6666666");//DbCSCDRInsert(&pIn11, &pOut11);}int C_MYSQL::DbCSCDRInsert(struct S_CSCDR* p, struct S_RESULT* pOut){ char szMsg[512]; char* TableName = p->TableName; char* SeqId = p->SeqId;/* char *GtpName=(char *)p->GtpName; char *GtpId=(char *)p->GtpId;*/ int FlagRead = p->FlagRead; /*1*/ int FlagRepeat=p->FlagRepeat; int FlagR499=p->FlagR499; int NetworkInitiatedPDPContext = p->NetworkInitiatedPDPContext; int SystemType = p->SystemType; char *ServedIMSI = p->ServedIMSI; /*2*/ char *ServedIMEI = p->ServedIMEI; char *ServedMSISDN = p->ServedMSISDN; char *SGSNIPAddress = p->SGSNIPAddress; char *MSNetworkCapability = p->MSNetworkCapability; char *RoutingAreaCode = p->RoutingAreaCode; /*3*/ char *LocationAreaCode = p->LocationAreaCode; char* ChargingID = p->ChargingID; char *GGSNAddress = p->GGSNAddress; char *AccessPointNameNI = p->AccessPointNameNI; int APNSelectionMode = p->APNSelectionMode; /*4*/ char *PDPTypeNumber = p->PDPTypeNumber; char *ServedPDPAddress = p->ServedPDPAddress; char *RecordOpenTime = p->RecordOpenTime; /*5*/ int SGSNChange = p->SGSNChange; char* CauseForRecClosing = p->CauseForRecClosing; char *Diagnostics = p->Diagnostics; char* RecordSequenceNumber = p->RecordSequenceNumber; char *NodeID = p->NodeID; /*6*/ char* LocalRecordSequeceNumnber = p->LocalRecordSequeceNumnber; char *AccessPointNameOI = p->AccessPointNameOI; char* UnsentDownlinkVolume = p->UnsentDownlinkVolume; char* ChargingCharacteristics = p->ChargingCharacteristics; int DynamicAddressFlag = p->DynamicAddressFlag; /* CAMEL Information*/ /*7*/ char *SCFAddress = p->SCFAddress; char* ServiceKey = p->ServiceKey; int DefaultTransacHandling = p->DefaultTransacHandling; char *CAMELAPNNI = p->CAMELAPNNI; char *CAMELAPNOI = p->CAMELAPNOI; /*8*/ char* NumberOfDPEncounter = p->NumberOfDPEncounter; char *LevelOfCamelService = p->LevelOfCamelService; char *FreeFormatData = p->FreeFormatData; int FFDAppendIndicator = p->FFDAppendIndicator; int DefaultSMSHandling = p->DefaultSMSHandling; /*9*/ char *CAMELCallingPartyNumber = p->CAMELCallingPartyNumber; char *CAMELAccessDestination = p->CAMELAccessDestinationSubNumber; char *CAMELSMSAdress = p->CAMELSMSAdress; char *SmsReferenceNumber = p->SmsReferenceNumber; char* ConsolidationResult = p->ConsolidationResult; int ChargingCharacterSelectionMode = p->ChargingCharacterSelectionMode; char *CellIdentity=(char *)p->CellIdentity; /* stamp */ char *DateCreated = p->DateCreated; /*10*/ char *GsnId = p->GsnId; char *CallDuration = p->CallDuration; char *RecordExtensions = p->RecordExtensions; int AnonyAccessIndicator = p->AnonyAccessIndicator; int i=0; char szSeqId[21]={0,}; char szSQL[SQLMAX]; memset(szSQL,0,SQLMAX); memset(szSeqId,0,LEN_SEQ+1); snprintf(szSQL, SQLMAX, "INSERT INTO %s (" "FLAGREPEAT," "FLAGR499," "NETWORKINITIATEDPDPCONTEXT," "SYSTEMTYPE," "SERVEDIMSI," "SERVEDIMEI," "SERVEDMSISDN," "SGSNIPADDRESS," "MSNNETWORKCAPABILITY," "ROUTINGAREACODE," /*12*/ "LOCATIONAREACODE," "CHARGINGID," "GGSNADDRESS," "ACCESSPOINTNAMENI," "APNSELECTIONMODE," "PDPTYPENUMBER," "SERVEDPDPADDRESS," "RECORDOPENTIME," /*20*/ "SGSNCHANGE," "CAUSEFORRECCLOSING,""DIAGNOSITICS," "RECORDSEQUENCENUMBER," "NODEID," /*25*/ "LOCALRECORDSEQUECENUMBER," "ACCESSPOINTNAMEOI," "UNSENTDOWNLINKVOLUMN," "CHARGINGCHARACTERISTICS," "DYNAMICADDRESSFLAG," /*30*/ "SCFADDRESS," "SERVICEKEY,""DEFAULTTRANSACHANDLING," "CAMELAPNNI," "CAMELAPNOI," "NUMBEROFDPENCOUNTER," "LEVELOFCAMELSERVICE," "FREEFORMATDATA," "FFDAPPENDINDICATOR," "DEFAULTSMSHANDLING," "CAMELCALLINGPARTYNUMBER," "CAMELACCESSDESTNO," "CAMELSMSADDRESS," "SMSREFERENCENUMBER," /*44*/ "CONSOLIDATIONRESULT," "CHARGINGCHARACTERSELECTIONMODE," "DATECREATED," "GSNID,FLAGREAD, CALLDURATION"#ifdef EXT10cs",RECORDEXTENSIONS"",CELLIDENTITY"",ANONYACCESSINDICATOR"#endif ") VALUES(" "%d,%d,%d,%d,'%s',""'%s','%s','%s','%s','%s',""'%s',%s,'%s','%s',%d,""'%s','%s', '%s'," "%d,%s,%s,%s,'%s'," "%s,'%s',%s,'%s',%d," "'%s',%s,%d,'%s','%s'," "%s,'%s','%s',%d,%d,""'%s','%s',""'%s','%s',""%s,%d,""NOW(), %s,%d, %s"#ifdef EXT10cs",'%s'"",'%s'"",%d"#endif")", TableName, FlagRepeat, FlagR499, NetworkInitiatedPDPContext, SystemType, ServedIMSI, ServedIMEI, ServedMSISDN, SGSNIPAddress, MSNetworkCapability, RoutingAreaCode, LocationAreaCode, ChargingID[0]==0?"NULL":ChargingID, GGSNAddress, AccessPointNameNI, APNSelectionMode, PDPTypeNumber, ServedPDPAddress, RecordOpenTime, SGSNChange, CauseForRecClosing[0]==0?"NULL":CauseForRecClosing, Diagnostics[0]==0?"NULL":Diagnostics, RecordSequenceNumber[0]==0?"NULL":RecordSequenceNumber, NodeID, LocalRecordSequeceNumnber[0]==0?"NULL":LocalRecordSequeceNumnber, AccessPointNameOI, UnsentDownlinkVolume[0]==0?"NULL":UnsentDownlinkVolume, ChargingCharacteristics, DynamicAddressFlag, SCFAddress, ServiceKey[0]==0?"NULL":ServiceKey, DefaultTransacHandling, CAMELAPNNI, CAMELAPNOI, NumberOfDPEncounter[0]==0?"NULL":NumberOfDPEncounter, LevelOfCamelService, FreeFormatData, FFDAppendIndicator, DefaultSMSHandling, CAMELCallingPartyNumber, CAMELAccessDestination, CAMELSMSAdress, SmsReferenceNumber, ConsolidationResult[0]==0?"NULL":ConsolidationResult, ChargingCharacterSelectionMode, GsnId[0]==0?"NULL":GsnId,FlagRead,CallDuration[0]==0?"NULL":CallDuration#ifdef EXT10cs,RecordExtensions,CellIdentity,AnonyAccessIndicator#endif ); #ifdef _DEBUG logOra(sErrLog, szSQL);#endif Lock(); int res = mysql_real_query(myConnect, szSQL, strlen(szSQL)); if(res != 0) { Unlock(); onError(); return -1; } if(GetSeq(p->SeqId) != 0) {
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -