当前位置: 首页>>代码示例>>C++>>正文


C++ CRecordset类代码示例

本文整理汇总了C++中CRecordset的典型用法代码示例。如果您正苦于以下问题:C++ CRecordset类的具体用法?C++ CRecordset怎么用?C++ CRecordset使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CRecordset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _T

CRecordset * CMyDatabase::getTableRecordset(CString TableName, CString Whereis)
{
	CString SqlString = _T("SELECT * FROM ")+TableName+Whereis;
	CRecordset *record;
	record= new CRecordset(this->m_nDatabase);
	record->Open(CRecordset::dynaset,SqlString);
	return record;
}
开发者ID:BackupTheBerlios,项目名称:flushcms,代码行数:8,代码来源:MyDatabase.cpp

示例2: OnGetRecordset

void CRecordView::OnUpdateRecordNext(CCmdUI* pCmdUI)
{
    CRecordset* prs = OnGetRecordset();

    // enable if opened and >= 1 records present
    pCmdUI->Enable(prs->IsOpen() && !(prs->IsEOF() && prs->IsBOF())
                   // and not already on last record
                   && !IsOnLastRecord());
}
开发者ID:Rupan,项目名称:winscp,代码行数:9,代码来源:dbview.cpp

示例3: ASSERT

BOOL CBCGPODBCGridCtrl::GetFieldList (LPCTSTR lpszTable, CStringList& lstField)
{
	ASSERT (lpszTable != NULL);

	lstField.RemoveAll ();

	if (m_pDataBase == NULL)
	{
		ASSERT (FALSE);
		return FALSE;
	}

	try
	{
		ASSERT_VALID (m_pDataBase);

		if (!m_pDataBase->IsOpen ())
		{
			ASSERT (FALSE);
			return FALSE;
		}

		CRecordset* pRecordSet = new CRecordset (m_pDataBase);

		CString strSQL = _T("SELECT * FROM ");
		strSQL += lpszTable;

		if (!pRecordSet->Open (CRecordset::forwardOnly, strSQL))
		{
			delete pRecordSet;
			return FALSE;
		}

		const short nColumns = pRecordSet->GetODBCFieldCount ();

		for (short nColumn = 0; nColumn < nColumns; nColumn++)
		{
			CODBCFieldInfo fieldinfo;
			pRecordSet->GetODBCFieldInfo (nColumn, fieldinfo);

			lstField.AddTail (fieldinfo.m_strName);
		}

		pRecordSet->Close ();
		delete pRecordSet;
	}
	catch (CDBException* pEx)
	{
		OnODBCException (pEx);
		pEx->Delete ();

		return FALSE;
	}

	return TRUE;
}
开发者ID:iclosure,项目名称:jframework,代码行数:56,代码来源:BCGPODBCGridCtrl.cpp

示例4: ASSERT_VALID

BOOL CRecordView::IsOnLastRecord()
{
    ASSERT_VALID(this);
    CRecordset* pRecordset = OnGetRecordset();
    CRecordsetStatus status;
    pRecordset->GetStatus(status);
    if (!status.m_bRecordCountFinal)
        return FALSE;
    return ((status.m_lCurrentRecord+1 == pRecordset->GetRecordCount()));
}
开发者ID:Rupan,项目名称:winscp,代码行数:10,代码来源:dbview.cpp

示例5: fnDecodeMessageA

void CGateInfo::MakeNewUser(char *pszPacket)
{
    char				szDecodeMsg[256];
    char				szEncodeMsg[32];
    char				*pszID, *pszName, *pszPassword;
    _TDEFAULTMESSAGE	DefMsg;

    fnDecodeMessageA(&DefMsg, pszPacket);

    if (DefMsg.wIdent == CM_ADDNEWUSER)
    {
        int nPos = fnDecode6BitBufA((pszPacket + DEFBLOCKSIZE), szDecodeMsg, sizeof(szDecodeMsg));
        szDecodeMsg[nPos] = '\0';

        pszID		= &szDecodeMsg[0];

        pszName		= (char *)memchr(szDecodeMsg, '/', memlen(szDecodeMsg) - 1);
        *pszName = '\0';
        pszName++;

        pszPassword	= (char *)memchr(pszName, '/', memlen(pszName) - 1);
        *pszPassword = '\0';
        pszPassword++;

        if ((memlen(pszID) - 1) || (memlen(pszName) - 1) || (memlen(pszPassword) - 1))
        {
            char szQuery[1024];
            sprintf( szQuery,
                     "INSERT TBL_ACCOUNT( FLD_LOGINID, FLD_PASSWORD, FLD_USERNAME, FLD_CERTIFICATION ) "
                     "VALUES( '%s', '%s', '%s', 0 )",
                     pszID, pszPassword, pszName );

            CRecordset *pRec = GetDBManager()->CreateRecordset();
            if ( pRec->Execute( szQuery ) && pRec->GetRowCount() )
                fnMakeDefMessageA( &DefMsg, SM_NEWID_SUCCESS, 0, 0, 0, 0 );
            else
                fnMakeDefMessageA( &DefMsg, SM_NEWID_FAIL, 0, 0, 0, 0 );
            GetDBManager()->DestroyRecordset( pRec );
            // -----------------------------------------------------------------------------------
        }
        else
            fnMakeDefMessageA(&DefMsg, SM_NEWID_FAIL, 0, 0, 0, 0);

        fnEncodeMessageA(&DefMsg, szEncodeMsg, sizeof(szEncodeMsg));

        szDecodeMsg[0] = '#';
        memmove(&szDecodeMsg[1], szEncodeMsg, DEFBLOCKSIZE);
        szDecodeMsg[DEFBLOCKSIZE + 1] = '!';
        szDecodeMsg[DEFBLOCKSIZE + 2] = '\0';

        send(sock, szDecodeMsg, DEFBLOCKSIZE + 2, 0);
    }
}
开发者ID:seem-sky,项目名称:learnserver,代码行数:53,代码来源:GateInfo.cpp

示例6: InitMonItemInfo

void InitMonItemInfo()
{
	int			nMonIndex;
	char		szQuery[1024];
	CRecordset *pRec = g_pConnCommon->CreateRecordset();

	sprintf( szQuery, "SELECT * FROM TBL_MONITEM");

	if (pRec->Execute( szQuery ))
	{
		while (pRec->Fetch())
		{
			nMonIndex = atoi( pRec->Get( "FLD_MONSTER" ));

			CMonItem* pMonItem = new CMonItem;

			if (pMonItem)
			{
				pMonItem->m_btItemType	= atoi( pRec->Get( "FLD_TYPE" ));
				pMonItem->m_wItemIndex	= atoi( pRec->Get( "FLD_ITEM" ));
				pMonItem->m_nPoint		= atoi( pRec->Get( "FLD_PROBABLY" ));
				pMonItem->m_wCount		= atoi( pRec->Get( "FLD_COUNT" ));
			
				if (g_pMonRaceInfo && (nMonIndex <= g_nNumOfMonRaceInfo))
					g_pMonRaceInfo[nMonIndex].m_xMonItemList.AddNewNode(pMonItem);
			}
		}	
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
开发者ID:KaSt,项目名称:mir2ei,代码行数:31,代码来源:Handler_CommonDB.cpp

示例7: new

//-------------------------------------------------------------->>>
//函数:DBOpenRecordset
//功能:执行 SQL 语句得到视图
//参数:
//		nOpenType	:返回的记录集类型
//			dynaset		= 0,uses SQLExtendedFetch, keyset driven cursor
//			snapshot	= 1,uses SQLExtendedFetch, static cursor
//			forwardOnly	= 2,uses SQLFetch
//			dynamic		= 3,uses SQLExtendedFetch, dynamic cursor
//		sSQL	:要执行的SQL语句
//返回:
//		CRecordset	:返回记录集,注:记录集用完要先关闭后删除.
//		NULL		:SQL语句错误
//-------------------------------------------------------------->>>
CRecordset * CDBManager::DBOpenRecordset(UINT nOpenType, CString sSQL)
{
CRecordset	*reSet;

	reSet = new(CRecordset);
	reSet->m_pDatabase = &m_DB;
	try
	{
		reSet->Open(nOpenType, sSQL);
	}
	catch(CDBException)
	{
		delete reSet;
		m_ErrorMsg = "SQL语句错误!";
		return(NULL);
	};
	return(reSet);
}
开发者ID:vnta,项目名称:Cashless-campus,代码行数:32,代码来源:DBManager.cpp

示例8: InitMoveMapEventInfo

void InitMoveMapEventInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MOVEMAPEVENT");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMoveMapEventInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMoveMapEventInfo < 0) return;

	g_pMoveMapEventInfo = new CMoveMapEventInfo[g_nNumOfMoveMapEventInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MOVEMAPEVENT ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMoveMapEventInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				strcpy(g_pMoveMapEventInfo[i].szSMapFileName, pRec->Get( "FLD_SMAPFILENAME" ) );
				strcpy(g_pMoveMapEventInfo[i].szDMapFileName, pRec->Get( "FLD_DMAPFILENAME" ) );

				g_pMoveMapEventInfo[i].nSX = atoi( pRec->Get( "FLD_SX" ) );
				g_pMoveMapEventInfo[i].nSY = atoi( pRec->Get( "FLD_SY" ) );
				g_pMoveMapEventInfo[i].nDX = atoi( pRec->Get( "FLD_DX" ) );
				g_pMoveMapEventInfo[i].nDY = atoi( pRec->Get( "FLD_DY" ) );

				g_pMoveMapEventInfo[i].fIsOpen = FALSE;
			}
		}

		InsertLogMsgParam(IDS_FETCH_MOVEMAPEVENT, &g_nNumOfMoveMapEventInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
开发者ID:KaSt,项目名称:mir2ei,代码行数:46,代码来源:Handler_CommonDB.cpp

示例9: memlen

void CGateInfo::ReceiveServerMsg(char *pszPacket)
{
    char		*pszPos;
    int			nCertification;
    int			nLen = memlen(pszPacket);

    if (pszPos = (char *)memchr(pszPacket, '/', nLen))
    {
        *pszPos++ = '\0';
        nCertification = AnsiStrToVal(pszPos);

        char szQuery[256];
        sprintf( szQuery,
                 "UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=%d WHERE FLD_LOGINID='%s'",
                 nCertification, pszPacket );

        CRecordset *pRec = GetDBManager()->CreateRecordset();
        pRec->Execute( szQuery );
        GetDBManager()->DestroyRecordset( pRec );
    }
}
开发者ID:seem-sky,项目名称:learnserver,代码行数:21,代码来源:GateInfo.cpp

示例10: LoadCharacterRecords

void LoadCharacterRecords()
{
	InsertLogMsg(IDS_LOADACCOUNTRECORDS);

	CRecordset *pRec = GetDBManager()->CreateRecordset();
	if ( pRec->Execute( "SELECT * FROM TBL_GAMEGATEINFO" ) )
	{
		GAMESERVERINFO *pServerInfo;

		while ( pRec->Fetch() )
		{
			pServerInfo = new GAMESERVERINFO;
			if ( !pServerInfo )
				break;

			pServerInfo->index = atoi( pRec->Get( "FLD_SERVERIDX" ) );
			strcpy( pServerInfo->name, pRec->Get( "FLD_SERVERNAME" ) );
			strcpy( pServerInfo->ip,   pRec->Get( "FLD_SERVERIP" ) );
			pServerInfo->connCnt = 0;

			g_xGameServerList.AddNewNode( pServerInfo );
		}
	}
	GetDBManager()->DestroyRecordset( pRec );
}
开发者ID:KaSt,项目名称:mir2ei,代码行数:25,代码来源:MainWndProc.cpp

示例11: DeleteExistCharacter

void CGateInfo::DeleteExistCharacter(SOCKET s, _LPTCREATECHR lpTCreateChr)
{
	_TDEFAULTMESSAGE	DefaultMsg;
	char				szEncodeMsg[32];
	char				szQuery[256];
	CRecordset			*pRec;

	sprintf( szQuery, "DELETE FROM TBL_CHARACTER WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );

	pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( szQuery );
	GetDBManager()->DestroyRecordset( pRec );

	sprintf( szQuery, "DELETE FROM TBL_CHARACTER_GENITEM WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );

	pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( szQuery );
	GetDBManager()->DestroyRecordset( pRec );

	sprintf( szQuery, "DELETE FROM TBL_CHARACTER_ITEM WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );

	pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( szQuery );
	GetDBManager()->DestroyRecordset( pRec );

	sprintf( szQuery, "DELETE FROM TBL_CHARACTER_MAGIC WHERE FLD_LOGINID='%s' AND FLD_CHARNAME='%s'", lpTCreateChr->szID, lpTCreateChr->szName );

	pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( szQuery );
	GetDBManager()->DestroyRecordset( pRec );

	fnMakeDefMessageA(&DefaultMsg, SM_DELCHR_SUCCESS, 0, 4, 0, 0);
	int nPos = fnEncodeMessageA(&DefaultMsg, szEncodeMsg, sizeof(szEncodeMsg));
	szEncodeMsg[nPos] = '\0';
	
	SendToGate(s, szEncodeMsg);
}
开发者ID:KaSt,项目名称:mir2ei,代码行数:37,代码来源:GateInfo.cpp

示例12: LoadAccountRecords

UINT WINAPI LoadAccountRecords(LPVOID lpParameter)
{
	InsertLogMsg(IDS_LOADACCOUNTRECORDS);

	CRecordset *pRec = GetDBManager()->CreateRecordset();
	pRec->Execute( "UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=0 WHERE FLD_CERTIFICATION >= 30" );
	GetDBManager()->DestroyRecordset( pRec );
	// ----------------------------------------------------------------------------------------

	GAMESERVERINFO *pServerInfo;

	pRec = GetDBManager()->CreateRecordset();
	if ( pRec->Execute( "SELECT * FROM TBL_SERVERINFO" ) )
	{
		while ( pRec->Fetch() )
		{			
			pServerInfo = new GAMESERVERINFO;
			if ( !pServerInfo )
				break;

			pServerInfo->index = atoi( pRec->Get( "FLD_SERVERIDX" ) );
			strcpy( pServerInfo->name, pRec->Get( "FLD_SERVERNAME" ) );
			strcpy( pServerInfo->ip,   pRec->Get( "FLD_SERVERIP" ) );
			pServerInfo->connCnt = 0;

			g_xGameServerList.AddNewNode( pServerInfo );
		}
	}
	GetDBManager()->DestroyRecordset( pRec );

	char szTmp[64];
	for ( PLISTNODE pNode = g_xGameServerList.GetHead(); pNode; pNode = g_xGameServerList.GetNext( pNode ) )
	{
		pServerInfo = g_xGameServerList.GetData( pNode );
		
		sprintf( szTmp, "%d,%s,", pServerInfo->index, pServerInfo->name );
		strcat( g_szServerList, szTmp );
	}
	// ----------------------------------------------------------------------------------------

	InitServerThreadForMsg();

	if (InitServerSocket(g_gcSock, &g_gcAddr, _IDM_GATECOMMSOCK_MSG, 5500, 1))
		SwitchMenuItem(TRUE);

	return 0L;
}
开发者ID:KaSt,项目名称:LegendOfMir3_Src,代码行数:47,代码来源:MainWndProc.cpp

示例13: InitMagicInfo

void InitMagicInfo()
{
	char szQuery[1024];

	CRecordset *pRec = g_pConnCommon->CreateRecordset();
	sprintf( szQuery, "SELECT COUNT(*) AS FLD_COUNT FROM TBL_MAGIC");

	if (pRec->Execute( szQuery ))
	{
			if (pRec->Fetch())
				g_nNumOfMagicInfo = atoi( pRec->Get( "FLD_COUNT" ) );
	}

	g_pConnCommon->DestroyRecordset( pRec );

	if (g_nNumOfMagicInfo < 0) return;

	g_pMagicInfo = new CMagicInfo[g_nNumOfMagicInfo];

	sprintf( szQuery, "SELECT * FROM TBL_MAGIC ORDER BY FLD_INDEX");

	pRec = g_pConnCommon->CreateRecordset();
	
	if (pRec->Execute( szQuery ))
	{
		for (int i = 0; i < g_nNumOfMagicInfo; i++)
		{
			if (pRec->Fetch())								 
			{
				g_pMagicInfo[i].nIndex			= atoi( pRec->Get( "FLD_INDEX" ) );
				
				strcpy(g_pMagicInfo[i].szName, pRec->Get( "FLD_NAME" ) );
				ChangeSpaceToNull(g_pMagicInfo[i].szName);

				g_pMagicInfo[i].sEffectType		= atoi( pRec->Get( "FLD_EFFECTTYPE" ) );
				g_pMagicInfo[i].sEffect			= atoi( pRec->Get( "FLD_EFFECT" ) );
				g_pMagicInfo[i].sSpell			= atoi( pRec->Get( "FLD_SPELL" ) );
				g_pMagicInfo[i].sPower			= atoi( pRec->Get( "FLD_POWER" ) );
				g_pMagicInfo[i].sMaxPower		= atoi( pRec->Get( "FLD_MAXPOWER" ) );
				g_pMagicInfo[i].sDefSpell		= atoi( pRec->Get( "FLD_DEFSPELL" ) );
				g_pMagicInfo[i].sDefPower		= atoi( pRec->Get( "FLD_DEFPOWER" ) );
				g_pMagicInfo[i].sDefMaxPower	= atoi( pRec->Get( "FLD_DEFMAXPOWER" ) );
				g_pMagicInfo[i].sJob			= atoi( pRec->Get( "FLD_JOB" ) );
				g_pMagicInfo[i].sNeed[0]		= atoi( pRec->Get( "FLD_NEEDL1" ) );
				g_pMagicInfo[i].nTrain[0]		= atoi( pRec->Get( "FLD_L1TRAIN" ) );
				g_pMagicInfo[i].sNeed[1]		= atoi( pRec->Get( "FLD_NEEDL2" ) );
				g_pMagicInfo[i].nTrain[1]		= atoi( pRec->Get( "FLD_L2TRAIN" ) );
				g_pMagicInfo[i].sNeed[2]		= atoi( pRec->Get( "FLD_NEEDL3" ) );
				g_pMagicInfo[i].nTrain[2]		= atoi( pRec->Get( "FLD_L3TRAIN" ) );
				g_pMagicInfo[i].sDelay			= atoi( pRec->Get( "FLD_DELAY" ) );
			}
		}

		InsertLogMsgParam(IDS_FETCH_MAGICDATA, &g_nNumOfMagicInfo, LOGPARAM_INT);
	}

	g_pConnCommon->DestroyRecordset( pRec );
}
开发者ID:KaSt,项目名称:mir2ei,代码行数:58,代码来源:Handler_CommonDB.cpp

示例14: GetStaticData

void CEdRptDoc::GetStaticData(CRecordset &rc)
{
	if (!rc.IsOpen())
		return;

	CString csTmp;

	GV_ITEM Item;
	Item.mask = GVIF_TEXT|GVIF_FORMAT;
	Item.nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS|DT_NOPREFIX;	
	Item.row = m_Grid.GetRowCount() - 1;	
	Item.col = 0;
	Item.szText = "总计";
	m_Grid.SetItem(&Item);

	CString csFormat;
	CODBCFieldInfo fi;
	for (Item.col = 1; Item.col < m_ColFmt.GetSize(); Item.col++)
	{
		if (m_ColFmt[Item.col].format.IsEmpty())
		{
			rc.GetODBCFieldInfo(short(Item.col), fi);
			if (fi.m_nSQLType == SQL_NUMERIC || fi.m_nSQLType == SQL_DECIMAL)
			{
				if (fi.m_nScale == 0)
				{
					fi.m_nSQLType = SQL_INTEGER;
					csFormat.Format("%%%dd", fi.m_nPrecision);				
				}
				else
				{
					fi.m_nSQLType = SQL_FLOAT;
					csFormat.Format("%%%d.%df", fi.m_nPrecision, fi.m_nScale);				
				}
			}
		}
		else
		{
			csFormat = m_ColFmt[Item.col].format;
			if (csFormat.FindOneOf("dioux") > 0)
				fi.m_nSQLType = SQL_INTEGER;
			else if (csFormat.FindOneOf("eEfgG") > 0)
				fi.m_nSQLType = SQL_FLOAT;
			else
				fi.m_nSQLType = SQL_DATETIME;
		}

		switch(fi.m_nSQLType)
		{
		case SQL_INTEGER:
		case SQL_SMALLINT:
		case SQL_TINYINT:
		case SQL_BIGINT:
			fi.m_nSQLType = SQL_INTEGER;
			if (csFormat.IsEmpty())
				csFormat = _T("%d");
			break;

		case SQL_FLOAT:
		case SQL_REAL:
		case SQL_DOUBLE:
			fi.m_nSQLType = SQL_FLOAT;
			if (csFormat.IsEmpty())
				csFormat = _T("%f");
			break;
		default:
			break;
		}
		
		double fSum = 0.0;
		if (fi.m_nSQLType == SQL_INTEGER || fi.m_nSQLType == SQL_FLOAT)
		{
			CString csTmp;
			for (int j = 1; j < m_Grid.GetRowCount() - 1; j++)
			{
				csTmp = m_Grid.GetItemText(j, Item.col);
				fSum += atof(csTmp);
			}
		}
		
		if (fi.m_nSQLType == SQL_INTEGER)
			Item.szText.Format(csFormat, (int)fSum);
		else if (fi.m_nSQLType == SQL_FLOAT)
			Item.szText.Format(csFormat, fSum);
		else
			Item.szText = "--:--";

		Item.szText.TrimLeft();
		Item.szText.TrimRight();
		m_Grid.SetItem(&Item);	
	}
	
}
开发者ID:zphseu,项目名称:cuiyan,代码行数:93,代码来源:EdRptDoc.cpp

示例15: while

void CGateInfo::ProcLogin(SOCKET s, char *pszData)
{
    char				szIDPassword[32];
    char				*pszID, *pszPassword;
    char				szEncodePacket[64];
    _TDEFAULTMESSAGE	DefMsg;
    int					nPos;
    char				szQuery[256];

    if (memlen(pszData) - 1 <= 0) return;

    PLISTNODE pListNode = xUserInfoList.GetHead();

    while (pListNode)
    {
        CUserInfo *pUserInfo = xUserInfoList.GetData(pListNode);

        if (pUserInfo->sock == s)
        {
            int nDecodeLen = fnDecode6BitBufA(pszData, szIDPassword, sizeof(szIDPassword));
            szIDPassword[nDecodeLen] = '\0';

            pszID		= &szIDPassword[0];

            if (pszPassword	= (char *)memchr(szIDPassword, '/', sizeof(szIDPassword)))
            {
                *pszPassword = '\0';
                pszPassword++;

                sprintf( szQuery, "SELECT * FROM TBL_ACCOUNT WHERE FLD_LOGINID='%s'", pszID );

                CRecordset *pRec = GetDBManager()->CreateRecordset();

                if ( !pRec->Execute( szQuery ) || !pRec->Fetch() )
                    fnMakeDefMessageA( &DefMsg, SM_ID_NOTFOUND, 0, 0, 0, 0 );
                else if ( CompareDBString( pszPassword, pRec->Get( "FLD_PASSWORD" ) ) != 0 )
                    fnMakeDefMessageA( &DefMsg, SM_PASSWD_FAIL, 0, 0, 0, 0 );
                else
                {
                    int nCertCode = atoi( pRec->Get( "FLD_CERTIFICATION" ) );
                    /*
                    			if ( nCertCode > 0 && nCertCode < 30 )
                    				fnMakeDefMessageA(&DefMsg, SM_CERTIFICATION_FAIL, (nCertCode + 1), 0, 0, 0);
                    			else if ( nCertCode >= 30 )
                    				fnMakeDefMessageA(&DefMsg, SM_CERTIFICATION_FAIL, 1, 0, 0, 0);
                    			else*/
                    {
                        char szEncodeServerList[512];
                        char szEncodeAllPacket[1024];

                        fnMakeDefMessageA(&DefMsg, SM_PASSOK_SELECTSERVER, 0, 1, 0, 0);
                        nPos = fnEncodeMessageA(&DefMsg, szEncodePacket, sizeof(szEncodePacket));
                        szEncodePacket[nPos] = '\0';

                        int nPos2 = fnEncode6BitBufA((unsigned char *)g_szServerList, szEncodeServerList, memlen(g_szServerList), sizeof(szEncodeServerList));
                        szEncodeServerList[nPos2] = '\0';

                        memmove(szEncodeAllPacket, szEncodePacket, nPos);
                        memmove(&szEncodeAllPacket[nPos], szEncodeServerList, memlen(szEncodeServerList));

                        SendToGate(s, szEncodeAllPacket);

                        GetDBManager()->DestroyRecordset( pRec );

                        pUserInfo->nCertification = GetCertification();

                        //				pRec = GetDBManager()->CreateRecordset();
                        //				sprintf( szQuery,
                        //					"UPDATE TBL_ACCOUNT SET FLD_CERTIFICATION=%d WHERE FLD_LOGINID='%s'",
                        //					GetCertification(), pszID );
                        //				pRec->Execute( szQuery );

                        //				GetDBManager()->DestroyRecordset( pRec );

                        return;
                    }
                }

                GetDBManager()->DestroyRecordset( pRec );

                nPos = fnEncodeMessageA(&DefMsg, szEncodePacket, sizeof(szEncodePacket));
                szEncodePacket[nPos] = '\0';

                SendToGate(s, szEncodePacket);
            }
        }

        pListNode = xUserInfoList.GetNext(pListNode);
    }
}
开发者ID:seem-sky,项目名称:learnserver,代码行数:90,代码来源:GateInfo.cpp


注:本文中的CRecordset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。