本文整理汇总了C++中CppSQLite3Query::getStringField方法的典型用法代码示例。如果您正苦于以下问题:C++ CppSQLite3Query::getStringField方法的具体用法?C++ CppSQLite3Query::getStringField怎么用?C++ CppSQLite3Query::getStringField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CppSQLite3Query
的用法示例。
在下文中一共展示了CppSQLite3Query::getStringField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SQLToBizUserDataArray
bool CWizIndexBase::SQLToBizUserDataArray(const QString& strSQL,
CWizBizUserDataArray& arrayUser)
{
try
{
CppSQLite3Query query = m_db.execQuery(strSQL);
while (!query.eof())
{
WIZBIZUSER data;
data.bizGUID = query.getStringField(userBIZ_GUID);
data.userId = query.getStringField(userUSER_ID);
data.userGUID = query.getStringField(userUSER_GUID);
data.alias = query.getStringField(userUSER_ALIAS);
data.pinyin = query.getStringField(userUSER_PINYIN);
arrayUser.push_back(data);
query.nextRow();
}
return true;
}
catch (const CppSQLite3Exception& e)
{
return LogSQLException(e, strSQL);
}
}
示例2: 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);
}
}
示例3:
vector<lip> limitIP::GetIPList()
{
vector<lip> lips;
__try
{
CppSQLite3Query query = m_pDB.execQuery(_T("SELECT IP,Remark FROM IPfliter"));
while (!query.eof())
{
lip l;
l.szIP = query.getStringField(_T("IP"));
l.remark = query.getStringField(_T("Remark"));
lips.push_back(l);
query.nextRow();
}
return lips;
}
__except (Global::MyUnhandledExceptionFilter(GetExceptionInformation()))
{
return lips;
}
}
示例4: 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();
}
示例5: 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;
}
示例6: OnInitDialog
BOOL CLocationDetailDialog::OnInitDialog()
{
CDialog::OnInitDialog();
if( m_iLocationID == -1 )
m_ctlOK.EnableWindow(FALSE);
else
{
CString sSQL;
sSQL.Format("SELECT name,notes FROM Locations WHERE id=%d;",m_iLocationID);
CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
CppSQLite3Query q = pDB->execQuery(sSQL);
//
if (!q.eof())
{
m_sLocationName = q.getStringField("name");
m_sLocalInstructions = q.getStringField("notes");
}
q.finalize();
UpdateData(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例7: 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
}
示例8: SQLToTagDataArray
bool CWizIndexBase::SQLToTagDataArray(const CString& strSQL, CWizTagDataArray& arrayTag)
{
try
{
CppSQLite3Query query = m_db.execQuery(strSQL);
while (!query.eof())
{
WIZTAGDATA data;
data.strKbGUID = kbGUID();
data.strGUID = query.getStringField(tagTAG_GUID);
data.strParentGUID = query.getStringField(tagTAG_GROUP_GUID);
data.strName = query.getStringField(tagTAG_NAME);
data.strDescription = query.getStringField(tagTAG_DESCRIPTION);
data.tModified = query.getTimeField(tagDT_MODIFIED);
data.nVersion = query.getInt64Field(tagVersion);
arrayTag.push_back(data);
query.nextRow();
}
std::sort(arrayTag.begin(), arrayTag.end());
return true;
}
catch (const CppSQLite3Exception& e)
{
return LogSQLException(e, strSQL);
}
}
示例9: Load
bool CSpace::Load(int64 ParentID,int64 ChildID){
m_ID = ParentID;
char ParentName[30], ChildName[30];
int64toa(ParentID,ParentName);
int64toa(ChildID,ChildName);
CppSQLite3Buffer SQL;
SQL.format("select * from \"%s\" where %s = \"%s\" ",
ParentName,
ITEM_ID,
ChildName
);
CppSQLite3Query Result = GetWorldDB().execQuery(SQL);
if(Result.eof()){
return false;
}
assert(Size()>5);
assert(GetDataType(0) == TYPE_INT);
int64& OldID = *(int64*)GetData(0);
OldID = ChildID;
AnsiString AnsiName = Result.getStringField(1,"");
tstring Name = UTF8toWS(AnsiName);
SetName(Name);
SPACETYPE Type = (SPACETYPE)Result.getIntField(2);
SetSpaceType(Type);
AnsiString Fingerprint = Result.getStringField(3);
tstring Fingerprint1 = UTF8toWS(Fingerprint);
SetFingerprint(Fingerprint1);
AnsiString AnsiProperty = Result.getStringField(4,"");
ePipeline Property;
uint32 pos =0;
bool ret = Property.FromString(AnsiProperty,pos);
if(!ret){
return false;
}
SetProerty(Property);
AnsiString AnsiOwner = Result.getStringField(5,"");
ePipeline OwnerInfo;
pos=0;
ret = OwnerInfo.FromString(AnsiOwner,pos);
if(!ret){
return false;
}
SetOwnerInfo(OwnerInfo);
return true;
}
示例10: 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;
}
示例11: 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;
}
示例12: GetValue
bool DBSetting::GetValue(long lKey,std::string &strValue)
{
//打开数据库
CppSQLite3DB dbTask;
dbTask.open(m_strDB.c_str());
CheckCreateSettingTable(dbTask);
CppSQLite3Buffer strSql;
try{
strSql.format("select value from T_Setting where key=%d;",lKey);
CppSQLite3Query q = dbTask.execQuery(strSql);
if (q.eof())
{
return false;
}
strValue = q.getStringField(0);
}
catch(CppSQLite3Exception &exp)
{
exp;
ATLTRACE("error:%s\n",exp.errorMessage());
ATLASSERT(FALSE);
return false;
}
return true;
}
示例13: GetGrupos
//Método que monta as tab do Tab Control
void CRcGen::GetGrupos(WPARAM wParam, CStringArray& arrayGrp)
{
CStringA sQuery;
sQuery.Format("select distinct res.grupo, resgrupo.descricao from res, resgrupo where res.grupo = resgrupo.grupo and res.pagina between %d and %d", LOWORD(wParam), HIWORD(wParam));
try
{
CppSQLite3Query q = CppSQLite3DB::getInstance()->execQuery(sQuery);
if(!q.eof())
{
m_nGrupo = q.getIntField(0);
m_nGrupoInicial = m_nGrupo;
}
while(!q.eof())
{
arrayGrp.Add(CString(q.getStringField(1)));
q.nextRow();
}
}
catch(CppSQLite3Exception e)
{
}
}
示例14: 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();
}
示例15: 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;
}