本文整理汇总了C++中CString::GetStr方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::GetStr方法的具体用法?C++ CString::GetStr怎么用?C++ CString::GetStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::GetStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCond
bool CSqlWhere::AddCond(const CString& oName, uint32 nOp, const CString& oVal)
{
if(m_pAccess == NULL)
return false;
uint32 nFieldNo = m_pAccess->GetFieldNo(oName.GetStr());
if(nFieldNo == (uint32)(-1))
{
m_bError = true;
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlWhere::AddCond() there isn't the field '%s' in the table '%s'", oName.GetStr(), m_oName.GetStr()));
return false;
}
bool bSet;
CMdbParaSet* pParaSet;
uint32 i, nCount = m_pWhere->GetParaCount();
if(nCount)
pParaSet = (CMdbParaSet*)m_pWhere->GetPara(nCount - 1, bSet);
else
pParaSet = (CMdbParaSet*)m_pWhere->AddParaSet();
nCount = pParaSet->GetParaCount();
for(i=0; i<nCount; ++i)
{
CMdbSqlPara* pPara = (CMdbSqlPara*)pParaSet->GetPara(i, bSet);
if(!pPara->IsSetField(nFieldNo))
{
pPara->SetFromString(nFieldNo, oVal.GetStr(), nOp);
return true;
}
}
CMdbSqlPara* pPara = (CMdbSqlPara*)pParaSet->AddPara();
pPara->SetFromString(nFieldNo, oVal.GetStr(), nOp);
return true;
}
示例2: AddValue
bool CSqlInsert::AddValue(const CString& oVal)
{
if(m_pAccess == NULL)
return false;
uint32 nFldNo = m_nFldNo++;
if(!m_oFieldTable.GetSize())
{
uint32 nFieldCount = m_pAccess->GetFieldCount();
if(nFldNo < nFieldCount)
m_pInsertAttr->SetFromString(nFldNo, (char*)oVal.GetStr(), MDB_SQLPARA_OPERATOR_EQUAL);
else
{
m_bError = true;
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlInsert::AddValue() there isn't the field no '%u' in the table '%s'", nFldNo, m_oName.GetStr()));
return false;
}
}
else
{
CString& oFieldName = m_oFieldTable[nFldNo];
uint32 nFieldNo = m_pAccess->GetFieldNo(oFieldName.GetStr());
if(nFieldNo == (uint32)(-1))
{
m_bError = true;
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlInsert::AddValue() there isn't the field no '%u' in the table '%s'", nFldNo, m_oName.GetStr()));
return false;
}
m_pInsertAttr->SetFromString(nFieldNo, oVal.GetStr(), MDB_SQLPARA_OPERATOR_EQUAL);
}
return true;
}
示例3: InitializeMdbSecurityInfo
static void InitializeMdbSecurityInfo(CString& oUser, CString& oPasswd)
{
CMdb* pDb = CMdb::GetMdb(MDB_SYSDB_NAME);
CMdbAccess* pAccess = pDb->QueryAccess("MdbSecurity");
CMdbPara* pPara = pAccess->GetInsertPara();
pPara->SetNull(0);//MdbName
pPara->SetString(1, oUser.GetStr());
pPara->SetString(2, oPasswd.GetStr());
pAccess->Insert();
pAccess->Release();
}
示例4: AddSetPara
bool CSqlUpdate::AddSetPara(const CString& oName, const CString& oVal, uint32 nOp)
{
if(m_pAccess == NULL)
return false;
uint32 nFieldNo = m_pAccess->GetFieldNo(oName.GetStr());
if(nFieldNo == (uint32)(-1))
{
m_bError = true;
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlUpdate::AddSetPara() there isn't the field '%s' in the table '%s'", oName.GetStr(), m_oName.GetStr()));
return false;
}
m_pSetAttr->SetFromString(nFieldNo, oVal.GetStr(), nOp);
return true;
}
示例5: GetNameValue
uint32 CLogArchiver::GetNameValue(const char* &pStr, uint32 &nName, CString &oValue, uint32 &nValue)
{
bool bInt;
uint32 nRet;
CString oName;
nRet = GetIdentifier(pStr, oName);
if(!nRet)
nRet = GetNameType(oName, nName, bInt);
if(!nRet)
{
SkipWhiteSpace(pStr);
if(pStr[0] != '=')
nRet = 1;
else
++pStr;
}
if(!nRet)
{
if(bInt)
{
nRet = GetInt(pStr, oValue);
if(!nRet)
nValue = CString::Atoi(oValue.GetStr());
}
else
nRet = GetString(pStr, oValue);
}
return nRet;
}
示例6: OnWalk
virtual void OnWalk(uint32 nDomain, uint32 nNode, const CAsmNode& oNode)
{
CString oDate;
struct tm *tloc;
#ifndef WINDOWS
struct tm tt;
localtime_r((const time_t*)&oNode.nTime, &tt);
tloc = &tt;
#else
tloc = localtime((const time_t*)&oNode.nTime);
#endif
CStringFormatter(&oDate).Print("%04d-%02d-%02d %02d:%02d:%02d",
1900+tloc->tm_year,tloc->tm_mon+1,tloc->tm_mday,
tloc->tm_hour,tloc->tm_min,tloc->tm_sec);
CIpAddr oAddr;
CString oFileName;
CAcmUdp* pUdp = CAcmUdp::QueryUdp(nDomain);
pUdp->GetNodeAddr(nNode, oAddr);
CFile::GetIpFileName(oAddr, oFileName);
m_pSession->Print(" Node[%u].Addr(%s) startup at %s, %s, %s\r\n", nNode, oFileName.GetStr(), oDate.GetStr(),
oNode.bOnLine?"online ":"offline", oNode.bServering?"active":"inactive");
++m_nWalkSize;
}
示例7: Load
void CInterfaceManager::Load()
{
m_oMutex.Enter();
if(m_pAutoLibrary == NULL)
{
uint32 i, nCount;
CString oLibDir;
const char* sAppHome = CFilePathInfo::GetInstance()->GetHome();
oLibDir += sAppHome;
oLibDir += "/lib/";
oLibDir += m_sLibDir;
m_pAutoLibrary = new CAutoLibrary(oLibDir.GetStr());
nCount = m_oInterfaces.GetSize();
for(i=nCount; i; --i)
{
CInterface* pInterface = m_oInterfaces[i-1];
if(QueryInterface(pInterface->GetInterfaceName()) != pInterface)
{
m_oMutex.Leave();
FocpAbort(( "re-register interface :%s", pInterface->GetInterfaceName()));
}
}
}
m_oMutex.Leave();
}
示例8: Walk
void CAcmUdp::Walk()
{
CIpAddr oItfAddr;
CString oFileName;
GetInterfaceAddr(oItfAddr);
CFile::GetIpFileName(oItfAddr, oFileName);
m_pContext->OnWalk(m_nNode, oFileName.GetStr());
CRbTreeNode* pEnd = m_oNodeList.End();
m_oMutex.Enter();
CRbTreeNode* pIt = m_oNodeList.First();
for(; pIt!=pEnd; pIt=m_oNodeList.GetNext(pIt))
{
uint32 nNode = m_oNodeList.GetKey(pIt);
CIpAddr& oAddr = m_oNodeList.GetItem(pIt);
CFile::GetIpFileName(oAddr, oFileName);
m_pContext->OnWalk(nNode, oFileName.GetStr());
}
m_oMutex.Leave();
}
示例9: CreateSqlInsert
uint32 CSqlDataBase::CreateSqlInsert(const CString& oName)
{
CMdbAccess * pAccess = m_pDb->QueryAccess(oName.GetStr());
if(!pAccess)
{
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlDataBase::CreateSqlInsert(%s.%s) failure: MDB_TABLE_NOTEXIST", m_pDb->GetDbName(), oName.GetStr()));
return MDB_TABLE_NOTEXIST;
}
m_oInsert.Bind(oName, pAccess);
return MDB_SUCCESS;
}
示例10: DoArchive
void CLogArchiver::DoArchive(bool bDispErr)
{
uint32 nOldArchId = m_nArchId;
++m_nArchId;
if(m_nArchId > m_nArchNo)
m_nArchId = 1;
char sLogDir[FOCP_MAX_PATH];
CFormatString oCmd;
CString::StringCopy(sLogDir, m_oLogDir.GetStr());
CDiskFileSystem::GetInstance()->GetOsPathName(sLogDir);
#ifdef WINDOWS
oCmd.Print("tar -czf %s\\%s.%03d.log.tar.gz %s\\%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr());
#else
oCmd.Print("tar -czf %s/%s.%03d.log.tar.gz %s/%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr());
#endif
int32 nRet = System(oCmd.GetStr());
char sErrFile[FOCP_MAX_PATH];
CString::StringCopy(sErrFile, "disk://");
CDiskFileSystem::GetInstance()->GetFullPath("2.txt", sErrFile+7);
CFile oFile(sErrFile, "r");
bool bHaveError = false;
CString oError;
while(true)
{
int32 nLen = oFile.Read(sErrFile, FOCP_MAX_PATH);
if(nLen <= 0)
break;
bHaveError = true;
oError.Append(sErrFile, nLen);
}
oFile.Redirect(NULL);
if(bHaveError)
{
m_nArchId = nOldArchId;
if(bDispErr)
FocpError(("%s", oError.GetStr()));
}
else if(nRet)
{
m_nArchId = nOldArchId;
if(bDispErr)
FocpError(("system('%s') failure", oCmd.GetStr()));
}
else
{
oCmd.Clear();
oCmd.Print("rm -rf %s\\%s.*.log 1>1.txt 2>2.txt", sLogDir, m_oLogName.GetStr());
System(oCmd.GetStr());
}
System("rm -rf 1.txt");
System("rm -rf 2.txt");
}
示例11: TruncateTable
uint32 CSqlDataBase::TruncateTable(const CString& oName)
{
CMdbAccess * pAccess = m_pDb->QueryAccess(oName.GetStr());
if(!pAccess)
{
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlDataBase::TruncateTable(%s.%s) failure: MDB_TABLE_NOTEXIST", m_pDb->GetDbName(), oName.GetStr()));
return MDB_TABLE_NOTEXIST;
}
pAccess->Truncate();
pAccess->Release();
FocpCmdLogEx("SQL", FOCP_LOG_SYSLOG, ("CSqlDataBase::TruncateTable(%s.%s) success", m_pDb->GetDbName(), oName.GetStr()));
return 0;
}
示例12: SelectDataBase
uint32 CSqlEnv::SelectDataBase(const CString& oName)
{
CMdb* pDb = CMdb::GetMdb(oName.GetStr());
if(!pDb)
{
FocpCmdLogEx("SQL", FOCP_LOG_ERROR,
("CSqlEnv::SelectDataBase(%s) failure", oName.GetStr()));
return MDB_DB_NOTEXIST;
}
if(!pDb->GetLocalInterface())
{
if(!oName.Compare("sysdb", false))
{
FocpCmdLogEx("SQL", FOCP_LOG_ERROR,
("CSqlEnv::SelectDataBase(%s) failure", oName.GetStr()));
return MDB_DB_NOTEXIST;
}
}
m_oDataBase.Bind(pDb);
FocpCmdLogEx("SQL", FOCP_LOG_CLOSE,
("CSqlEnv::SelectDataBase(%s) success", oName.GetStr()));
return MDB_SUCCESS;
}
示例13: QueryTable
uint32 CSqlDataBase::QueryTable()
{
if(!m_oSelect.m_pAccess)
return 0;
CMdbFilter* pFilter = m_oSelect.m_pAccess->GetResultFilter();
uint32 nSize = m_oSelect.m_oFieldTable.GetSize();
for(uint32 i=0; i<nSize; ++i)
pFilter->SetField(m_oSelect.m_pAccess->GetFieldNo(m_oSelect.m_oFieldTable[i].GetStr()));
uint32 nRet;
if(m_oSelect.m_bError)
return 0;
uint32 nTotal = 0;
CString oList = GetFieldList();
while(true)
{
nRet = m_oSelect.m_pAccess->Query(m_nResultSize, nTotal);
m_oSelect.m_pRecordSet = m_oSelect.m_pAccess->GetResultSet();
if(nRet)
{
FocpCmdLogEx("SQL", FOCP_LOG_ERROR, ("CSqlDataBase::QueryTable(%s.%s) failure: %s", m_pDb->GetDbName(), m_oSelect.m_oName.GetStr(), GetMdbError(nRet)));
m_pEnv->Flush(false);
m_oSelect.UnBind();
return 0;
}
else
{
if(!nTotal)
{
FocpCmdLogEx("SQL", FOCP_LOG_CLOSE, ("%s", oList.GetStr()));
m_pEnv->Flush(false);
}
uint32 nCount = m_oSelect.GetResultCount();
for(uint32 i=0; i<nCount; ++i)
{
CMdbResult* pRecord = m_oSelect.GetRecord(i);
FocpCmdLogEx("SQL", FOCP_LOG_CLOSE, ("%s", GetRecordText(pRecord, oList).GetStr()));
m_pEnv->Flush(false);
}
nTotal += nCount;
if(nCount < m_nResultSize)
break;
}
}
FocpCmdLogEx("SQL", FOCP_LOG_CLOSE, ("\r\ntotal %u records in %s.%s", nTotal, m_pDb->GetDbName(), m_oSelect.m_oName.GetStr()));
m_oSelect.UnBind();
return 0;
}
示例14: UnLoad
void UnLoad()
{
if(m_pLib && m_bNeedFree)
{
#if defined(WINDOWS)// || defined(CYGWIN_NT)
::FreeLibrary((HMODULE)m_pLib);
#else
::dlclose(m_pLib);
#endif
if(!m_oFileName.Empty())
FocpLog(FOCP_LOG_SYSLOG, ("UnLoad(%s) success", m_oFileName.GetStr()));
}
m_bNeedFree = true;
m_pLib = NULL;
}
示例15: Query
void CLogArchiver::Query(CCmdSession* pSession, const char *sCmdLine, const char* sCmdArg)
{
CString oLogName;
CFormatString oFmt(sCmdArg);
int32 nRet = oFmt.Scan("%s", &oLogName);
if(nRet < 1)
{
pSession->Print("Missing the server address argument\r\n");
return;
}
if(!oLogName.IsIdentifierOfC())
{
pSession->Print("Invalid logname\r\n");
return;
}
CArchiverTable* pTable = CArchiverTable::GetInstance();
pTable->m_oMutex.Enter();
CRbTreeNode* pIt = pTable->m_oArchiverTable.Find(oLogName);
if(pIt == pTable->m_oArchiverTable.End())
{
pTable->m_oMutex.Leave();
pSession->Print("The logname isn't existed\r\n");
return;
}
CString oChooser;
CLogArchiver* pItem = pTable->m_oArchiverTable.GetItem(pIt);
pItem->GetChooser(oChooser);
CFormatString oFmt2;
oFmt2.Print("The chooser is '%s', \r\nand the filter include:", oChooser.GetStr());
if(pItem->m_nFilter & FOCP_LOG_HOST)
oFmt2.Print("HOST ");
if(pItem->m_nFilter & FOCP_LOG_DATE)
oFmt2.Print("DATE ");
if(pItem->m_nFilter & FOCP_LOG_APPN)
oFmt2.Print("APP ");
if(pItem->m_nFilter & FOCP_LOG_MODU)
oFmt2.Print("MODULE ");
if(pItem->m_nFilter & FOCP_LOG_SRCF)
oFmt2.Print("FILE ");
if(pItem->m_nFilter & FOCP_LOG_FUNC)
oFmt2.Print("FUNC");
pSession->Print("%s\r\n", oFmt2.GetStr());
pTable->m_oMutex.Leave();
}