⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.cpp

📁 Mysql的处理
💻 CPP
字号:
#include "CDR.h"#include<iostream>using namespace std;int main(char** argv, int argn){	C_CDR cdr;	if(!cdr.Connect("cgdb", "cgdb", "cgdb"))	{		cout << "Connect failed" << endl;		return -1;	}	cdr.ClearTable("lcloc_os");	/*	char* t = cdr.GetSysdate();	char dt[44];	snprintf(dt, 44, "20%s00", t);	printf("%s\n", dt);	S_RESULT Out;	int i;	// 1 	S_LCLOC in;	snprintf(in.SeqId, sizeof(in.SeqId), "22");	snprintf(in.LocationAreaCode, sizeof(in.LocationAreaCode), "aa");	snprintf(in.RoutingAreaCode, sizeof(in.RoutingAreaCode), "aaa");	snprintf(in.CellIdentity, sizeof(in.CellIdentity), "aa");	snprintf(in.ChangeTime, sizeof(in.ChangeTime), dt);	snprintf(in.TableName, sizeof(in.TableName), "lcloc_cg");	DbLCLOCInsert(&in, &Out);	// 2	S_LLOTV in1;	memset(&in1,0,sizeof(in1));	snprintf(in1.SeqId, LEN_SEQ + 1, "213213");	in1.ChangeCondition = 0;	memcpy(in1.DataVolumeGPRSUp,"2",1);	memcpy(in1.DataVolumeGPRSDown,"2",1);	snprintf(in1.ChangeTime,LEN_DATETIME + 1,"20060708123020");	snprintf(in1.QoSNUMTS,24 + 1,"");	snprintf(in1.QoSNMeanThroughput,2,"1");	snprintf(in1.QoSNPeakThrougput,2,"0");	in1.QoSNDelay = 0;	in1.QoSNPrecedence = 0;	in1.QoSNReliability = 0;	snprintf(in1.QoSRUMTS,24 + 1,"wwww");	snprintf(in1.QoSRMeanThroughput,2,"1");	snprintf(in1.QoSRPeakThrougput,2,"0");	in1.QoSRDelay = 0;	in1.QoSRPrecedence= 0;	in1.QoSRReliability = 0;	snprintf(in1.TableName, sizeof(in1.TableName), "llotv_cg");	DbLLOTVInsert(&in1, &Out);	// 3	S_LCOMM in2;	memset(&in2,0,sizeof(in2));	snprintf(in2.SeqId, LEN_SEQ + 1, "213213");	in2.SubId = 1;	snprintf(in2.SGSNAddr,45 + 1,"asdsad");	//in2.CauseForRecordClosing=-1;	//in2.RSN=0;	//in2.LRSN=0;	in2.SystemType=0;	in2.SGSNChange=0;	snprintf(in2.NodeId,21,"qweqweqwe");	in2.RNC=3;	snprintf(in2.TableName, sizeof(in2.TableName), "lcomm_cg");	DbLCOMMInsert(&in2, &Out);	// 4	S_CSCDR in3;	memset(&in3,0,SIZE_S_CSCDR);	snprintf(in3.SeqId, LEN_SEQ + 1, "55");	in3.FlagRepeat=0;	in3.FlagR499=0;	in3.NetworkInitiatedPDPContext=0;	in3.SystemType=0;	snprintf(in3.ServedIMSI,17,"5");	snprintf(in3.ServedIMEI,17,"4");	snprintf(in3.ServedMSISDN,10,"4");	snprintf(in3.SGSNIPAddress,46,"4");	snprintf(in3.MSNetworkCapability,9,"444");	snprintf(in3.RoutingAreaCode,9,"5");	snprintf(in3.LocationAreaCode,17,"5");	snprintf(in3.ChargingID,10,"9");	snprintf(in3.GGSNAddress,46,"5");	snprintf(in3.AccessPointNameNI,64,"5");	in3.APNSelectionMode=9;	snprintf(in3.PDPTypeNumber,9,"7");	snprintf(in3.ServedPDPAddress,46,"7");	snprintf(in3.RecordOpenTime,LEN_DATETIME + 1,"20061010222222");	in3.SGSNChange=9;	snprintf(in3.CauseForRecClosing,sizeof(in3.CauseForRecClosing),"9");	in3.Diagnostics=7;	snprintf(in3.RecordSequenceNumber,11,"5");	snprintf(in3.NodeID,21,"5");	snprintf(in3.LocalRecordSequeceNumnber,11,"3");	snprintf(in3.AccessPointNameOI,38,"66");	in3.UnsentDownlinkVolume=7;	snprintf(in3.ChargingCharacteristics,sizeof(in3.ChargingCharacteristics),"7");	in3.DynamicAddressFlag=5;	snprintf(in3.SCFAddress,20,"5");	snprintf(in3.ServiceKey,10,"2");	in3.DefaultTransacHandling=3;	snprintf(in3.CAMELAPNNI,64,"5");	snprintf(in3.CAMELAPNOI,38,"5");	snprintf(in3.NumberOfDPEncounter,11,"3");	snprintf(in3.LevelOfCamelService,4,"6");	snprintf(in3.FreeFormatData,161,"5");	in3.FFDAppendIndicator=2;	in3.DefaultSMSHandling=2;	snprintf(in3.CAMELCallingPartyNumber,15,"4");	snprintf(in3.CAMELAccessDestinationSubNumber,44,"4");	snprintf(in3.CAMELSMSAdress,21,"4");	snprintf(in3.SmsReferenceNumber,9,"4");		in3.ConsolidationResult=2;	in3.ChargingCharacterSelectionMode=2;	snprintf(in3.ServiceKey,10,"222");	snprintf(in3.DateCreated,LEN_DATETIME + 1,"20061020334033");	snprintf(in3.GsnId,11,"111");	snprintf(in3.TableName,LEN_TABLENAME + 1,"cscdr");	snprintf(in3.RecordExtensions,64,"");//	for(i=0;i<10;i++)	DbCSCDRInsert(&in3, &Out);//	cout << " data " << Out.SeqId << endl;	// 5	S_CGCDR in4;//	memset(&in4,0,SIZE_S_CGCDR);	snprintf(in4.SeqId, LEN_SEQ + 1, "2");	in4.FlagRepeat=0;	in4.FlagR499=0;	in4.NetworkInitiatedPDPContext=0;//	in4.SystemType=0;	snprintf(in4.ServedIMSI,17,"");//	snprintf(in4.ServedIMEI,17,"");	snprintf(in4.ServedMSISDN,10,"");	snprintf(in4.SGSNIPAddress,46,"4");//	snprintf(in4.MSNetworkCapability,9,"5");//	snprintf(in4.RoutingAreaCode,9,"6");//	snprintf(in4.LocationAreaCode,17,"7");//	snprintf(in4.CellIdentity,25,"8");	snprintf(in4.ChargingID,10,"1");	snprintf(in4.GGSNAddress,46,"9");	snprintf(in4.AccessPointNameNI,64,"1");	in4.APNSelectionMode=1;	snprintf(in4.PDPTypeNumber,9,"2");	snprintf(in4.ServedPDPAddress,46,"3");	snprintf(in4.RecordOpenTime,LEN_DATETIME + 1,"20061010120000");	snprintf(in4.CallDuration,1,"2");//	in4.SGSNChange=1;	snprintf(in4.CauseForRecClosing,2,"1");	in4.Diagnostics=2;	snprintf(in4.RecordSequenceNumber,2,"2");	snprintf(in4.NodeID,LEN_NodeID+1,"4");	snprintf(in4.LocalRecordSequeceNumnber,10,"4");//	snprintf(in4.AccessPointNameOI,38,"5");//	in4.UnsentDownlinkVolume=4;	snprintf(in4.ChargingCharacteristics,1,"2");	in4.DynamicAddressFlag=2;		in4.ConsolidationResult=1;	in4.ChargingCharacterSelectionMode=1;	snprintf(in4.DateCreated,LEN_DATETIME + 1,"20051010101010");	snprintf(in4.GsnId,11,"3");	snprintf(in4.TableName,LEN_TABLENAME + 1,"cgcdr");//	snprintf(in4.RecordExtensions,64,"");//	for(i=0;i<10;i++)	DbCGCDRInsert(&in4, &Out);	cout << " data " << Out.SeqId << endl;	// 其他设备	S_MNODEWARN in5;	in5.LevelId=1;	snprintf(in5.Msg,100,"sa");	in5.NodeId=1;	in5.NodeSubId=1;	snprintf(in5.DateCreated,LEN_DATETIME + 1,"20061010221010");	DbMNodeWarnInsert(&in5, &Out);	S_MNODELOG in6;	in6.LevelId=1;	snprintf(in6.Msg,100,"sa");	in6.NodeId=1;	in6.NodeSubId=1;	snprintf(in6.DateCreated,LEN_DATETIME + 1,"20061010221010");	DbMNodeLogInsert(&in6, &Out);		// 查询	// 合并及辅助查询	int nItems;	S_MGSN *in7=NULL;	DbMGsnSelect(&in7, &nItems, &Out);	for(i=0;i<nItems;i++)	{		S_MGSN* ins = (S_MGSN*)&in7[i];				cout << "GsnId:" << ins->GsnId << "!" <<endl;		cout << "Name:" << ins->Name<< "!" <<endl;		cout << "IPAddr1:" << ins->IPAddr1 << "!" <<endl;		cout << "IPAddr2:" << ins->IPAddr2 << "!" <<endl;		cout << "AccessFlag:" << ins->AccessFlag << "!" <<endl;		cout << "ActiveFlag:" << ins->ActiveFlag << "!" <<endl;		cout << "ProType:" << ins->ProType << "!" <<endl;		cout << "VerMax:" << ins->VerMax << "!" <<endl;		cout << "VerMin:" << ins->VerMin << "!" <<endl;	}	if(in7 != NULL)	{		free(in7);		in7 = NULL;	}	S_LCLOC* pOutLChangeLocation = NULL;	DbLCLOCSelect((char*)"lcloc_cg",(char*) "22", &pOutLChangeLocation, &nItems, &Out);	for(i=0;i<nItems;i++)	{		S_LCLOC* p = (S_LCLOC*)&pOutLChangeLocation[i];		cout << i;		cout << i << ":" << p->CellIdentity << endl;		cout << i << ":" << p->ChangeTime << endl;		cout << i << ":" << p->LocationAreaCode << endl;		cout << i << ":" << p->RoutingAreaCode << endl;	}	if(pOutLChangeLocation != NULL)	{		free(pOutLChangeLocation);		pOutLChangeLocation = NULL;	}	S_LLOTV* pOutLChangeLocation2 = NULL;	DbLLOTVSelect((char*)"llotv_cg", (char*)"213213", &pOutLChangeLocation2, &nItems, &Out);	for(i=0;i<nItems;i++)	{		S_LLOTV* p = (S_LLOTV*)&pOutLChangeLocation2[i];		cout << i << ":" << p->ChangeTime ;		cout << ":" << p->DataVolumeGPRSDown << endl;	}	cout << endl;	if(pOutLChangeLocation2 != NULL)	{		free(pOutLChangeLocation2);		pOutLChangeLocation2 = NULL;	}	S_LCOMM* pOutLChangeLocation3 = NULL;	DbLCOMMSelect((char*)"lcomm_cg", (char*)"213213", &pOutLChangeLocation3, &nItems, &Out);	cout << "NUMBER:" << nItems << endl;	for(i=0;i<nItems;i++)	{		S_LCOMM* p = (S_LCOMM*)&pOutLChangeLocation3[i];		cout << i << ":" << p->SGSNChange << endl;		cout << i << ":" << p->RSN << endl;	}	if(pOutLChangeLocation3 != NULL)	{		free(pOutLChangeLocation3);		pOutLChangeLocation3 = NULL;	}		S_CSCDR *pCSCDR=NULL;	DbCSCDRSelect((char*)"CSCDR", (char*)"SEQID<300", 		&pCSCDR, &nItems, 		&Out);	for(i=0;i<nItems;i++)	{		S_CSCDR* p = (S_CSCDR*)&pCSCDR[i];		cout << i << ":" << p->DateCreated << endl;	}	S_CGCDR *pCGCDR=NULL;	DbCGCDRSelect((char*)"CGCDR", (char*)"SEQID<1230", 		&pCGCDR, &nItems, 		&Out);	for(i=0;i<nItems;i++)	{		S_CGCDR* p = (S_CGCDR*)&pCGCDR[i];		cout << i << ":" << p->AccessPointNameNI 	<< endl;		cout << i<<	":" << p->APNSelectionMode 	<< endl;		cout << i<<	":" << p->CallDuration	<< endl;		cout << i<<	":" << p->CauseForRecClosing	<< endl;		cout << i<<	":" << p->ChargingCharacteristics	<< endl;		cout << i<<	":" << p->ChargingID	<< endl;		cout << i<<	":" << p->SGSNIPAddress	<< endl;		cout << i<<	":" << p->DateCreated	<< endl;			}	*/	cdr.Disconnect();		return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -