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


C++ CppSQLite3Query::finalize方法代码示例

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


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

示例1: Save

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

示例5: 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

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

示例7: GetCarType

CString CEquipmentLocationDialog::GetCarType(int iCarTypeFK)
{
    CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
    CString sSQL;
    sSQL.Format("SELECT description FROM CarTypes WHERE id=%d;",iCarTypeFK);
    CppSQLite3Query q = pDB->execQuery(sSQL);
    CString sType("");
    if( !q.eof() )
        sType = q.getStringField("description");
    q.finalize();
    return sType;
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:12,代码来源:EquipmentLocationDialog.cpp

示例8: 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;
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:52,代码来源:RPGMapSceneLayer.cpp

示例9: execute

CppSQLite3Query* StoreDatabase::execute(CppSQLite3DB* db, CCString* sql)
{
    CppSQLite3Query* query = new CppSQLite3Query();
    try {
        *query = db->execQuery(sql->getCString());
    } catch (CppSQLite3Exception &e) {
        CCLOG("%d : %s", e.errorCode(), e.errorMessage());
        query->finalize();
        CC_SAFE_DELETE(query);
        query = NULL;
    }
    return query;
}
开发者ID:akehoyayoi,项目名称:cocos2dx-purchase,代码行数:13,代码来源:StoreDatabase.cpp

示例10: _FormatList

void CRcGen::_FormatList(int nIdList)
{
	int iSize=0;
	CStringA sQuery;	
	CppSQLite3Query q;
	m_listctrl->SetExtendedStyle(LVS_EX_FULLROWSELECT);	

	try
	{
		sQuery.Format("select count(*) from reslists where IDList = %d", nIdList);

		q = m_pDB->execQuery(sQuery); 
		
		if(!q.eof())
		{
			q.finalize();

			sQuery.Format("select * from reslists where idlist = %d", nIdList);
			q = m_pDB->execQuery(sQuery);

			CRect r;
			m_listctrl->GetWindowRect(r);		

			//iSize = (r.right - r.left) / q.getIntField(0);
			iSize = q.getIntField("Largura");

			for(int i=0;!q.eof();i++)
			{
				//m_listctrl->InsertColumn(i, CString(q.getStringField("NomeColuna")), LVCFMT_LEFT, DRA::SCALEX(iSize));
				m_listctrl->InsertColumn(i, CString(q.getStringField("NomeColuna")), LVCFMT_LEFT, iSize);
				q.nextRow();
			}
			q.finalize();						
		}		
	}
	catch(CppSQLite3Exception e)
	{
	}
}
开发者ID:MFDonadeli,项目名称:PMA,代码行数:39,代码来源:RCGen.cpp

示例11: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(960, 640, kResolutionShowAll);
    
    // turn on display FPS
    pDirector->setDisplayStats(false);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    //将数据库复制到可写目录
    string dbSrc = CCFileUtils::sharedFileUtils()->fullPathForFilename(GAME_SYS_DB);
    string dbDes = CCFileUtils::sharedFileUtils()->getWritablePath();
    dbDes.append(GAME_SYS_DB);
    
    if(!OzgFileUtility::fileExists(dbDes))
        OzgFileUtility::copyFile(dbSrc.c_str(), dbDes.c_str());
    CCLog("%s", dbDes.c_str());
    
    //记录检查,如果没有记录则生成
    CppSQLite3DB db;
    db.open(dbDes.c_str());
    
    CppSQLite3Query query = db.execQuery("select count(id) from save_data");
    //    CCLog("%i", query.getIntField(0));
    if(query.getIntField(0) == 0)
        db.execDML(GAME_INIT_SQL);
    
    query.finalize();
    db.close();
    
    //初始化背景音乐和效果音的默认大小值
    SimpleAudioEngine::sharedEngine()->setBackgroundMusicVolume(CCUserDefault::sharedUserDefault()->getFloatForKey(GAME_BG_AUDIO_VOLUME, 1.0));
    SimpleAudioEngine::sharedEngine()->setEffectsVolume(CCUserDefault::sharedUserDefault()->getFloatForKey(GAME_EFFECT_AUDIO_VOLUME, 1.0));
    
    // create a scene. it's an autorelease object
    CCScene *pScene = RPGStartSceneLayer::scene();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:48,代码来源:AppDelegate.cpp

示例12: 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;
}
开发者ID:gaojihao,项目名称:7520Inspru,代码行数:45,代码来源:DlgEventList.cpp

示例13: Count

/**
 * Metodo para executar a contagem de registros
 */
long CTableBase::Count(CppSQLite3DB *pDB)
{
	long count = 0;

	CString s = BuildCountQuery();
	CStr s1(s);
	CppSQLite3Query q = pDB->execQuery(s1);
    if(!q.eof())
	{
		TCHAR *endp;
		CString s2(q.fieldValue(0));
		count = _tcstol(s2, &endp, 10);
	}

	q.finalize();

	return count;
}
开发者ID:MFDonadeli,项目名称:PMA,代码行数:21,代码来源:TableBase.cpp

示例14: OnInitDialog

BOOL CTerminateNewLocationDialog::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
    CppSQLite3DB* pDB = &((CTrainOpsApp*)AfxGetApp())->m_pDB;
    CppSQLite3Query q = pDB->execQuery("SELECT id,name FROM Locations;");
    //
    while (!q.eof())
    {
        int nIndex = m_ctlLocationList.AddString(q.getStringField("name"));
        m_ctlLocationList.SetItemData(nIndex,q.getIntField("id"));
        q.nextRow();
    }
    q.finalize();
    
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:ibrahimelhadeg,项目名称:trainops,代码行数:18,代码来源:TerminateNewLocationDialog.cpp

示例15: deductionsItems

void RPGResultsLogic::deductionsItems(CppSQLite3DB *db, int itemsId)
{
    CCString *sql = NULL;
    CppSQLite3Query query = db->execQuery(CCString::createWithFormat(ITEMS_GET, itemsId)->getCString());
    while(!query.eof())
    {
        if(query.getIntField("total") <= 1)
            sql = CCString::createWithFormat(ITEMS_DISCARD, itemsId);
        else
            sql = CCString::createWithFormat(ITEMS_DEDUCTIONS, itemsId);
        
        query.nextRow();
    }
    query.finalize();
    
    if(sql)
        db->execDML(sql->getCString());

}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:19,代码来源:RPGResultsLogic.cpp


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