本文整理汇总了C++中CppSQLite3Query::fieldValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CppSQLite3Query::fieldValue方法的具体用法?C++ CppSQLite3Query::fieldValue怎么用?C++ CppSQLite3Query::fieldValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CppSQLite3Query
的用法示例。
在下文中一共展示了CppSQLite3Query::fieldValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseDataField
void DClusterNotifyDataSource::parseDataField(CppSQLite3Query &src, DClusterNotifyDataField &dest)
{
dest.accountID = atoll(src.fieldValue(0));
dest.notifyType = atoll(src.fieldValue(1));
dest.userID = atoll(src.fieldValue(2));
dest.userName = src.fieldValue(3);
dest.clusterID = atoll(src.fieldValue(4));
dest.clusterName = src.fieldValue(5);
dest.notifyContent = src.fieldValue(6);
dest.notifyVerify = src.fieldValue(7);
dest.notifyTime = src.fieldValue(8);
dest.status = atoi(src.fieldValue(9));
}
示例2: ERROR
EXPORT_C gint32 CContactDb::GetEntityById(guint32 nId, CDbEntity** ppEntity)
{
char sql[128] = {0};
*ppEntity = NULL;
OpenDatabase();
sprintf(sql, "select * from contact where cid = %d;", nId);
CppSQLite3Query query = m_dbBeluga.execQuery(sql);
if (query.eof())
{
CloseDatabase();
return ERROR(ESide_Client, EModule_Db, ECode_Not_Exist);
}
if (ContactType_Phone == query.getIntField(ContactField_Type))
*ppEntity = new CPhoneContact(this, FALSE);
else
*ppEntity = new CIMContact(this);
if (NULL == *ppEntity)
{
CloseDatabase();
return ERROR(ESide_Client, EModule_Db, ECode_No_Memory);
}
for (int i=0; i<query.numFields(); i++)
{
GString * fieldValue = g_string_new(query.fieldValue(i));
(*ppEntity)->SetFieldValue(i, fieldValue);
g_string_free(fieldValue, TRUE);
}
CloseDatabase();
return 0;
}
示例3: LoadReadyTaskQueue
//必须在加载任务列表之后
int CPersistencManager::LoadReadyTaskQueue(CT_DEQUE &ready_list,const CT_MAP& task_map){
if(m_useLevelDB)
{
string value;
leveldb::ReadOptions ro;
leveldb::Status s;
int ready_count = 0;
s = m_LevelDB->Get(ro, TASK_RUN_COUNT, &value);
if(s.ok())
ready_count = *(int*)value.data();
CLog::Log(LOG_LEVEL_DEBUG, "LoadReadyTaskQueue: count=%d\n", ready_count);
for(int i = 0; i < ready_count; i++)
{
s = m_LevelDB->Get(ro, TASK_IDX(TASK_RUN_KEY, i), &value);
if(s.ok())
{
if(task_map.find((char*)value.c_str()) == task_map.end()){
CLog::Log(LOG_LEVEL_WARNING, "Task List and Ready Task List is not Matched\n");
continue;
}
ready_list.push_back(value);
CLog::Log(LOG_LEVEL_DEBUG, "Ready task %d:%s\n", i, value.c_str());
}
}
return 0;
}
int ret = 0;
CT_MAP::const_iterator cur_iter ;
CT_MAP::const_iterator end_iter = task_map.end();
CppSQLite3Query query = m_SQLite3DB.execQuery("select * from ReadyTask");
while (!query.eof())
{
cur_iter = task_map.find((char *)query.fieldValue("taskid"));
if (cur_iter == end_iter){
CLog::Log(LOG_LEVEL_ERROR,"Task List and Ready Task List is not Matched\n");
query.nextRow();
continue;
}
ready_list.push_back(cur_iter->first);
query.nextRow();
}
return ret;
}
示例4: CreateInfoByid
char* CreateInfoByid(int id)
{
static char buffer[1024]={0};
static char querybuf[1024]={0};
char* str = "%s 体力%s 武力%s 智力%s 魅力%s 年龄%s 类型 %s";
memset(querybuf,0,1024);
try
{ db.open("database/infodata.db");
sprintf(querybuf,"select heroinfo.name,ti,wu,zhi,mei,age,herotype.name from "
" heroinfo,herotype where heroinfo.id=%d and heroinfo.type=herotype.id;",id);
CppSQLite3Query q = db.execQuery(querybuf);
//nge_charsets_utf8_to_gbk((uint8*)str, (uint8*)querybuf, strlen(str), 1024);
if (!q.eof())
{
sprintf(buffer,str, q.fieldValue(0),q.fieldValue(1),q.fieldValue(2),q.fieldValue(3),
q.fieldValue(4),q.fieldValue(5),q.fieldValue(6));
}
db.close();
}catch (CppSQLite3Exception& e){
printf("%s\n",e.errorMessage());
}
return buffer;
}
示例5: _tstoi
int CppSQLite3DB::execScalar(LPCTSTR szSQL)
{
CppSQLite3Query q = execQuery(szSQL);
if (q.eof() || q.numFields() < 1)
throw CppSQLite3Exception(CPPSQLITE_ERROR, _T("Invalid scalar query"), DONT_DELETE_MSG);
return _tstoi(q.fieldValue(0));
}
示例6: OnInitDialog
BOOL CDlgMemoAdd::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: 在此添加额外的初始化
//SetBackgroundColor(DialogSubBackgroundColor,TRUE);
m_DateTime_ctlTime.SetFormat(_T("yyyy-MM-dd HH:mm"));
SetBackgroundColor(DialogSubBackgroundColor,TRUE);
m_Button_ctlSave.LoadStdImage(IDB_PNG_SAVE, _T("PNG"));
m_Button_ctlCancel.LoadStdImage(IDB_PNG_CANCEL, _T("PNG"));
m_Static_ctl1.SetBackgroundColor(DialogSubBackgroundColor,TRUE);
//m_Static_ctl1.SetTextColor(StaticCaptionColor,TRUE);
m_Static_ctl2.SetBackgroundColor(DialogSubBackgroundColor,TRUE);
//m_Static_ctl2.SetTextColor(StaticCaptionColor,TRUE);
m_Static_ctl3.SetBackgroundColor(DialogSubBackgroundColor,TRUE);
//m_Static_ctl3.SetTextColor(StaticCaptionColor,TRUE);
m_Static_ctl4.SetBackgroundColor(DialogSubBackgroundColor,TRUE);
//m_Static_ctl4.SetTextColor(StaticCaptionColor,TRUE);*/
/*m_Static_ctl5.SetBackgroundColor(DialogSubBackgroundColor,TRUE);
m_Static_ctl5.SetTextColor(StaticCaptionColor,TRUE);*/
try{
CppSQLite3DB db;
db.open(CBoBoDingApp::g_strDatabasePath);
CString strSQL=_T("select distinct * from CategoryMemo order by ID asc;");
CppSQLite3Query q = db.execQuery(strSQL);
CString strCategoryName;
while(!q.eof())
{
strCategoryName=(q.fieldValue(_T("CategoryName")));
if (strCategoryName.Compare(_T("+"))!=0)
{
m_Combo_ctlCategory.AddString(strCategoryName);
}
q.nextRow();
}
}
catch (CppSQLite3Exception& e)
{
//AfxMessageBox(e.errorMessage());
}
m_Combo_ctlCategory.SetCurSel(0);
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
示例7: if
// 获取父结点为nParentId的所有结点的数目
int FireFox3PlugIn::GetFavoriteCount(int nParentId)
{
int nCount = 0;
wstring strSql = L"select count(*) as total from moz_bookmarks where parent = " ;
strSql += StringHelper::ANSIToUnicode(StringHelper::ConvertFromInt(nParentId));
if( nParentId == BOOKMARKS_MENU)
{
strSql += BOOKMARKS_MENU_EXCLUED_SQL;
}
else if ( nParentId == BOOKMARKS_TOOLSBAR)
{
strSql += BOOKMARKS_TOOLSBAR_EXCLUED_SQL;
}
CppSQLite3Query Query = m_pSqliteDatabase->execQuery(StringHelper::UnicodeToUtf8(strSql).c_str());
const char* pTotal = Query.fieldValue("total");
nCount = StringHelper::ConvertToInt(Query.fieldValue("total"));
strSql = L"select * from moz_bookmarks where parent = " ;
strSql += StringHelper::ANSIToUnicode(StringHelper::ConvertFromInt(nParentId));
if( nParentId == BOOKMARKS_MENU)
{
strSql += BOOKMARKS_MENU_EXCLUED_SQL;
}
else if ( nParentId == BOOKMARKS_TOOLSBAR)
{
strSql += BOOKMARKS_TOOLSBAR_EXCLUED_SQL;
}
Query = m_pSqliteDatabase->execQuery(StringHelper::UnicodeToUtf8(strSql).c_str());
while(!Query.eof())
{
int nId = Query.getIntField("id", 0);
nCount += GetFavoriteCount(nId);
Query.nextRow();
}
return nCount;
}
示例8: UpdateMenuList
void COrderManagerDlg::UpdateMenuList()
{
CListCtrl* MenuList = (CListCtrl*)this->GetDlgItem(IDC_LIST_ORDERMGR_MENUS);
char szQuery[1024] = { 0 };
int index = 0;
MenuList->DeleteAllItems();
sprintf_s(szQuery, "select menu_name,menu_price from tblMenu order by menu_name");
CppSQLite3Query data = g_SqlMgr.execQuery(szQuery);
while (!data.eof())
{
index = MenuList->GetItemCount();
MenuList->InsertItem(index, data.fieldValue(0));
MenuList->SetItemText(index, 1, data.fieldValue(1));
data.nextRow();
}
UpdateData(FALSE);
}
示例9: atoi
int CppSQLite3DB::execScalar(const CString& strSQL)
{
CppSQLite3Query q = execQuery(strSQL);
if (q.eof() || q.numFields() < 1)
{
throw CppSQLite3Exception(CPPSQLITE_ERROR, "Invalid scalar query");
}
return atoi(q.fieldValue(0));
}
示例10: atoi
int CppSQLite3DB::execScalar(const char* szSQL)
{
CppSQLite3Query q = execQuery(szSQL);
if (q.eof() || q.numFields() < 1)
{
IwError(("Invalid scalar query"));
}
return atoi(q.fieldValue(0));
}
示例11: ReadDB
void CLocationDialog::ReadDB()
{
m_ctlLocationList.DeleteAllItems();
//
// Read data
//
CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
CppSQLite3Query q = pDB->execQuery("select id,name from Locations;");
//
while (!q.eof())
{
TRACE("%s %s\n",q.fieldValue(0),q.fieldValue(1));
int nIndex = m_ctlLocationList.InsertItem(1,q.fieldValue(1));
m_ctlLocationList.SetItemData(nIndex,atoi(q.fieldValue(0)));
q.nextRow();
}
q.finalize();
m_ctlEditButton.EnableWindow(FALSE);
m_ctlDeleteButton.EnableWindow(FALSE);
}
示例12: ATOI
int CppSQLite3DB::execScalar(const TCHAR* szSQL)
{
CppSQLite3Query q = execQuery(szSQL);
if (q.eof() || q.numFields() < 1)
{
throw CppSQLite3Exception(CPPSQLITE_ERROR,
_T("Invalid scalar query"),
DONT_DELETE_MSG);
}
return ATOI(q.fieldValue(0));
}
示例13: atoi
int CppSQLite3DB::execScalar(const char* szSQL)
{
CppSQLite3Query q = execQuery(szSQL);
if (q.eof() || q.numFields() < 1)
{
// throw CppSQLite3Exception(CPPSQLITE_ERROR,
// "Invalid scalar query",
// DONT_DELETE_MSG);
}
return atoi(q.fieldValue(0));
}
示例14: ShowPage
void CDlgEventList::ShowPage(int nPageIndex)
{
CString str;
int i = 0;
int nStartIndex = 0;
int nOffset = 0;
CppSQLite3DB db;
db.open(PATH_SQLITE_DB_808); //打开数据库
//查询记录总数量
m_nRecordCount = db.execScalar("SELECT count(*) FROM event_info;");
//计算总页数
if(m_nRecordCount > 0)
m_nPageCount = (m_nRecordCount-1)/elist_count+1;
else
m_nPageCount = 1;
//在数据库中查询第nPageIndex页的elist_count条数据
char szSqlBuffer[512];
sprintf(szSqlBuffer, "SELECT * FROM event_info ORDER BY event_ID DESC LIMIT %d, %d;", nPageIndex*elist_count, elist_count);
CppSQLite3Query q = db.execQuery(szSqlBuffer);
for( i = 0; i < elist_count; i++ )
{
if ( !q.eof() ) //数据行
{
m_nEvent_ID[i] = q.getIntField("event_ID");
m_list[i].chChar = q.fieldValue("event_content");
m_list[i].nState = BTN_STATE_NORMAL;
q.nextRow();
}
else //空白行
{
m_ItemState[i] = 0;
m_list[i].chChar = _T("");
m_list[i].nState = BTN_STATE_DISABLE;
}
}
//释放statement
q.finalize();
db.close(); //关闭数据库
return;
}
示例15: 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;
}