本文整理汇总了C++中CppSQLite3Query::getIntField方法的典型用法代码示例。如果您正苦于以下问题:C++ CppSQLite3Query::getIntField方法的具体用法?C++ CppSQLite3Query::getIntField怎么用?C++ CppSQLite3Query::getIntField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CppSQLite3Query
的用法示例。
在下文中一共展示了CppSQLite3Query::getIntField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getcache
bool mtn_cms_page_builder::getcache(const std::string& page, mtn_cms_cache_item* cache_item)
{
std::string _q = "SELECT * FROM `page_cache` WHERE page = \'" + page + "\';";
try
{
CppSQLite3Query q = _db->execQuery(_q.c_str());
while (!q.eof())
{
int len;
cache_item->data = q.getStringField("data");
cache_item->created = q.getIntField("created");
cache_item->ttl = q.getIntField("ttl");
cache_item->valid = true;
q.nextRow();
}
}
catch (CppSQLite3Exception ex)
{
cache_item->valid = false;
}
return cache_item->valid;
}
示例2: loadItemsData
//private
void RPGMapItemsMenuLayer::loadItemsData()
{
//道具数据
this->m_itemsList->removeAllObjects();
CppSQLite3Query query = this->m_db->execQuery(ITEMS_EXISTING_QUERY);
while(!query.eof())
{
RPGExistingItems *itemsData = RPGExistingItems::create();
itemsData->m_dataId = query.getIntField("id");
itemsData->m_name = query.getStringField("name_cns");
itemsData->m_buy = query.getIntField("buy");
itemsData->m_sell = query.getIntField("sell");
itemsData->m_type = query.getIntField("type");
itemsData->m_attack = query.getFloatField("attack");
itemsData->m_defense = query.getFloatField("defense");
itemsData->m_speed = query.getFloatField("speed");
itemsData->m_skillAttack = query.getFloatField("skill_attack");
itemsData->m_skillDefense = query.getFloatField("skill_defense");
itemsData->m_total = query.getIntField("total");
this->m_itemsList->addObject(itemsData);
query.nextRow();
}
query.finalize();
CCTableView *tableView = (CCTableView*)this->getChildByTag(kRPGMapItemsMenuLayerTagItemListTable);
tableView->reloadData();
}
示例3: OnSelchangeLocationlist
void CTerminateNewLocationDialog::OnSelchangeLocationlist()
{
int iLocationID = m_ctlLocationList.GetItemData(m_ctlLocationList.GetCurSel());
CString sSQL;
sSQL.Format("SELECT Industries.id,Industries.name FROM Industries,Sidings WHERE Industries.Sidings_FK=Sidings.id AND Sidings.Locations_FK=%d",iLocationID);
TRACE(sSQL);
//
CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
CppSQLite3Query q = pDB->execQuery(sSQL);
//
while( m_ctlIndustryList.GetCount() > 0 )
m_ctlIndustryList.DeleteString(0);
//
while (!q.eof())
{
int nIndex = m_ctlIndustryList.AddString(q.getStringField("name"));
m_ctlIndustryList.SetItemData(nIndex,q.getIntField("id"));
q.nextRow();
}
//
sSQL.Format("SELECT id,name FROM Sidings WHERE Locations_FK=%d;",iLocationID);
q = pDB->execQuery(sSQL);
//
while( m_ctlSidingList.GetCount() > 0 )
m_ctlSidingList.DeleteString(0);
//
while (!q.eof())
{
int nIndex = m_ctlSidingList.AddString(q.getStringField("name"));
m_ctlSidingList.SetItemData(nIndex,q.getIntField("id"));
q.nextRow();
}
q.finalize();
}
示例4: OnCmdDBLoadCharReq
BOOL CDBCmdHandler::OnCmdDBLoadCharReq( UINT16 wCommandID, UINT64 u64ConnID, CBufferHelper *pBufferHelper )
{
StDBLoadCharInfoReq DBLoadCharInfoReq;
pBufferHelper->Read(DBLoadCharInfoReq);
StDBLoadCharInfoAck DBLoadCharInfoAck;
DBLoadCharInfoAck.dwProxySvrID = DBLoadCharInfoReq.dwProxySvrID;
CBufferHelper WriteHelper(TRUE, &m_WriteBuffer);
WriteHelper.BeginWrite(CMD_DB_LOAD_CHAR_ACK, 0, DBLoadCharInfoReq.dwSceneID, DBLoadCharInfoReq.u64CharID);
WriteHelper.Write(DBLoadCharInfoAck);
CDBPlayerObject *pDBPlayer = m_DBPlayerMgr.GetPlayer(DBLoadCharInfoReq.u64CharID);
if(pDBPlayer == NULL)
{
//读取一条记录,
//读出成功
pDBPlayer = m_DBPlayerMgr.InsertAlloc(DBLoadCharInfoReq.u64CharID);
pDBPlayer->Init();
pDBPlayer->m_u64ObjectID = DBLoadCharInfoReq.u64CharID;
CHAR szSql[MAX_PATH];
sprintf(szSql, "select * from t_charinfo where F_CharID = '%lld'", DBLoadCharInfoReq.u64CharID);
CppSQLite3Query QueryRes = m_DBProcManager.m_DBConnection.execQuery(szSql);
if(!QueryRes.eof())
{
pDBPlayer->m_dwFeature = QueryRes.getIntField("F_Feature", 0);
strncpy(pDBPlayer->m_szObjectName, QueryRes.getStringField("F_Name", ""), 32);
pDBPlayer->m_dwLevel = QueryRes.getIntField("F_Level", 0);
}
//if(!pDBPlayer->LoadFromDB())
//{
// return TRUE;
//}
}
pDBPlayer->WriteToPacket(&WriteHelper);
WriteHelper.EndWrite();
CGameService::GetInstancePtr()->SendCmdToConnection(DBLoadCharInfoReq.dwGameSvrID, &m_WriteBuffer);
return TRUE;
}
示例5: LoadClientInfo
int CPersistencManager::LoadClientInfo(CI_VECTOR &client_list){
if(m_useLevelDB)
{
return 0;
}
int ret = 0;
int type = 0;
CppSQLite3Query query = m_SQLite3DB.execQuery("select * from Client");
while (!query.eof())
{
CClientInfo *pCI = new CClientInfo();
if (!pCI){
CLog::Log(LOG_LEVEL_ERROR,"Alloc object CClientInfo Error\n");
return -1;
}
type = query.getIntField("type");
if (type == COMPUTE_TYPE_CLIENT){
((CCompClient*)pCI)->m_gputhreads = query.getIntField("gpu");
((CCompClient*)pCI)->m_cputhreads = query.getIntField("cpu");
}
pCI->m_type = type;
memset(pCI->m_ip,0,sizeof(pCI->m_ip));
memset(pCI->m_guid,0,sizeof(pCI->m_guid));
memset(pCI->m_hostname,0,sizeof(pCI->m_hostname));
memset(pCI->m_osinfo,0,sizeof(pCI->m_osinfo));
memcpy(pCI->m_ip,query.fieldValue("ip"),strlen(query.fieldValue("ip")));
memcpy(pCI->m_hostname,query.fieldValue("hostname"),strlen(query.fieldValue("hostname")));
memcpy(pCI->m_osinfo,query.fieldValue("osinfo"),strlen(query.fieldValue("osinfo")));
//keeplive time and logintime
client_list.push_back(pCI);
query.nextRow();
}
return ret;
}
示例6: init
bool RPGMapSceneLayer::init(float showObjectTime)
{
if(RPGBaseSceneLayer::init())
{
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("joystick.plist");
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("main.plist");
//加载语言文件
string languageFile = CCFileUtils::sharedFileUtils()->fullPathForFilename("scene_map_cns.plist");
this->m_stringList = CCDictionary::createWithContentsOfFileThreadSafe(languageFile.c_str());
this->m_stringList->retain();
//数据库部分,读取进度记录
CppSQLite3Query query = this->m_db.execQuery(SAVEDATA_MAP_QUERY);
this->m_mapData.mapId = query.getIntField("map_id");
this->m_mapData.mapName = query.getStringField("map_name");
this->m_mapData.hasEnemy = query.getIntField("has_enemy") == 1 ? true : false;
this->m_mapData.bgAudio = query.getStringField("bg_audio");
this->m_mapData.playerToX = query.getFloatField("player_to_x");
this->m_mapData.playerToY = query.getFloatField("player_to_y");
this->m_mapData.playerDirection = query.getStringField("player_direction");
this->m_mapData.location = query.getStringField("location_cns");
this->m_mapData.gold = query.getIntField("gold");
query.finalize();
CCTMXTiledMap *bgMap = CCTMXTiledMap::create(this->m_mapData.mapName.c_str());
bgMap->setTag(kRPGMapSceneLayerTagBgMap);
bgMap->setPosition(ccp((CCDirector::sharedDirector()->getWinSize().width - bgMap->getContentSize().width) / 2.0, (CCDirector::sharedDirector()->getWinSize().height - bgMap->getContentSize().height) / 2.0));
this->addChild(bgMap);
//背景音乐
if(SimpleAudioEngine::sharedEngine()->isBackgroundMusicPlaying())
{
SimpleAudioEngine::sharedEngine()->stopBackgroundMusic(true);
SimpleAudioEngine::sharedEngine()->playBackgroundMusic(this->m_mapData.bgAudio.c_str(), true);
}
this->m_playerMoveAct = NULL;
this->m_playerMoveSpeed = GAME_PLAYER_MOVESPEED;
this->m_touchedDialogNPC = NULL;
this->m_dialogDirection = kRPGMapSceneLayerDialogDirectionNone;
this->m_hasEnemy = this->m_mapData.hasEnemy; //是否会遇敌
this->m_releaseTexture = false; //是否在释构方法里面释放占用纹理
this->scheduleOnce(schedule_selector(RPGMapSceneLayer::startPlay), showObjectTime);
// CCTextureCache::sharedTextureCache()->dumpCachedTextureInfo();
return true;
}
return false;
}
示例7: ERROR
EXPORT_C gint32 CContactDb::GetRecentContacts(GPtrArray ** pContacts)
{
char sql[64] = {0};
char times[20] = {0};
// time_t t;
// time(&t);
*pContacts = NULL;
*pContacts = g_ptr_array_new();
if (*pContacts == NULL)
{
return ERROR(ESide_Client, EModule_Db, ECode_No_Memory);
}
OpenDatabase();
strcpy(sql, "select * from recent_contact;");
CppSQLite3Query query = m_dbBeluga.execQuery(sql);
while (!query.eof())
{
stRecentContact * recentContact = (stRecentContact*)g_malloc0(sizeof(stRecentContact));
if (recentContact == NULL)
{
CloseDatabase();
return ERROR(ESide_Client, EModule_Db, ECode_No_Memory);
}
recentContact->nContactId = query.getIntField(1);
recentContact->event = (EContactEvent)query.getIntField(2);
strcpy(recentContact->eventCommInfo, query.getStringField(3));
strcpy(times, query.getStringField(4)); /* exp: 2009-6-30 21:51:23 */
//recentContact->time = localtime(&t);
GetLocalTime(&recentContact->time);
char * tmp = strrchr(times, '-');
recentContact->time.tm_mon = atoi(tmp+1);
tmp = strrchr(tmp, '-');
recentContact->time.tm_mday = atoi(tmp+1);
tmp = strrchr(tmp, ' ');
recentContact->time.tm_hour = atoi(tmp+1);
tmp = strrchr(tmp, ':');
recentContact->time.tm_min = atoi(tmp+1);
tmp = strrchr(tmp, ':');
recentContact->time.tm_sec = atoi(tmp+1);
g_ptr_array_add(*pContacts, recentContact);
query.nextRow();
}
CloseDatabase();
return 0;
}
示例8: EnterGroupID
BOOL CCP_MainApp::EnterGroupID(long lID)
{
BOOL bResult = FALSE;
if(m_GroupID == lID)
return TRUE;
// if we are switching to the parent, focus on the previous group
if(m_GroupParentID == lID && m_GroupID > 0)
m_FocusID = m_GroupID;
switch(lID)
{
case -1:
m_FocusID = -1;
m_GroupID = -1;
m_GroupParentID = -1;
m_GroupText = "History";
bResult = TRUE;
break;
default: // Normal Group
try
{
CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lParentID, mText, bIsGroup FROM Main WHERE lID = %d"), lID);
if(q.eof() == false)
{
if(q.getIntField(_T("bIsGroup")) > 0)
{
m_GroupID = lID;
m_GroupParentID = q.getIntField(_T("lParentID"));
// if( m_GroupParentID == 0 )
// m_GroupParentID = -1; // back out into "all top-level groups" list.
m_GroupText = q.getStringField(_T("mText"));
bResult = TRUE;
}
}
}
CATCH_SQLITE_EXCEPTION
break;
}
if(bResult)
{
theApp.RefreshView();
if(QPasteWnd())
QPasteWnd()->UpdateStatus(true);
}
return bResult;
}
示例9: RefreshCategories
void BudgetWindow::RefreshCategories(void)
{
fCategoryList->Clear();
fIncomeRow = new BRow();
fCategoryList->AddRow(fIncomeRow);
fSpendingRow = new BRow();
fCategoryList->AddRow(fSpendingRow);
fIncomeRow->SetField(new BStringField(TRANSLATE("Income")),0);
fSpendingRow->SetField(new BStringField(TRANSLATE("Spending")),0);
CppSQLite3Query query = gDatabase.DBQuery("select category,amount,period,isexpense from "
"budgetlist order by category",
"BudgetWindow::RefreshCategories");
float maxwidth=fCategoryList->StringWidth("Category");
while(!query.eof())
{
BString cat = DeescapeIllegalCharacters(query.getStringField(0));
Fixed amount;
amount.SetPremultiplied(query.getInt64Field(1));
BudgetPeriod period = (BudgetPeriod)query.getIntField(2);
BRow *row = new BRow();
if(query.getIntField(3)==0)
fCategoryList->AddRow(row,fIncomeRow);
else
fCategoryList->AddRow(row,fSpendingRow);
row->SetField(new BStringField(cat.String()),0);
BString amountstr;
gDefaultLocale.CurrencyToString(amount.AbsoluteValue(),amountstr);
amountstr.Truncate(amountstr.FindFirst(gDefaultLocale.CurrencyDecimal()));
amountstr.RemoveFirst(gDefaultLocale.CurrencySymbol());
row->SetField(new BStringField(amountstr.String()),1);
float tempwidth = fCategoryList->StringWidth(cat.String());
maxwidth = MAX(tempwidth,maxwidth);
row->SetField(new BStringField(BudgetPeriodToString(period).String()),2);
query.nextRow();
}
fCategoryList->ColumnAt(0)->SetWidth(maxwidth+30);
fCategoryList->ExpandOrCollapse(fIncomeRow,true);
fCategoryList->ExpandOrCollapse(fSpendingRow,true);
}
示例10: PastCopyBuffer
bool CDittoCopyBuffer::PastCopyBuffer(long lCopyBuffer)
{
//Can't paste while another is still active
if(WaitForSingleObject(m_Pasting, 1) == WAIT_TIMEOUT)
{
Log(_T("Copy Buffer pasted to fast"));
return false;
}
m_RestoreTimer.ResetEvent();
m_Pasting.ResetEvent();
bool bRet = false;
Log(StrF(_T("Start - PastCopyBuffer buffer = %d"), m_lCurrentDittoBuffer));
try
{
CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT Main.lID FROM Main ")
_T("INNER JOIN CopyBuffers ON CopyBuffers.lClipID = Main.lID ")
_T("WHERE CopyBuffers.lCopyBuffer = %d"), lCopyBuffer);
if(q.eof() == false)
{
m_pClipboard = new CClipboardSaveRestoreCopyBuffer;
if(m_pClipboard)
{
//Save the clipboard,
//then put the new data on the clipboard
//then send a paste
//then wait a little and restore the original clipboard data
if(m_pClipboard->Save())
{
CProcessPaste paste;
paste.m_bSendPaste = true;
paste.m_bActivateTarget = false;
paste.GetClipIDs().Add(q.getIntField(_T("lID")));
paste.DoPaste();
m_pClipboard->m_lRestoreDelay = g_Opt.GetDittoRestoreClipboardDelay();
Log(StrF(_T("PastCopyBuffer sent paste, starting thread to restore clipboard, Delay = %d"), m_pClipboard->m_lRestoreDelay));
AfxBeginThread(CDittoCopyBuffer::DelayRestoreClipboard, (LPVOID)this, THREAD_PRIORITY_LOWEST);
bRet = true;
}
else
{
Log(_T("PastCopyBuffer failed to save clipboard"));
}
}
}
}
CATCH_SQLITE_EXCEPTION
if(bRet == false)
m_Pasting.SetEvent();
return bRet;
}
示例11: getFirstFile
int CDBObject::getFirstFile(char* name)
{
try
{
if(name != NULL)
{
char szSql[]= {"SELECT * from Record"};
CppSQLite3DB database;
database.open(g_szFile);
CppSQLite3Query query = database.execQuery(szSql);
if(!query.eof())
{
string path = query.getStringField(8);
string file= query.getStringField(7);
sprintf(name, "%s\\%s", UTF_82ASCII(path).c_str(), UTF_82ASCII(file).c_str());
return query.getIntField(0);
}
}
}
catch(...)
{
g_pLog->WriteLog("数据库查询异常 getFirstFile\n");
}
return -1;
}
示例12: SQLToStyleDataArray
bool CWizIndexBase::SQLToStyleDataArray(const CString& strSQL, CWizStyleDataArray& arrayStyle)
{
try
{
CppSQLite3Query query = m_db.execQuery(strSQL);
while (!query.eof())
{
WIZSTYLEDATA data;
data.strKbGUID = kbGUID();
data.strGUID = query.getStringField(styleSTYLE_GUID);
data.strName = query.getStringField(styleSTYLE_NAME);
data.strDescription = query.getStringField(styleSTYLE_DESCRIPTION);
data.crTextColor = query.getColorField(styleSTYLE_TEXT_COLOR);
data.crBackColor = query.getColorField(styleSTYLE_BACK_COLOR);
data.bTextBold = query.getBoolField(styleSTYLE_TEXT_BOLD);
data.nFlagIndex = query.getIntField(styleSTYLE_FLAG_INDEX);
data.tModified = query.getTimeField(styleDT_MODIFIED);
data.nVersion = query.getInt64Field(styleVersion);
arrayStyle.push_back(data);
query.nextRow();
}
std::sort(arrayStyle.begin(), arrayStyle.end());
return true;
}
catch (const CppSQLite3Exception& e)
{
return LogSQLException(e, strSQL);
}
}
示例13: IsExistProjectName
//void CDlgProjectNew::OnBnClickedButtonCancel()
//{
// // TODO: 在此添加控件通知处理程序代码
// m_bIsSave=false;
// OnOK();
//}
bool CDlgProjectNew::IsExistProjectName(CString strProjectName)//该产品名称是否存在库存表中 true 存在 false 不存在
{
CString strSQL;
strSQL.Format(_T("select count(ProjectName) as COUNTProjectName from Project where ProjectName='%s';"), strProjectName);
int nCount=0;
try
{
CppSQLite3DB db;
db.open(CBoBoDingApp::g_strDatabasePath);
CppSQLite3Query q = db.execQuery(strSQL);//销售单历史表
if (!q.eof())
{
//nCount=q.fieldValue(_T("COUNTPinMingGuiGe"));
nCount=q.getIntField(_T("COUNTProjectName"));
}
}
catch (CppSQLite3Exception& e)
{
AfxMessageBox(e.errorMessage());
}
if(nCount>0)
return true;
else
return false;
}
示例14: ImportFromSqliteDB
//##ModelId=474D307602CF
bool CClip_ImportExport::ImportFromSqliteDB(CppSQLite3DB &db, bool bAddToDB, bool bPutOnClipboard)
{
bool bRet = false;
CStringA csCF_TEXT;
CStringW csCF_UNICODETEXT;
try
{
CppSQLite3Query q = db.execQuery(_T("Select * from Main"));
while(q.eof() == false)
{
Clear();
int nVersion = q.getIntField(_T("lVersion"));
if(nVersion == 1)
{
if(ImportFromSqliteV1(db, q))
{
if(bAddToDB)
{
MakeLatestTime();
AddToDB(true);
bRet = true;
}
else if(bPutOnClipboard)
{
bRet = true;
}
}
}
m_lImportCount++;
//If putting on the clipboard and there are multiple
//then append cf_text and cf_unicodetext
if(bPutOnClipboard)
{
Append_CF_TEXT_AND_CF_UNICODETEXT(csCF_TEXT, csCF_UNICODETEXT);
}
q.nextRow();
}
if(bRet && bAddToDB)
{
theApp.RefreshView();
}
else if(bRet && m_lImportCount == 1 && bPutOnClipboard)
{
PlaceFormatsOnclipboard();
}
else if(bRet && bPutOnClipboard)
{
PlaceCF_TEXT_AND_CF_UNICODETEXT_OnClipboard(csCF_TEXT, csCF_UNICODETEXT);
}
}
CATCH_SQLITE_EXCEPTION_AND_RETURN(false)
return bRet;
}
示例15: OnInitDialog
BOOL CCarTypesDetailDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if( m_iCarTypeFK != -1 )
{
CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
CString sSQL;
sSQL.Format("SELECT * FROM CarTypes WHERE id=%d",m_iCarTypeFK);
CppSQLite3Query q = pDB->execQuery((LPCTSTR)sSQL);
if( !q.eof() )
{
m_sCarTypeDescription = q.getStringField("description");
m_sCarTypeID = q.getStringField("type_id");
m_bPassenger = q.getIntField("passenger")==1?TRUE:FALSE;
}
q.finalize();
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}