コード例 #1
0
CClosureAtAirport::CClosureAtAirport(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF()){
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PROJID"),m_nProjID);
		adoRecordset.GetFieldValue(_T("AIRPORTID"),m_nAirportID);
		adoRecordset.GetFieldValue(_T("OBJECTMARK"),m_nObjectMark);
	}
}
コード例 #2
0
void CAirportDatabaseList::ReadAirportDBData()
{
	clear() ;
	CString SQL ;
    SQL.Format(_T("SELECT * FROM TB_PROJECT_AIRPORTDB")) ;
	CADORecordset recordset ;
	long count ;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,DATABASESOURCE_TYPE_ACCESS_GLOBALDB) ;
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return ;
	}
	CShareTemplateDatabase* _pDB = NULL; 
	int id = -1 ;
	CString _name ;

	CString strSharePath(_T(""));
	CString strARCPath(_T(""));
	strARCPath.Format(_T("%s\\%s"),PROJMANAGER->GetAppPath(),_T("Databases\\arc.mdb"));
	while(!recordset.IsEOF())
	{
	   recordset.GetFieldValue(_T("ID"),id) ;
	   recordset.GetFieldValue(_T("AIRPORTDB_NAME"),_name) ;
	  
	   int nPos = checkIfIncludeKeyWords(_name.GetBuffer());
	   if (nPos != -1)
	   {
		   CString strLeft(_T(""));
		   CString strRight(_T(""));
		   strLeft = _name.Left(nPos);
		   strRight = _name.Right(_name.GetLength() - nPos - 1);
		   _name = strLeft + strRight;
	   }

	   strSharePath.Format(_T("%s\\ImportDB\\%s.mdb"),PROJMANAGER->GetAppPath(),_name);
	   _pDB  = new CShareTemplateDatabase(strARCPath,strSharePath) ;
	   _pDB->setName(_name) ;
	   _pDB->SetID(id) ;
	   if (!getAirportDBByName(_name))
	   {
		    m_vAirportDB.push_back(_pDB) ;
	   }

	   if(recordset.GetFieldValue(_T("VERSION"),id))
		   _pDB->m_nVersion = id ;
	   else
		   _pDB->m_nVersion = 0 ;
	   recordset.MoveNextData() ;
	}
}
コード例 #3
0
void CFlightUseStar::InitFromDBRecordset(CADORecordset& recordset)
{
	recordset.GetFieldValue(_T("ID"),m_nID);
	recordset.GetFieldValue(_T("FLTTYPE"),m_strFlightType);
	recordset.GetFieldValue(_T("STARID"),m_StarID);

	if (m_pAirportDatabase)
	{
		m_FlightType.SetAirportDB(m_pAirportDatabase);
		m_FlightType.setConstraintWithVersion(m_strFlightType);
	}
}
コード例 #4
0
void RunwayCrossBuffer::InitFromDBRecordset( CADORecordset& recordset )
{
	
	long lint;
	recordset.GetFieldValue(COL_ID, m_nID);
	recordset.GetFieldValue(COL_FLTCONST, m_sfltType, false);

	recordset.GetFieldValue(COL_BUFFERDISTANCE, m_distance);
	recordset.GetFieldValue(COL_BUFFERTIME, lint );
	recordset.GetFieldValue(COL_CASE, (int&)m_case);
	
	m_time.setPrecisely(lint);
}
コード例 #5
0
void IntersectedStretch::ReadData(CADORecordset& recordset,const IntersectionNodesInAirport& vnodes )
{
	recordset.GetFieldValue(_T("ID"),m_nID);

	int nodeID;
	recordset.GetFieldValue(_T("INTERSECTNODEID"),nodeID);
	m_intersectioNode = vnodes.GetNodeByID(nodeID);

	int itemID1;
	recordset.GetFieldValue(_T("INTERSECTITEMID1"),itemID1);
	m_fristPoint.SetIntersectItemID(itemID1);

    int itemID2;
	recordset.GetFieldValue(_T("INTERSECTITEMID2"),itemID2);
	m_secondPoint.SetIntersectItemID(itemID2);

	//float dis1;
	recordset.GetFieldValue(_T("DISTTOINTERSECTNODE1"),m_fristPoint.m_dDistToIntersected);
	//m_fristPoint.SetDistToIntersect(dis1);
   
	//float dis2;
	recordset.GetFieldValue(_T("DISTTOINTERSECTNODE2"),m_secondPoint.m_dDistToIntersected);
	//m_secondPoint.SetDistToIntersect(dis2);

	recordset.GetFieldValue(_T("USERDIST1"),m_fristPoint.m_dDisToUser);

	recordset.GetFieldValue(_T("USERDIST2"),m_secondPoint.m_dDisToUser);
}
コード例 #6
0
CStandGroupClosureNode::CStandGroupClosureNode(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PARENTID"),m_nParentID);
		adoRecordset.GetFieldValue(_T("STANDGROUPID"),m_nStandGroupID);
		int nValue = -1;
		adoRecordset.GetFieldValue(_T("TIMEFROM"),nValue);
		m_startTime.set(nValue);
		adoRecordset.GetFieldValue(_T("TIMETO"),nValue);
		m_endTime.set(nValue);
	}
}
コード例 #7
0
void CPaxBusParking::InitFromDBRecordset(CADORecordset& recordset)
{
	recordset.GetFieldValue(_T("ID"),m_nID);
	recordset.GetFieldValue(_T("GATE"),m_strGate);
	int nGateType;
	recordset.GetFieldValue(_T("GATETYPE"),nGateType);
	m_enumGateType = (Gatetype)nGateType;
	recordset.GetFieldValue(_T("PATHID"),m_nPathID);

	CADODatabase::ReadPath2008FromDatabase(m_nPathID,m_path);
	//int nPointCount = -1;
	//recordset.GetFieldValue(_T("POINTCOUNT"),nPointCount);
	//recordset.GetFieldValue(_T("PATH"),nPointCount,m_path);
}
コード例 #8
0
CTaxiwayClosureAtAirport::CTaxiwayClosureAtAirport(CADORecordset &adoRecordset):CClosureAtAirport(adoRecordset)
{
	if(!adoRecordset.IsEOF()){ 

		CString strSQL = _T("");
		strSQL.Format(_T("SELECT * FROM TAXIWAYCLOSURENODE  WHERE (PARENTID = %d);"),m_nID);
		long nRecordCount = -1;
		CADORecordset adoRecordsetChild;
		CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordsetChild);

		std::vector<int> vrTaxiwayID;
		ALTAirport::GetTaxiwaysIDs(m_nAirportID,vrTaxiwayID);
		while (!adoRecordsetChild.IsEOF()) {
			int nTaxiwayID = -1;
			adoRecordsetChild.GetFieldValue(_T("TAXIWAYID"),nTaxiwayID);
			bool bAdd = false;
			if(std::find(vrTaxiwayID.begin(),vrTaxiwayID.end(),nTaxiwayID) != vrTaxiwayID.end())
				bAdd = true;

			CTaxiwayClosureNode * pNode = new CTaxiwayClosureNode(adoRecordsetChild);
			if(pNode){
				if(bAdd)
					m_vrTaxiwayClosure.push_back(pNode);
				else
					m_vrTaxiwayClosureDeleted.push_back(pNode);
			}
			adoRecordsetChild.MoveNextData();
		}
	}
}
コード例 #9
0
ファイル: ALTAirspace.cpp プロジェクト: chenbk85/tphProjects
void ALTAirspace::GetHoldList( int nAirspaceID, ALTObjectUIDList& IDList )
{
	CString strSQL = _T("");
	strSQL.Format("SELECT ID FROM HOLD_VIEW WHERE APTID = %d",nAirspaceID);

	try
	{
		long nRecordCount;
		CADORecordset adoRs;
		CADODatabase::ExecuteSQLStatement(strSQL,nRecordCount,adoRs);

		while (!adoRs.IsEOF())
		{
			int nID = -1;
			adoRs.GetFieldValue(_T("ID"),nID);
			IDList.push_back(nID);

			adoRs.MoveNextData();
		}
	}
	catch (CADOException& e)
	{
		e.ErrorMessage();
	}
}
コード例 #10
0
void PanoramaViewData::InitFromDBRecordset( CADORecordset& recordset )
{
	recordset.GetFieldValue(_T("ID"), m_nID);
	recordset.GetFieldValue(_T("NAME"), m_strName);
	double dPosX,dPosY;
	recordset.GetFieldValue(_T("POSX"),dPosX );
	recordset.GetFieldValue(_T("POSY"),dPosY );
	m_pos.setX(dPosX); m_pos.setY(dPosY);
	recordset.GetFieldValue(_T("ALTITUDE"), m_dAltitude);
	recordset.GetFieldValue(_T("TURNSPEED"), m_dTurnSpeed);
	recordset.GetFieldValue(_T("STARTBEARING"),m_dStartBearing);
	recordset.GetFieldValue(_T("ENDBEARING"),m_dEndBearing);
	recordset.GetFieldValue(_T("INCLINATION"),m_dInclination);	
	recordset.GetFieldValue(_T("STARTTIME"), m_startTime);
	recordset.GetFieldValue(_T("ENDTIME"), m_endTime);
}
コード例 #11
0
CStandGroupClosureAtAirport::CStandGroupClosureAtAirport(CADORecordset &adoRecordset):CClosureAtAirport(adoRecordset)
{
	if(!adoRecordset.IsEOF()){

		CString strSQL = _T("");
		strSQL.Format(_T("SELECT * FROM STANDGROUPCLOSURENODE   WHERE (PARENTID = %d);"),m_nID);
		long nRecordCount = -1;
		CADORecordset adoRecordsetChild;
		CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordsetChild);

		/*std::vector<int> vStands;
		ALTAirport::GetStandsIDs(m_nAirportID, vStands);*/	
		/*ALTObjectGroup altObjGroup;	
		altObjGroup.ReadData(pStandGroupClosureNode->m_nStandGroupID);*/
		while (!adoRecordsetChild.IsEOF()) {
			int nStandGroupID = -1;
			adoRecordsetChild.GetFieldValue(_T("STANDGROUPID"),nStandGroupID);
			/*bool bAdd = false;
			if(std::find(vStands.begin(),vStands.end(),nStandGroupID) != vStands.end())*/
			bool bAdd = true;
		
			CStandGroupClosureNode * pNode = new CStandGroupClosureNode(adoRecordsetChild);
			if(pNode){
				if(bAdd)
					m_vrStandGroupClosure.push_back(pNode);
				else 
					m_vrStandGroupClosureDeleted.push_back(pNode);
			}

			adoRecordsetChild.MoveNextData();
		}
	}
}
コード例 #12
0
bool CProbDistManager::loadDatabase(CAirportDatabase* pAirportDatabase)
{
	clear();

	CString strSQL(_T(""));
	strSQL.Format(_T("SELECT * FROM TB_AIRPORTDB_PRODISTMANAGER"));
	CADORecordset adoRecordset ;
	long count = 0;
	try
	{
		CDatabaseADOConnetion::ExecuteSQLStatement(strSQL,count,adoRecordset,pAirportDatabase->GetAirportConnection()) ; 
	}
	catch (CADOException& e)
	{
		e.ErrorMessage() ;
		return false;
	}
	CString sName(_T(""));
	CString sProbtype(_T(""));
	CString sProbdate(_T(""));
	int nID = -1 ;
	while (!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("PRODIST_NAME"),sName) ;
		adoRecordset.GetFieldValue(_T("PROBDISTDATA"),sProbdate) ;
		adoRecordset.GetFieldValue(_T("ID"),nID) ;
		ProbabilityDistribution* pProb = NULL ;
		try
		{
			pProb = ProbabilityDistribution::GetTerminalRelateProbDistributionFromDB (sProbdate);
		}
		catch (TwoStringError& e)
		{
			char string[256];
			e.getMessage (string);
			MessageBox(NULL,"Unknown Probability Distribution ","Error",MB_OK) ;
			adoRecordset.MoveNextData();
			continue ;
		}
		CProbDistEntry* pProbDist = new CProbDistEntry( sName, pProb );
		pProbDist->SetID(nID) ;
		m_vProbDist.push_back(pProbDist);

		adoRecordset.MoveNextData() ;
	}
	return true;
}
コード例 #13
0
///////////////////////////////old code version, no more use///////////////////////////////////////////
void CProbDistManager::ReadDataFromDB(int _airportDBID,DATABASESOURCE_TYPE type )
{
	clear() ;
    CString SQL ;
	SQL.Format(_T("SELECT * FROM TB_AIRPORTDB_PRODISTMANAGER WHERE AIRPORTDB_ID = %d"),_airportDBID) ;
	CADORecordset recordset ;
	long count = 0;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,type) ; 
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return ;
	}
	CString name ;
	CString pProb_type ;
	CString pProb_date ;
	int id = -1 ;
	while (!recordset.IsEOF())
	{
         recordset.GetFieldValue(_T("PRODIST_NAME"),name) ;
		 recordset.GetFieldValue(_T("PROBDISTDATA"),pProb_date) ;
         recordset.GetFieldValue(_T("ID"),id) ;
		 ProbabilityDistribution* pProb = NULL ;
		 try
		 {
			 pProb = ProbabilityDistribution::GetTerminalRelateProbDistributionFromDB (pProb_date);
		 }
		 catch (TwoStringError e)
		 {
		 	MessageBox(NULL,"Unknown Probability Distribution ","Error",MB_OK) ;
			recordset.MoveNextData() ;
			continue ;
		 }
		 CProbDistEntry* pProbDist = new CProbDistEntry( name, pProb );
         pProbDist->SetID(id) ;
		 m_vProbDist.push_back(pProbDist);
         
		 recordset.MoveNextData() ;
	}
}
コード例 #14
0
ファイル: Heliport.cpp プロジェクト: chenbk85/tphProjects
void Heliport::ReadObject(int nObjID)
{
	m_nObjID = nObjID;

	CADORecordset adoRecordset;
	long nRecordCount = -1;

	CADODatabase::ExecuteSQLStatement(ALTObject::GetSelectScript(nObjID),nRecordCount,adoRecordset);
	if (!adoRecordset.IsEOF())
		ALTObject::ReadObject(adoRecordset);

	CADODatabase::ExecuteSQLStatement(GetSelectScript(nObjID),nRecordCount,adoRecordset);
	if (!adoRecordset.IsEOF())
	{	
		adoRecordset.GetFieldValue(_T("PATHID"),m_nPathID );
		m_path.clear();
		CADODatabase::ReadPath2008FromDatabase(m_nPathID,m_path);

		adoRecordset.GetFieldValue(_T("RADIUS"),m_Radius);
//		m_Radius = ARCUnit::ConvertLength(m_Radius,ARCUnit::CM,ARCUnit::M);
	}
}
コード例 #15
0
void CDistanceAndTimeFromARP::InitFromDBRecordset(CADORecordset& recordset)
{
	recordset.GetFieldValue(_T("ID"),m_nID);
	recordset.GetFieldValue(_T("FLTTYPEID"),m_nFltTypeID);
	recordset.GetFieldValue(_T("DISTANCEFROMARP"),m_nDistanceFromARP);
	recordset.GetFieldValue(_T("DISTSCREENPRINT"),m_strDistScreenPrint);
	int nProbType = 0;
	recordset.GetFieldValue(_T("PROBTYPE"),nProbType);
	m_enumProbType = (ProbTypes)nProbType;
	recordset.GetFieldValue(_T("PRINTDIST"),m_strprintDist);
	recordset.GetFieldValue(_T("TIME"),m_strTime);
}
コード例 #16
0
ファイル: XhDevice.cpp プロジェクト: luosin/cad-2004-lzx
BOOL CXhDevice::Init( void )
{
	if (!m_strBlkName.IsEmpty())
	{
		CADODatabase adoDb;
		CADORecordset rs;
		adoDb.Open(g_strAdoCon) ;
		rs.SetConnection(&adoDb) ;

		CString strSql ;
		strSql.Format(_T("select * from define_default_device where block_name='%s'"), m_strBlkName) ;
		if (rs.Open(strSql))
		{
			while(!rs.IsEOF())
			{
				long nTmp = 0 ;
				CString strTmp ;
				rs.GetFieldValue(_T("has_box"), nTmp) ;
				m_bHasBox = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("box_type"), m_strBoxType) ;
				rs.GetFieldValue(_T("cable_num"),m_nCable);
				rs.GetFieldValue(_T("core_num1"), m_nCoreNum1) ;
				rs.GetFieldValue(_T("core_num2"), m_nCoreNum2) ;
				rs.GetFieldValue(_T("cable_string1"), m_strCable1) ;
				rs.GetFieldValue(_T("cable_string2"), m_strCable2) ;
				rs.GetFieldValue(_T("has_phone"), nTmp) ;
				m_bHasPhone = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("has_gt"), nTmp) ;
				m_bHasGT = (nTmp==0?FALSE:TRUE) ;
				rs.GetFieldValue(_T("has_ground"), nTmp) ;
				m_bHasGround = (nTmp==0?FALSE:TRUE) ;
				rs.MoveNext() ;
			}
			rs.Close() ;
		}


		rs.Close() ;
		adoDb.Close() ;
	}

	return 0;

}
コード例 #17
0
void CConflictResolution::ReadData(int nProjID)
{
	SqlSelectScriptMaker selectSql(TB_CONFLICTRESOLUTION);
	selectSql.SetCondition( SqlScriptColumn(COL_PROJID, nProjID).EqualCondition() );
	
	
	long lRecordCount = 0;
	CADORecordset adoRecordset;

	CADODatabase::ExecuteSQLStatement(selectSql.GetScript(),lRecordCount,adoRecordset);
	while(!adoRecordset.IsEOF())
	{		
		adoRecordset.GetFieldValue(COL_ID,m_nID);
		adoRecordset.GetFieldValue(COL_RADIUSOFCONCERN,m_nRadiusOfConcern);
		int nAtIntersectionOnRight;
		adoRecordset.GetFieldValue(COL_ENUMATINTERSECTIONONRIGHT,nAtIntersectionOnRight);
		m_enumAtIntersectionOnRight = (YesOrNo)nAtIntersectionOnRight;
		int nFirstInATaxiway;
		adoRecordset.GetFieldValue(COL_ENUMFIRSTINATAXIWAY,nFirstInATaxiway);
		m_enumFirstInATaxiway = (YesOrNo)nFirstInATaxiway;
		int nOnSpecificTaxiways;
		adoRecordset.GetFieldValue(COL_ENUMONSPECIFICTAXIWAYS,nOnSpecificTaxiways);
		m_enumOnSpecificTaxiways = (YesOrNo)nOnSpecificTaxiways;
		
		adoRecordset.GetFieldValue(COL_RUNWAYCROSSBUFFERTIME, m_nRunwayCrossBuffer);

		long nTime;
		adoRecordset.GetFieldValue(COL_RUNAYASTAXIWAY_NOAPPROACHDIST, m_dRunwayAsTaxiwayNoApporachDistance);
		adoRecordset.GetFieldValue(COL_RUNAYASTAXIWAY_NOAPPROACHTIME, nTime); m_tRunwayAsTaxiwayNoApporachTime.setPrecisely(nTime);
		adoRecordset.GetFieldValue(COL_RUNWAYASTAXIWAY_NOTAKEOFFTIME, nTime); m_tRuwnayAsTaxiwayNoTakeoffTime.setPrecisely(nTime);

		adoRecordset.MoveNextData();
	}
	m_pAtIntersectionOnRightList->SetAirportDB(m_pAirportDB);
	m_pAtIntersectionOnRightList->ReadData(m_nID);
	m_pFirstInATaxiwayList->SetAirportDB(m_pAirportDB);
	m_pFirstInATaxiwayList->ReadData(m_nID);
	m_pOnSpecificTaxiwaysList->SetAirportDB(m_pAirportDB);
	m_pOnSpecificTaxiwaysList->ReadData(m_nID);
	m_vCrossBuffers.SetAirportDB(m_pAirportDB);
	m_vCrossBuffers.ReadData(m_nID);

}
コード例 #18
0
CTaxiwayClosureNode::CTaxiwayClosureNode(CADORecordset &adoRecordset)
{
	if(!adoRecordset.IsEOF())
	{
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PARENTID"),m_nParentID);
		adoRecordset.GetFieldValue(_T("TAXIWAYID"),m_nTaxiwayID);
		adoRecordset.GetFieldValue(_T("INTERNODEIDFROM"),m_nIntersectNodeIDFrom);
		adoRecordset.GetFieldValue(_T("INTERNODEIDTO"),m_nIntersectNodeIDTo);
		int nValue = -1;
		adoRecordset.GetFieldValue(_T("TIMEFROM"),nValue);
		m_startTime.set(nValue);
		adoRecordset.GetFieldValue(_T("TIMETO"),nValue);
		m_endTime.set(nValue);
	}
}
コード例 #19
0
void IntersectedStretch::InitFromDBRecordset( CADORecordset& recordset )
{
	recordset.GetFieldValue(_T("ID"),m_nID);
	int nodeID;
	recordset.GetFieldValue(_T("INTERSECTNODEID"),nodeID);
	m_intersectioNode.ReadData(nodeID);

	int ItemID1;
	recordset.GetFieldValue(_T("INTERSECTITEMID1"),ItemID1);
	int ItemID2;
	recordset.GetFieldValue(_T("INTERSECTITEMID2"),ItemID2);
	m_fristPoint.SetIntersectItemID(ItemID1);
	m_secondPoint.SetIntersectItemID(ItemID2);

	//int bActive;
	//recordset.GetFieldValue(_T("ACTIVE"),bActive);
	//m_bActive = (bActive != 0);

	recordset.GetFieldValue(_T("DISTTOINTERSECTNODE1"), m_fristPoint.m_dDistToIntersected);
	recordset.GetFieldValue(_T("DISTTOINTERSECTNODE2"), m_secondPoint.m_dDistToIntersected);
	recordset.GetFieldValue(_T("USERDIST1"), m_fristPoint.m_dDisToUser);
	recordset.GetFieldValue(_T("USERDIST2"), m_secondPoint.m_dDisToUser);
}
コード例 #20
0
void CAirsideSimSettingClosure::ReadData(void)
{
	CString strSQL = _T("");
	strSQL.Format(_T("SELECT * FROM SIMENGINGSETTING WHERE (PRJID = %d);"),m_nProjID);
	long nRecordCount = -1;
	CADORecordset adoRecordset;
	CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordset);
	if(!adoRecordset.IsEOF())
	{
		int nPrjID = -1;
		int nVehicleService = -1;
		int nCyclicGroundRoute = -1;
		adoRecordset.GetFieldValue(_T("ID"),m_nID);
		adoRecordset.GetFieldValue(_T("PRJID"),nPrjID);
		adoRecordset.GetFieldValue(_T("VEHICLESERVICE"),nVehicleService);
		adoRecordset.GetFieldValue(_T("CYCLICGROUNDROUTE"),nCyclicGroundRoute);

		if(!adoRecordset.GetFieldValue(_T("ITINERANTFLIGHT"), m_nItinerantFlight))
		{
			m_nItinerantFlight = 0;
		}

		if(!adoRecordset.GetFieldValue(_T("TRAININGFLIGHT"),m_nTrainingFlight))
		{
			m_nTrainingFlight = 0;
		}



		if(nVehicleService > 0)
			m_bVehicleService = true;
		else
			m_bVehicleService = false;

		if (nCyclicGroundRoute > 0)
		{
			m_bAllowCyclicGroundRoute = true;
		}else
		{
			m_bAllowCyclicGroundRoute = false;
		}
	}

	m_airsideRunwayClosure.ReadData();
	m_airsideTaxiwayClosure.ReadData();
	m_airsideStandGroupClosure.ReadData();
}
コード例 #21
0
///////////////Old version code, should not be modified//////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
double CAirportDatabaseList::GetGloabalVersion()
{
	CString SQL ;
	SQL.Format(_T("SELECT * FROM TB_DATABASE_VERSION")) ;
	CADORecordset recordset ;
	long count = -1 ;
	try
	{
		CADODatabase::ExecuteSQLStatement(SQL,count,recordset,DATABASESOURCE_TYPE_ACCESS_GLOBALDB) ;
	}
	catch (CADOException e)
	{
		e.ErrorMessage() ;
		return 1.0;
	}
	double version = 1.0 ; 
	while(!recordset.IsEOF())
	{
		recordset.GetFieldValue(_T("VERSION"),version) ;
		break ;
	}
	return version ;
}
コード例 #22
0
ファイル: ADODataBuilder.cpp プロジェクト: cosysun/ZSProject
DWORD CADODataBuilder::DataBuilderByColName(CADORecordset& recordset, PCHAR pBuffer, DWORD dwSize, vector<string>& fieldNameArray)
{
	if (recordset.IsEof() || !pBuffer || 0 == dwSize)
	{
		return 0;
	}

	PCHAR pTemp = pBuffer;
	DWORD dwRealSize = 0;
	int nIndex = 0;
	int nFieldCount = (int)fieldNameArray.size();

	if (0 >= nFieldCount)
	{
		return 0;
	}

	//////////////////////////////////////////////////////////////////////////
	//写入字段数
	
	dwRealSize += sizeof(TDataHead);
	
	if (dwSize < dwRealSize)
	{
		return 0;
	}
	
	TDataHead aDataHead = {0};
	aDataHead.wFieldCount = (WORD)nFieldCount;
	memcpy(pTemp, &aDataHead, sizeof(TDataHead));
	pTemp += sizeof(TDataHead);

	//////////////////////////////////////////////////////////////////////////
	//构造数据内容描述

	TDataInfo aDataInfo = {0};
	CADOFieldInfo aFileInfo = {0};
	_variant_t aVar;

	for (nIndex = 0; nIndex < nFieldCount; ++nIndex)
	{
		dwRealSize += sizeof(TDataInfo);
		
		if (dwSize < dwRealSize)
		{
			return 0;
		}
	
		if (!recordset.GetFieldInfo(fieldNameArray[nIndex].c_str(), &aFileInfo))
		{
			return 0;
		}

		if (!recordset.GetFieldValue(fieldNameArray[nIndex].c_str(), aVar))
		{
			return 0;
		}

		aDataInfo.wADOType = aFileInfo.m_nType;
		aDataInfo.wVT = (WORD)aVar.vt;

		aDataInfo.wColNameLen = (WORD)strlen(aFileInfo.m_strName);
		dwRealSize += aDataInfo.wColNameLen;

		if (dwSize < dwRealSize)
		{
			return 0;
		}

		switch (aVar.vt)
		{
		case VT_I2:
			{
				aDataInfo.wSize = sizeof(short);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				short aValue = (short)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_I4:
			{
				aDataInfo.wSize = sizeof(long);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				long aValue = (long)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_R4:
			{
				aDataInfo.wSize = sizeof(float);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				float aValue = (float)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_R8:
			{
				aDataInfo.wSize = sizeof(double);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				double aValue = (double)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_CY:
			{
				aDataInfo.wSize = sizeof(CY);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				CY aValue = (CY)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_DATE:
			{
				aDataInfo.wSize = sizeof(DATE);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				DATE aValue = (DATE)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_BSTR:
			{
				_bstr_t strTemp = (_bstr_t)aVar;

				LONG lSize = strTemp.length() * sizeof(WCHAR);

				if (lSize > 65535)
				{
					return 0;
				}

				aDataInfo.wSize = (WORD)lSize;

				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				memcpy(pTemp, strTemp.GetBSTR(), aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}	
			break;			
		case VT_BOOL:
			{
				aDataInfo.wSize = sizeof(bool);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				bool aValue = (bool)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_DECIMAL:
			{
				aDataInfo.wSize = sizeof(DECIMAL);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				DECIMAL aValue = (DECIMAL)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case VT_UI1:
			{
				aDataInfo.wSize = sizeof(BYTE);
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				BYTE aValue = (BYTE)aVar;

				memcpy(pTemp, &aValue, aDataInfo.wSize);
				pTemp += aDataInfo.wSize;
			}
			break;
		case (VT_ARRAY | VT_UI1)://8209
			{
				if (aFileInfo.m_lSize > 65535)
				{
					return 0;
				}

				aDataInfo.wSize = (WORD)aFileInfo.m_lSize;
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;

				char *pBuf = NULL;

				SafeArrayAccessData(aVar.parray, (void **)&pBuf);

				memcpy(pTemp, pBuf, aDataInfo.wSize);

				SafeArrayUnaccessData(aVar.parray);
			}
			break;
		case VT_NULL:
			{
				aDataInfo.wSize = 0;
				memcpy(pTemp, &aDataInfo, sizeof(TDataInfo));
				pTemp += sizeof(TDataInfo);

				dwRealSize += aDataInfo.wSize;

				if (dwSize < dwRealSize)
				{
					return 0;
				}

				memcpy(pTemp, aFileInfo.m_strName, aDataInfo.wColNameLen);
				pTemp += aDataInfo.wColNameLen;
			}
			break;
		default:
			{
				return 0;
			}
		}
	}

	return dwRealSize;
}
コード例 #23
0
void CClosure::ReadData(void)
{
	CString strSQL = _T("");
	strSQL.Format(_T("SELECT * FROM CLOSUREATAIRPORT WHERE (PROJID = %d);"),m_nProjID);
	long nRecordCount = -1;
	CADORecordset adoRecordset;
	CADODatabase::ExecuteSQLStatement(strSQL, nRecordCount, adoRecordset);

	std::vector<int> vAirportIds;
	InputAirside::GetAirportList(m_nProjID, vAirportIds);	

	Clear();

	if(adoRecordset.IsEOF()){
		std::vector<int>::iterator itrID;
		for (itrID = vAirportIds.begin();itrID != vAirportIds.end();++itrID) {
			switch(m_nObjectMark) {
				case 1://CRunwayClosureAtAirport
					{
						CRunwayClosureAtAirport * pRunwayClosure = new CRunwayClosureAtAirport;
						pRunwayClosure->m_nAirportID = *itrID;
						if(pRunwayClosure)m_vrClosureAtAirport.push_back(pRunwayClosure);
					}
					break;
				case 2://CTaxiwayClosureAtAirport
					{
						CTaxiwayClosureAtAirport* pTaxiwayClosure = new CTaxiwayClosureAtAirport;
						pTaxiwayClosure->m_nAirportID = *itrID;
						if(pTaxiwayClosure)m_vrClosureAtAirport.push_back(pTaxiwayClosure);
					}
					break;
				case 3://CStandGroupClosureAtAirport
					{
						CStandGroupClosureAtAirport* pStandGroupClosure = new CStandGroupClosureAtAirport;
						pStandGroupClosure->m_nAirportID = *itrID;
						if(pStandGroupClosure)m_vrClosureAtAirport.push_back(pStandGroupClosure);
					}
					break;
				default:
					break;
			}
		}
	}

	while (!adoRecordset.IsEOF()) {
		int nID = -1;
		int nAirportID = -1;
		int nObjectMark = -1;
		adoRecordset.GetFieldValue(_T("ID"),nID);
		adoRecordset.GetFieldValue(_T("AIRPORTID"),nAirportID);
		adoRecordset.GetFieldValue(_T("OBJECTMARK"),nObjectMark);

		bool bAdd = false;
		if(std::find(vAirportIds.begin(),vAirportIds.end(),nAirportID) != vAirportIds.end())
			bAdd = true;

		bool bInitialize = true;
		if(nObjectMark != m_nObjectMark)
			bInitialize = false;
			
		if(bInitialize){
			switch(m_nObjectMark) 
			{
			case 1://CRunwayClosureAtAirport
				{
					CRunwayClosureAtAirport * pRunwayClosure = new CRunwayClosureAtAirport(adoRecordset);
					if(pRunwayClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pRunwayClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pRunwayClosure);
					}
				}
				break;
			case 2://CTaxiwayClosureAtAirport
				{
					CTaxiwayClosureAtAirport* pTaxiwayClosure = new CTaxiwayClosureAtAirport(adoRecordset);
					if(pTaxiwayClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pTaxiwayClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pTaxiwayClosure);
					}
				}
				break;
			case 3://CStandGroupClosureAtAirport
				{
					CStandGroupClosureAtAirport* pStandGroupClosure = new CStandGroupClosureAtAirport(adoRecordset);
					if(pStandGroupClosure){
						if(bAdd)
							m_vrClosureAtAirport.push_back(pStandGroupClosure);
						else
							m_vrClosureAtAirportDeleted.push_back(pStandGroupClosure);
					}
				}
				break;
			default:
				break;
			}
		}
		adoRecordset.MoveNextData();
	}

}