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


C++ CppSQLite3Query类代码示例

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


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

示例1: atoi

void CIndustryDetailDialog_Commodities::Save()
{
    CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
    //
    for( int i=0;i<m_ctlCommodityListIn.GetItemCount();i++ )
    {
        if( m_ctlCommodityListIn.GetCheck(i) )
        {
            int iCommodityFK = m_ctlCommodityListIn.GetItemData(i);
            int iLoadEmpty = atoi(m_ctlCommodityListIn.GetItemText(i,1));
            int iQuanHigh = atoi(m_ctlCommodityListIn.GetItemText(i,2));
            int iQuanLow = atoi(m_ctlCommodityListIn.GetItemText(i,3));
            int iPercent = atoi(m_ctlCommodityListIn.GetItemText(i,4));
            CString sSQL;
            sSQL.Format("INSERT INTO Industries_Commodities (Industries_FK,Commodities_FK,InOut,LoadEmptyDays,Quantity_low,Quantity_high,Quantity_percentage) VALUES (%d,%d,0,%d,%d,%d,%d);",m_iIndustryID,iCommodityFK,iLoadEmpty,iQuanLow,iQuanHigh,iPercent);
            CppSQLite3Query q = pDB->execQuery(sSQL);
            q.finalize();
        }
    }
    for( i=0;i<m_ctlCommodityListOut.GetItemCount();i++ )
    {
        if( m_ctlCommodityListOut.GetCheck(i) )
        {
            int iCommodityFK = m_ctlCommodityListOut.GetItemData(i);
            int iLoadEmpty = atoi(m_ctlCommodityListOut.GetItemText(i,1));
            int iQuanHigh = atoi(m_ctlCommodityListOut.GetItemText(i,2));
            int iQuanLow = atoi(m_ctlCommodityListOut.GetItemText(i,3));
            int iPercent = atoi(m_ctlCommodityListOut.GetItemText(i,4));
            CString sSQL;
            sSQL.Format("INSERT INTO Industries_Commodities (Industries_FK,Commodities_FK,InOut,LoadEmptyDays,Quantity_low,Quantity_high,Quantity_percentage) VALUES (%d,%d,1,%d,%d,%d,%d);",m_iIndustryID,iCommodityFK,iLoadEmpty,iQuanLow,iQuanHigh,iPercent);
            CppSQLite3Query q = pDB->execQuery(sSQL);
            q.finalize();
        }
    }
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:35,代码来源:IndustryDetailDialog_Commodities.cpp

示例2: UpdateData

void CCarTypesDetailDialog::OnOK() 
{
	// TODO: Add extra validation here

    UpdateData();
    //
    CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
    CString sSQL;
    //
    //  add?
    //
    if( m_iCarTypeFK == -1 )
    {
        sSQL.Format("SELECT 1 FROM CarTypes WHERE type_id=\"%s\"",m_sCarTypeID);
        CppSQLite3Query q = pDB->execQuery((LPCTSTR)sSQL);
        //
        if(!q.eof())
        {
            MessageBox("Duplcate Type ID!","LSC TrainOps Error",MB_ICONSTOP|MB_OK);
            return;
        }
        sSQL.Format("INSERT INTO CarTypes (id,type_id,description,active,passenger) VALUES (NULL,\"%s\",\"%s\",1,%d)",m_sCarTypeID,m_sCarTypeDescription,m_bPassenger?1:0);
    }
    else
    {
        sSQL.Format("UPDATE CarTypes SET type_id=\"%s\",description=\"%s\",passenger=%d WHERE id=%d",m_sCarTypeID,m_sCarTypeDescription,m_bPassenger?1:0,m_iCarTypeFK);
    }
    pDB->execDML((LPCTSTR)sSQL);
    
	CDialog::OnOK();
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:31,代码来源:CarTypesDetailDialog.cpp

示例3: 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
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:25,代码来源:LocationDetailDialog.cpp

示例4: LoadTypesFromDB

// Allocates a new CClipTypes
CClipTypes* CCP_MainApp::LoadTypesFromDB()
{
	CClipTypes* pTypes = new CClipTypes;

	try
	{
		CppSQLite3Query q = theApp.m_db.execQuery(_T("SELECT TypeText FROM Types"));			
		while(q.eof() == false)
		{
			pTypes->Add(GetFormatID(q.getStringField(_T("TypeText"))));

			q.nextRow();
		}
	}
	CATCH_SQLITE_EXCEPTION

	if(pTypes->GetSize() <= 0)
	{
		pTypes->Add(CF_TEXT);
		pTypes->Add(RegisterClipboardFormat(CF_RTF));
		pTypes->Add(CF_UNICODETEXT);
		pTypes->Add(CF_HDROP);

		if(g_Opt.m_bU3 == false)
		{
			pTypes->Add(CF_DIB);
		}
	}

	return pTypes;
}
开发者ID:arefinsaaad,项目名称:kupl09,代码行数:32,代码来源:CP_Main.cpp

示例5: TASK_IDX

//必须在加载任务列表之后
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;

}
开发者ID:trimpsyw,项目名称:crack,代码行数:61,代码来源:PersistencManager.cpp

示例6: memset

BOOL FireFox3PlugIn::ExportFavoriteData( PFAVORITELINEDATA* ppData, int32& nDataNum )
{
	memset(ppData,0x0, nDataNum*sizeof(PFAVORITELINEDATA));

	if (ppData == NULL || *ppData == NULL || nDataNum == 0)
	{
		return FALSE;
	}

	string strSql = "select marks.* from moz_bookmarks as marks where marks.id in (2,3,4,5)";
	CppSQLite3Query Query = m_pSqliteDatabase->execQuery(strSql.c_str());

	// 当前插入的位置
	int nCurrentIndex = 0;
	while(!Query.eof())
	{
		int nId = Query.getIntField("id", 0);
		ExportFavoriteData(nId,ppData,nCurrentIndex);

		Query.nextRow();
	}

	nDataNum = nCurrentIndex;

	return TRUE;
}
开发者ID:pyq881120,项目名称:urltraveler,代码行数:26,代码来源:FireFox3PlugIn.cpp

示例7: GetCapacityInfo

int CStorageUnitInfoTable::GetCapacityInfo(const char* buf, sCapacityInfo *pInfo)
{
    if(!m_pDB) 
    {
        cout<<"Invalid Sqlite"<<endl;
        return -1;
    }    

    try
    {
        CppSQLite3Query q = m_pDB->execQuery(buf);
        if(!q.eof())
        {
            pInfo->m_sumCap = q.getInt64Field("sumCapacity");
            pInfo->m_declaredCap = q.getInt64Field("declaredCapacity");
            pInfo->m_usedCap = q.getInt64Field("usedCapacity");
        }
        else
           return -1; 

    }

    catch(CppSQLite3Exception e)
    {
        cerr<<"CStorageUnitInfoTable::GetCapacityInfo:"<<e.errorCode()<<" "<<e.errorMessage()<<endl;
    }

    return 0;
}
开发者ID:guozhenhong,项目名称:ControlServer,代码行数:29,代码来源:CStorageUnitInfoTable.cpp

示例8: memset

int CStorageUnitInfoTable::GetSysCapacityInfo(sCapacityInfo *pInfo)
{
    char buf[MAX_BUF_LEN];
    memset(buf, 0, MAX_BUF_LEN);
    sprintf(buf, "select sum(sumCapacity), sum(declaredCapacity), sum(usedCapacity) from %s", m_strTableName.c_str());
    if(!m_pDB) 
    {
        cout<<"Invalid Sqlite"<<endl;
        return -1;
    }    

    try
    {
        CppSQLite3Query q = m_pDB->execQuery(buf);
        if(!q.eof())
        {
            pInfo->m_sumCap = q.getInt64Field(0);
            pInfo->m_declaredCap = q.getInt64Field(1);
            pInfo->m_usedCap = q.getInt64Field(2);
        }
        else
           return -1; 

    }

    catch(CppSQLite3Exception e)
    {
        cerr<<"CStorageUnitInfoTable::GetSysCapacityInfo:"<<e.errorCode()<<" "<<e.errorMessage()<<endl;
    }


    return 0;
}
开发者ID:guozhenhong,项目名称:ControlServer,代码行数:33,代码来源:CStorageUnitInfoTable.cpp

示例9: ToRBrain

/*
int32 CBrainMemory::GetAllMeaning(int64 ID, map<int64,int64> 
&MeaningList){

	   CppSQLite3Buffer SQL;
	   CppSQLite3Query  Result;
       char a[30];
	   char b[30];
      
       MeaningList.clear();
	
//	   if(!RBrainHasTable(ID))return 0;
	   
	   ToRBrain(ID);
	   SQL.format("select %s, %s  from \"%s\" where %s=\"%s\" ;",
						RB_SPACE_ID,
		                RB_SPACE_VALUE,
			            _i64toa(ID,a,10),
						RB_SPACE_TYPE,
						_i64toa(MEMORY_TYPE_MEANING,b,10)                  
						);
	   Result = BrainDB.execQuery(SQL);
       
	   while(!Result.eof())
	   {
          MeaningList[Result.getInt64Field(1)] = Result.getInt64Field(0);
		  Result.nextRow();
	   }
	   return MeaningList.size();
}
*/	
int32 CBrainMemory::GetAllMeaningRoomID(int64 ID, deque<int64>& MeaningRoomIDList){
	   CppSQLite3Buffer SQL;
	   CppSQLite3Query  Result;
       char a[30],b[30];      
       MeaningRoomIDList.clear();
	
//	   if(!RBrainHasTable(ID))return 0;
	   
	   ToRBrain(ID);

	   int64toa(ID,a);
	   int64toa(MEMORY_BODY,b);
	   SQL.format("select %s  from \"%s\" where %s > \"%s\";",
						RB_SPACE_ID,
			            a, 
						RB_SPACE_TYPE,
						b                   
						);
	   Result = BrainDB.execQuery(SQL);
       
	   while(!Result.eof())
	   {
          MeaningRoomIDList.push_back(Result.getInt64Field(0));
		  Result.nextRow();
	   }
	   return MeaningRoomIDList.size();
}
开发者ID:GMIS,项目名称:GMIS,代码行数:58,代码来源:BrainMemory.cpp

示例10: values

void   CBrainMemory::SetSystemItem(int64 Item,AnsiString Info){
	CppSQLite3Buffer SQL;
	CppSQLite3Query  Result;
	char a[30],b[30];
     int64toa(ROOM_SYSTEM,a);
	 int64toa(Item,b);

    SQL.format("select b from \"%s\" where a = \"%s\";",a,b);				
	Result = BrainDB.execQuery(SQL);
	bool Find = !Result.eof();
    Result.finalize();

	if(!Find){
		SQL.format("insert into \"%s\" values (\"%s\", ?)",
			a,
			b);
	}else{
		SQL.format("update \"%s\" set b = ? where a = \"%s\";",
			a,
			b
			);
	}

	CppSQLite3Statement State = BrainDB.compileStatement(SQL);
	State.bind(1,Info.c_str()); //替换第一个问号
	State.execDML();

}
开发者ID:GMIS,项目名称:GMIS,代码行数:28,代码来源:BrainMemory.cpp

示例11: while

tstring CBrainMemory::RetrieveToken(int64 RoomID){
	int64 CurrentRoomValue,RoomType; 
    int64  CurrentID = RoomID;
	
	//首先得到意义空间的信息
	if(!GetRoomInfo(RoomID,CurrentRoomValue,RoomType)){
		return NULL;
	}
	
	deque<int64> BodyList;
	while(1)
	{
		//向上漫游,找到父空间空间的ID和逻辑明文,得记忆的形ID
		CppSQLite3Query Result = LBrainQuery("*",CurrentRoomValue,LB_CHILD_ID,CurrentID);
		if(Result.eof())return 0;
		CurrentID = Result.getInt64Field(0);  //fatherID
		if(CurrentID == ROOT_SPACE)break;;
		CurrentRoomValue = Result.getInt64Field(1); //fatherValuse
        BodyList.push_front(CurrentRoomValue);
	}	

	tstring s;
	for (int i=0; i<BodyList.size(); i++)
	{
		int64 ID = BodyList[i];
		TCHAR ch = (TCHAR)ID;
		s += ch;
	}
	return s;
}
开发者ID:GMIS,项目名称:GMIS,代码行数:30,代码来源:BrainMemory.cpp

示例12: loadDataSource

void UNotifySummaryList::loadDataSource()
{
    CppSQLite3Query src;
    UNotifySummaryDataSource::queryData(src);

    while(!src.eof()){
        UNotifySummaryDataField dest;
        UNotifySummaryDataSource::parseDataField(src, dest);

        UNotifySummary* info = new UNotifySummary;
        quint8 type = dest.notifyType;
        Mi::NotifyCategory notifyType = (Mi::NotifyCategory)type;

       info->setNotifyType(notifyType);
       info->setNotifyID(dest.notifyID);
       info->setNotifyName(dest.notifyName);
       info->setNotifyContent(dest.notifyContent);
       info->setNotifyTime(dest.notifyTime);
       info->setUnreadCount(dest.unreadCount);
       info->setNotifyImg(dest.portraitPath);

       this->insertList(info);
       src.nextRow();
    }
}
开发者ID:LinLinYi,项目名称:kirogi,代码行数:25,代码来源:UNotifySummaryList.cpp

示例13:

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;
	}
}
开发者ID:louzhenyu,项目名称:Mainline,代码行数:25,代码来源:limitIP.cpp

示例14: InserSingleSetConfig

void CUserAcessSetDlg::InserSingleSetConfig()
{

	CppSQLite3Table table;
	CppSQLite3Query q;

	CppSQLite3DB SqliteDBBuilding;
	SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath);

	CString strSql;
	strSql.Format(_T("select * from UserLevelSingleSet where MainBuilding_Name='%s' and Building_Name='%s' and username='%s'"),m_strMainBuilding,m_strSubNetName,m_strUserName);
	q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
	_variant_t temp_variant;
	BOOL b_useLogin=false;

	try
	{

		if(q.eof())
		{
			strSql.Format(_T("insert into UserLevelSingleSet values('%s','%s','%s',%i,%i)"),m_strMainBuilding,m_strSubNetName,m_strUserName,0,0);		
			SqliteDBBuilding.execDML((UTF8MBSTR)strSql); 
		}

		SqliteDBBuilding.closedb();
	}
	catch(_com_error *e)
	{
		AfxMessageBox(e->ErrorMessage());
	}



}
开发者ID:Fance,项目名称:T3000_Building_Automation_System,代码行数:34,代码来源:UserAcessSetDlg.cpp

示例15: TRACE

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();
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:34,代码来源:TerminateNewLocationDialog.cpp


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