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


C++ CDbColSet::ColNo方法代码示例

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


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

示例1: InsertCategoryTableL

void InsertCategoryTableL()
	{
	RDbView view;
	TInt err = view.Prepare(TheDatabase, _L("select * from CATEGORY"), view.EInsertOnly);
	TEST2(err, KErrNone);
	TheRowSet = view;	

	CDbColSet* colSet = TheRowSet.ColSetL();
	const TInt KCategoryIdIdx = colSet->ColNo(KCategoryId);
	const TInt KCategoryNameIdx = colSet->ColNo(KCategoryName);
	const TInt KGenreIdx = colSet->ColNo(KGenre);
	delete colSet;

	err = TheDatabase.Begin();
	TEST2(err, KErrNone);

	for (TInt ii=1;ii<=KCategoryRecordCount;++ii)
		{
		TheRowSet.InsertL();
		TheRowSet.SetColL(KCategoryIdIdx, ii);
		TheRowSet.SetColL(KCategoryNameIdx, _L("History"));
		TheRowSet.SetColL(KGenreIdx,(ii*500));
		TheRowSet.PutL();
		}

	err = TheDatabase.Commit();
	TEST2(err, KErrNone);
	
	//err = TheDatabase.Compact();
	//TEST2(err, KErrNone);

	TheRowSet.Close();	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:t_dbperf3.cpp

示例2: CheckConfigTableL

void CAppConfig::CheckConfigTableL() {
    CDbColSet *colSet = NULL;
    TInt error;
    
    TRAP(error, colSet = iDb.ColSetL(KConfigTable));
    
    if (colSet != NULL) {
        TBool drop =
                colSet->Count() != 2
                || colSet->ColNo(KConfigKeyCol) == KDbNullColNo
                || colSet->ColNo(KConfigValueCol) == KDbNullColNo
        ;
        
        delete colSet;
        
        if (drop) {
            User::LeaveIfError(iDb.DropTable(KConfigTable));
            colSet = NULL;
        }
    }
    
    if (colSet == NULL) {
        // Specify columns for config table
        TDbCol keyCol(KConfigKeyCol, EDbColText, KConfigKeyMaxLength);
        TDbCol valueCol(KConfigValueCol, EDbColText, KConfigValueMaxLength);
        keyCol.iAttributes = TDbCol::ENotNull;
        valueCol.iAttributes = TDbCol::ENotNull;
        
        // Add the columns to column set
        colSet = CDbColSet::NewLC();
        colSet->AddL(keyCol);
        colSet->AddL(valueCol);
        
        // Create the Books table
        User::LeaveIfError(iDb.CreateTable(KConfigTable, *colSet));
        CleanupStack::PopAndDestroy(colSet);
    }
    
    CDbKey *idx = NULL;
    TRAP(error, idx = iDb.KeyL(KConfigIndex, KConfigTable));
    if (idx != NULL) {
        if (!idx->IsUnique()) {
            iDb.DropIndex(KConfigIndex, KConfigTable);
            delete idx;
            idx = NULL;
        } else {
            delete idx;
        }
    }
    if (idx == NULL) {
        TDbKeyCol keyCol(KConfigKeyCol);
        idx = CDbKey::NewLC();
        idx->MakeUnique();
        idx->AddL(keyCol);
        User::LeaveIfError(iDb.CreateIndex(KConfigIndex, KConfigTable, *idx));
        CleanupStack::PopAndDestroy(idx);
    }
}
开发者ID:azaka,项目名称:puzzless60,代码行数:58,代码来源:CAppConfig.cpp

示例3: DoRunL

void CLogDuplicate::DoRunL()
	{
    RLogDynBuf expr;
    TLogFilterExprBuilder exprBuilder(iDatabase);
    exprBuilder.BuildExprLC(expr, *iFilterList, KLogAnd);
    TheSql.Format(KLogSqlSelectDuplicateString, iRecentList, &expr.DesC(), iId);
    CleanupStack::PopAndDestroy(&expr);

    RLogDbView view;
    view.PrepareLC(iDatabase.DTIDatabase(), TheSql);
    if(view.FirstL())
        {
        // Begin a transaction
        TBool inTransaction = iDatabase.DTIInTransaction();
        if(!inTransaction)
            {
            iDatabase.DTIBeginWithRollBackProtectionLC();
            }
        // Get column ids
        static TDbColNo idColNo = 0;
        static TDbColNo duplicateColNo = 0;
        if(idColNo == 0)
            {
            CDbColSet* cs = view.ColSetL();
            idColNo = cs->ColNo(KLogFieldIdString);
            duplicateColNo = cs->ColNo(KLogFieldEventDuplicateString);
            delete cs;
            }
        // Iterate through the events
        do
            {
            // Get current event id
            view.GetL();
            const TLogId id = view.ColInt32(idColNo);
            // Set the latest recent?
            if(iId < 0)
                {
                iId = id;
                }
            // Make the change
            view.UpdateL();
            iId == id ? view.SetColNullL(duplicateColNo) : view.SetColL(duplicateColNo, iId); 
            view.PutL();
            // This is a "hidden" change. It may affect the contents of a view, but the actual event hasn't changed
            iDatabase.DTIChangeInterface().DCISubmitChangedEventContextL(ELogChangeTypeEventChangedHidden, id);
            }
        while(view.NextL());
        // Commit changes
        if(!inTransaction)
            {
            iDatabase.DTICommitAndCancelRollbackProtectionL();
            }
        }
    CleanupStack::PopAndDestroy(&view);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:55,代码来源:LOGDUP.CPP

示例4: SetConfigL

void CAppConfig::SetConfigL(const TDesC &aKey, const TConfig &aConfig) {
    TBuf<KConfigValueMaxLength> value;
    switch (aConfig.iType) {
        case EConfigBool:
            if (*aConfig.iValue.iBool) {
                value.Copy(KBoolTrue);
            } else {
                value.Copy(KBoolFalse);
            }
            break;
        case EConfigInt:
            value.Num(*aConfig.iValue.iInt);
            break;
        case EConfigText:
            value.Copy(*aConfig.iValue.iText);
            break;
        case EConfigText8:
            value.Copy(*aConfig.iValue.iText8);
            break;
    }
    
    RDbTable table;
    TDbSeekKey seekKey(aKey);
    
    User::LeaveIfError(table.Open(iDb, KConfigTable, table.EUpdatable));
    
    CleanupClosePushL(table);
    
    User::LeaveIfError(table.SetIndex(KConfigIndex));
    
    CDbColSet* colSet = table.ColSetL();
    CleanupStack::PushL(colSet);
    
    TInt keyColNo = colSet->ColNo(KConfigKeyCol);
    TInt valueColNo = colSet->ColNo(KConfigValueCol);
    
    if (table.SeekL(seekKey)) {
        table.GetL();
        table.UpdateL();
        table.SetColL(valueColNo, value);
    } else {
        table.InsertL();
        table.SetColL(keyColNo, aKey);
        table.SetColL(valueColNo, value);
    }
    table.PutL();
    
    CleanupStack::PopAndDestroy(colSet);
    CleanupStack::PopAndDestroy(&table);
}
开发者ID:azaka,项目名称:puzzless60,代码行数:50,代码来源:CAppConfig.cpp

示例5: LoadGameL

char* CAppConfig::LoadGameL(midend *aME, const game *aGame) {
    TPtrC8 name((const TUint8*)aGame->name);
    RDbTable table;
    TDbSeekKey seekKey(name);
    char *errmsg = "";
    
    User::LeaveIfError(table.Open(iDb, KAutosaveTable, table.EReadOnly));

    CleanupClosePushL(table);

    User::LeaveIfError(table.SetIndex(KAutosaveIndex));
    
    CDbColSet* colSet = table.ColSetL();
    CleanupStack::PushL(colSet);
    
    TInt saveColNo = colSet->ColNo(KAutosaveSaveCol);
    
    if (table.SeekL(seekKey)) {
        table.GetL();
        RDbColReadStream stream;
        stream.OpenLC(table,saveColNo);
        
        errmsg = midend_deserialise(aME, read_game, &stream);
        
        CleanupStack::PopAndDestroy(&stream);
    }
    
    CleanupStack::PopAndDestroy(colSet);
    CleanupStack::PopAndDestroy(&table);
    
    return errmsg;
}
开发者ID:azaka,项目名称:puzzless60,代码行数:32,代码来源:CAppConfig.cpp

示例6: SaveGameL

void CAppConfig::SaveGameL(midend *aME, const game *aGame) {
    TPtrC8 name((const TUint8*)aGame->name);
    RDbTable table;
    TDbSeekKey seekKey(name);
    
    User::LeaveIfError(table.Open(iDb, KAutosaveTable, table.EUpdatable));
    
    CleanupClosePushL(table);
    
    User::LeaveIfError(table.SetIndex(KAutosaveIndex));
    
    CDbColSet* colSet = table.ColSetL();
    CleanupStack::PushL(colSet);
    
    TInt nameColNo = colSet->ColNo(KAutosaveNameCol);
    TInt saveColNo = colSet->ColNo(KAutosaveSaveCol);
    TInt dateColNo = colSet->ColNo(KAutosaveDateCol);
    
    if (table.SeekL(seekKey)) {
        table.GetL();
        table.UpdateL();
    } else {
        table.InsertL();
        table.SetColL(nameColNo, name);
    }
    TTime now;
    now.HomeTime();
    table.SetColL(dateColNo, now);
    
    RDbColWriteStream stream;
    stream.OpenL(table, saveColNo);
    CleanupClosePushL(stream);
    
    midend_serialise(aME, save_game, &stream);
    CleanupStack::PopAndDestroy(&stream);
    
    table.PutL();
    
    CleanupStack::PopAndDestroy(colSet);
    CleanupStack::PopAndDestroy(&table);
    
    iDb.Compact();
}
开发者ID:azaka,项目名称:puzzless60,代码行数:43,代码来源:CAppConfig.cpp

示例7: GetConfigL

void CAppConfig::GetConfigL(const TDesC &aKey, const TConfig &aConfig) {
    RDbTable table;
    TDbSeekKey seekKey(aKey);
    
    User::LeaveIfError(table.Open(iDb, KConfigTable, table.EReadOnly));

    CleanupClosePushL(table);

    User::LeaveIfError(table.SetIndex(KConfigIndex));
    
    CDbColSet* colSet = table.ColSetL();
    CleanupStack::PushL(colSet);
    
    TInt valueColNo = colSet->ColNo(KConfigValueCol);
    
    if (table.SeekL(seekKey)) {
        table.GetL();
        TPtrC value = table.ColDes(valueColNo);
        
        switch (aConfig.iType) {
            case EConfigBool:
                *aConfig.iValue.iBool = value.Compare(KBoolTrue) == 0 ? ETrue : EFalse;
                break;
                
            case EConfigInt: {
                TLex lex(value);
                TInt lvalue;
                if (lex.Val(lvalue) == KErrNone) {
                    *aConfig.iValue.iInt = lvalue;
                }
                break;
            }
            
            case EConfigText:
                if (aConfig.iValue.iText->MaxLength() > value.Length()) {
                    aConfig.iValue.iText->Copy(value.Left(aConfig.iValue.iText->MaxLength()));
                } else {
                    aConfig.iValue.iText->Copy(value);
                }
                break;
                
            case EConfigText8:
                if (aConfig.iValue.iText8->MaxLength() > value.Length()) {
                    aConfig.iValue.iText8->Copy(value.Left(aConfig.iValue.iText8->MaxLength()));
                } else {
                    aConfig.iValue.iText8->Copy(value);
                }
                break;
        }
    }
    
    CleanupStack::PopAndDestroy(colSet);
    CleanupStack::PopAndDestroy(&table);
}
开发者ID:azaka,项目名称:puzzless60,代码行数:54,代码来源:CAppConfig.cpp

示例8: CreateDatabaseL

void CNSmlDSSettings::CreateDatabaseL(const TDesC& aFullName)
	{
	// 50 is the extra length neede for integer lengths
	HBufC* createProfileTable = HBufC::NewLC( KDSCreateProfilesTable().Length() + 50);
	TPtr profileTablePtr = createProfileTable->Des();

	profileTablePtr.Format(KDSCreateProfilesTable,KNSmlMaxProfileNameLength,KNSmlMaxUsernameLength,KNSmlMaxPasswordLength,KNSmlMaxURLLength,KNSmlMaxServerIdLength,KNSmlMaxHttpAuthUsernameLength,KNSmlMaxHttpAuthPasswordLength, KNSmlDSVisibilityArraySize );

	// 25 is the extra length neede for integer lengths
	HBufC* createAdaptersTable = HBufC::NewLC( KDSCreateAdaptersTable().Length() + 25);
	TPtr adaptersTablePtr = createAdaptersTable->Des();
	adaptersTablePtr.Format(KDSCreateAdaptersTable,KNSmlMaxAdapterDisplayNameLength,KNSmlMaxRemoteNameLength, KNSmlMaxLocalNameLength );

    User::LeaveIfError( iDatabase.Create( this->iRdbSession, aFullName, KNSmlDBMSSecureSOSServerID ) );  
	
	iDatabase.Begin();

	iDatabase.Execute( *createProfileTable );
	iDatabase.Execute( *createAdaptersTable );

	CDbColSet* colSet = CDbColSet::NewLC();
	colSet->AddL(TDbCol(KNSmlVersionColumnMajor(), EDbColUint16));
	colSet->AddL(TDbCol(KNSmlVersionColumnMinor(), EDbColUint16));
	User::LeaveIfError(iDatabase.CreateTable(KNSmlTableVersion(), *colSet));
	CleanupStack::PopAndDestroy(  ); //colset

	RDbTable table;
	User::LeaveIfError(table.Open(iDatabase, KNSmlTableVersion()));
	CleanupClosePushL(table);
	colSet = table.ColSetL();
	CleanupStack::PushL(colSet);
	table.InsertL();
	table.SetColL(colSet->ColNo(KNSmlVersionColumnMajor), KNSmlSettingsCurrentVersionMajor);
	table.SetColL(colSet->ColNo(KNSmlVersionColumnMinor), KNSmlSettingsCurrentVersionMinor);
	table.PutL();
	
	iDatabase.Commit();
	
	CreateHiddenProfilesL();

	TInt keyVal;
	TRAPD (err ,ReadRepositoryL(KNsmlDsCustomProfiles, keyVal));
	if (err == KErrNone && keyVal)
	{
		TBool aRestore = EFalse;
		CreateXMLProfilesL(aRestore);
	}
	iDatabase.Close();
	CleanupStack::PopAndDestroy( 4 ); // createAdaptersTable, createProfileTable, colSet, table
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:50,代码来源:NSmlDSSettings.cpp

示例9: SetL

// -----------------------------------------------------------------------------
// CUpnpObjectBean::SetL
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CUpnpObjectBean::SetL(const RDbRowSet& aRowSet)
{
    // get cols ids
    CDbColSet* colSet = aRowSet.ColSetL();
    CleanupStack::PushL(colSet);
    const TInt idColNo          = colSet->ColNo(KObjIdColName);
    const TInt parentIDColNo    = colSet->ColNo(KObjParentIdColName);
    const TInt titleColNo       = colSet->ColNo(KObjTiltleColName);
    const TInt classColNo       = colSet->ColNo(KObjClassColName);
    const TInt restrictedColNo  = colSet->ColNo(KObjRestrictedColName);
    const TInt searchableColNo  = colSet->ColNo(KObjSearchableColName);
    const TInt refIDColNo       = colSet->ColNo(KObjRefIdColName);
    CleanupStack::PopAndDestroy(colSet);

    // for each column call setter
    if( idColNo != KDbNullColNo )
    {
        SetObjId( aRowSet.ColInt(idColNo) );
    }
    if( parentIDColNo != KDbNullColNo )
    {
        SetObjParentId( aRowSet.ColInt(parentIDColNo) );
    }
    if( titleColNo != KDbNullColNo )
    {
        SetObjTitleL( aRowSet.ColDes8(titleColNo) );
    }
    if( classColNo != KDbNullColNo )
    {
        SetObjClassL( aRowSet.ColDes8(classColNo) );
    }
    if( restrictedColNo != KDbNullColNo )
    {
        SetObjRestricted( aRowSet.ColUint8(restrictedColNo) );
    }
    if( searchableColNo != KDbNullColNo && !aRowSet.IsColNull(searchableColNo) )
    {
        SetObjSearchable( aRowSet.ColUint8(searchableColNo) );
    }
    else
    {
        SetObjSearchable( KUndef);
    }
    if( refIDColNo != KDbNullColNo && !aRowSet.IsColNull(refIDColNo) )
    {
        SetObjRefId( aRowSet.ColInt(refIDColNo) );
    }
    else
    {
        SetObjRefId(KUndef);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:57,代码来源:upnpobjectbean.cpp

示例10: InsertStatsTableL

void InsertStatsTableL()
	{
	RDbView view;
	TInt err = view.Prepare(TheDatabase, _L("select * from STATS"), view.EInsertOnly);
	TEST2(err, KErrNone);
	TheRowSet = view;	

	CDbColSet* colSet = TheRowSet.ColSetL();
	const TInt KCategoryIdIdx = colSet->ColNo(KCategoryId);
	const TInt KTrackCntIdx = colSet->ColNo(KNoOfTracks);
	const TInt KMarkedToPlayCntIdx = colSet->ColNo(KNoMarked2Play);
	const TInt KUnmarkedToPlayCntIdx = colSet->ColNo(KNoUnmarked2Play);
	const TInt KAutoStartCntIdx = colSet->ColNo(KNoAutostart);
	const TInt KManualStartCntIdx = colSet->ColNo(KNoManualStart);
	const TInt KSizeMusicFilesIdx = colSet->ColNo(KSizeOfMusicFiles);
	delete colSet;

	TInt default_Stat = 0;

	err = TheDatabase.Begin();
	TEST2(err, KErrNone);
	
	for (TInt ii=0;ii<KStatsRecordCount;++ii)
		{
		TheRowSet.InsertL();
		TheRowSet.SetColL(KCategoryIdIdx, ii);
		TheRowSet.SetColL(KTrackCntIdx,default_Stat);
		TheRowSet.SetColL(KMarkedToPlayCntIdx,default_Stat);
		TheRowSet.SetColL(KUnmarkedToPlayCntIdx,default_Stat);
		TheRowSet.SetColL(KAutoStartCntIdx,default_Stat);
		TheRowSet.SetColL(KManualStartCntIdx,default_Stat);
		TheRowSet.SetColL(KSizeMusicFilesIdx,default_Stat);
		TheRowSet.PutL();
		}

	err = TheDatabase.Commit();
	TEST2(err, KErrNone);
	
	//err = TheDatabase.Compact();
	//TEST2(err, KErrNone);

	TheRowSet.Close();	
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:43,代码来源:t_dbperf3.cpp

示例11: SetL

// -----------------------------------------------------------------------------
// CUpnpElementBean::SetL
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
void CUpnpElementBean::SetL(const RDbRowSet& aRowSet)
{
    // get cols' ids
    CDbColSet* colSet = aRowSet.ColSetL();
    CleanupStack::PushL(colSet);
    const TInt  idColNo         = colSet->ColNo(KElmIdColName);
    const TInt  nameColNo       = colSet->ColNo(KElmNameColName);
    const TInt  hasAttrColNo    = colSet->ColNo(KElmHasAttrColName);
    const TInt  objIdColNo      = colSet->ColNo(KElmObjIdColName);
    const TInt  isRequiredColNo = colSet->ColNo(KElmIsRequiredColName);
    const TInt  valueColNo      = colSet->ColNo(KElmValueColName);
    CleanupStack::PopAndDestroy(colSet);
    
    // for each column call setter
    if( idColNo != KDbNullColNo )
    {
        SetElmId( aRowSet.ColInt(idColNo) );
    }
    if( nameColNo != KDbNullColNo )
    {
        SetElmNameL( aRowSet.ColDes8(nameColNo) );
    }
    if( hasAttrColNo != KDbNullColNo )
    {
        SetElmHasAttribute( aRowSet.ColUint8(hasAttrColNo) );
    }
    if( objIdColNo != KDbNullColNo )
    {
        SetElmObjId( aRowSet.ColInt(objIdColNo) );
    }
    if( isRequiredColNo != KDbNullColNo )
    {
        SetElmIsRequired( aRowSet.ColUint8(isRequiredColNo) );
    }
    if( valueColNo != KDbNullColNo )
    {
        SetElmValueL(aRowSet, valueColNo);
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:44,代码来源:upnpelementbean.cpp

示例12: IsDlgReadyToCompleteL

TInt eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL()
	{

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): m_index_type=%d, m_index=%d, m_tunneling_type=0xfe%06x%08x\n"),
		m_index_type,
		m_index,
		m_tunneling_type.get_vendor_id(),
		m_tunneling_type.get_vendor_type()));

	TInt status = KErrNone;
	HBufC* buf = HBufC::NewLC(KMaxSqlQueryLength);
	TPtr sqlStatement = buf->Des();
	
	// Query all the relevant parameters
	_LIT(KSQLQuery, "SELECT %S, %S, %S FROM %S WHERE %S=%d AND %S=%d AND %S=%d AND %S=%d");
	
	sqlStatement.Format(
		KSQLQuery,
		&cf_str_EAP_GTC_passcode_prompt_literal,
		&cf_str_EAP_GTC_identity_literal,
		&cf_str_EAP_GTC_passcode_literal,
		&KGtcTableName,
		&KServiceType,
		m_index_type, 
		&KServiceIndex,
		m_index,
		&KTunnelingTypeVendorId,
		m_tunneling_type.get_vendor_id(),
		&KTunnelingType, 
		m_tunneling_type.get_vendor_type());
	

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));

	RDbView view;
	// Evaluate view
	User::LeaveIfError(view.Prepare(m_database, TDbQuery(sqlStatement), TDbWindow::EUnlimited));
	CleanupClosePushL(view);
	
	User::LeaveIfError(view.EvaluateAll());
	
	// Get the first (and only) row
	view.FirstL();
	view.GetL();
	
	// Get column set so we get the correct column numbers
	CDbColSet* colSet = view.ColSetL();
	CleanupStack::PushL(colSet);

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): Reads database\n")));

	TPtrC username = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_identity_literal ) );

	EAP_TRACE_DATA_DEBUG(
		m_am_tools,
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): username"),
		username.Ptr(),
		username.Size()));

	TPtrC password = view.ColDes(colSet->ColNo( cf_str_EAP_GTC_passcode_literal ) );

	EAP_TRACE_DATA_DEBUG(
		m_am_tools,
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): password"),
		password.Ptr(),
		password.Size()));

	TUint prompt = view.ColUint(colSet->ColNo(cf_str_EAP_GTC_passcode_prompt_literal));

	EAP_TRACE_DEBUG(
		m_am_tools, 
		TRACE_FLAGS_DEFAULT,
		(EAPL("eap_am_type_securid_symbian_c::IsDlgReadyToCompleteL(): prompt=%d\n"),
		prompt));


	if ((EEapDbFalse != prompt)
		 || (username.Size() == 0) 
		 || (password.Size() == 0))
		{

		if (username.Size() == 0)
			{
			m_dialog_data_ptr->iUsername.Zero();
			}
		else
			{
			m_dialog_data_ptr->iUsername.Copy(username);
			}
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:101,代码来源:eap_am_type_securid_symbian.cpp

示例13: TestSearchL

/**
@SYMTestCaseID          SYSLIB-DBMS-CT-0645
@SYMTestCaseDesc        Searching for data from a database
@SYMTestPriority        Medium
@SYMTestActions         Tests for EDbColText,EDbColLongText column type
@SYMTestExpectedResults Test must not fail
@SYMREQ                 REQ0000
*/
static void TestSearchL( TInt aIndex )
	{
	// Default database
	_LIT( KComposer1, "Elgar" );
	_LIT( KCol1, "Artist" );
	_LIT( KCol2, "Notes" );
	_LIT( KTable, "CDs" );

	TInt err = TheFsSession.Delete( KSearchTestDbPath );
	if ( ( err != KErrNone ) && ( err != KErrNotFound ) && ( err != KErrPathNotFound ) )
		{
		__LEAVE( err );
		}

	RDbNamedDatabase db;
	CleanupClosePushL( db );
	__LEAVE_IF_ERROR( db.Create( TheFsSession, KSearchTestDbPath ) );

	//
	// Create the database table
	//
	// Create a table definition
	CDbColSet* columns = CDbColSet::NewLC();
	// add the columns
	columns->AddL( TDbCol( KCol1, EDbColText ) );
	if ( aIndex == 0 )
		columns->AddL( TDbCol( KCol2, EDbColText ) );
	else
		columns->AddL( TDbCol( KCol2, EDbColLongText ) );
	// if the column is of type "EDbColText" instead,
	// all searching is working properly
	// Create a table
	__LEAVE_IF_ERROR( db.CreateTable( KTable, *columns ) );
	// cleanup the column set
	CleanupStack::PopAndDestroy( columns );

	//
	// Add data
	//
	// create a view on the database
	_LIT( KSQLStatement, "select Artist,Notes from CDs order by Artist" );
	RDbView view;
	__LEAVE_IF_ERROR( view.Prepare( db, TDbQuery( KSQLStatement, EDbCompareNormal ) ) );
	__LEAVE_IF_ERROR( view.EvaluateAll() );

	// Get the structure of rowset
	CDbColSet* colSet = view.ColSetL();
	// insert a row
	view.InsertL();
	view.SetColL( colSet->ColNo( KCol1 ), KComposer1 ); // Artist
	// Use the stream
	// RDbColWriteStream out;
	// TDbColNo col = colSet->ColNo( KCol2 ); // Ordinal position of long column
	//
	// out.OpenLC( view, col );
	// out.WriteL( _L( "Some additional comment here." ) );
	// out.Close();
	//
	// CleanupStack::PopAndDestroy(); // out
	view.SetColL( colSet->ColNo( KCol2 ), _L( "Some additional comment here." ) );
	view.PutL();
	// close the view
	view.Close();
	delete colSet;

	//
	// Display the data
	//
	_LIT( KRowFormatter, "\r\n Artist: %S \r\n Notes: %S \r\n" );
	__LEAVE_IF_ERROR( view.Prepare( db, TDbQuery( KSQLStatement, EDbCompareNormal ) ) );
	__LEAVE_IF_ERROR( view.EvaluateAll() );

	// Get the structure of the rowset
	colSet = view.ColSetL();
	// iterate across the row set
	for ( view.FirstL(); view.AtRow(); view.NextL() )
		{
		// retrieve the row
		view.GetL();
		// while the rowset is on this row, can use a TPtrC to
		// refer to any text columns
		TPtrC artist = view.ColDes( colSet->ColNo( KCol1 ) );
		// and a stream for long columns
		RDbColReadStream in;
		TDbColNo col = colSet->ColNo( KCol2 ); // Ordinal position of long column
		TBuf<256> notes; // Buffer for out notes
		in.OpenLC( view, col );
		in.ReadL( notes, view.ColLength( col ) );
		in.Close();
		CleanupStack::PopAndDestroy(); // in
		// Display the artist and notes
		TBuf<512> msg;
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,代码来源:t_dblongcol.cpp

示例14: CheckAutosaveTableL

void CAppConfig::CheckAutosaveTableL() {
    CDbColSet *colSet = NULL;
    TInt error;
    
    TRAP(error, colSet = iDb.ColSetL(KAutosaveTable));
    
    if (colSet != NULL) {
        TBool drop =
                colSet->Count() != 3
                || colSet->ColNo(KAutosaveNameCol) == KDbNullColNo
                || colSet->ColNo(KAutosaveSaveCol) == KDbNullColNo
                || colSet->ColNo(KAutosaveDateCol) == KDbNullColNo
        ;
        
        delete colSet;
        
        if (drop) {
            User::LeaveIfError(iDb.DropTable(KAutosaveTable));
            colSet = NULL;
        }
    }
    
    if (colSet == NULL) {
        // Specify columns for config table
        TDbCol nameCol(KAutosaveNameCol, EDbColText8, KAutosaveNameMaxLength);
        TDbCol saveCol(KAutosaveSaveCol, EDbColLongText8);
        TDbCol dateCol(KAutosaveDateCol, EDbColDateTime);
        
        nameCol.iAttributes = TDbCol::ENotNull;
        saveCol.iAttributes = TDbCol::ENotNull;
        dateCol.iAttributes = TDbCol::ENotNull;
        
        // Add the columns to column set
        colSet = CDbColSet::NewLC();
        colSet->AddL(nameCol);
        colSet->AddL(saveCol);
        colSet->AddL(dateCol);
        
        // Create the Books table
        TInt _err = iDb.CreateTable(KAutosaveTable, *colSet);
        User::LeaveIfError(_err);
        CleanupStack::PopAndDestroy(colSet);
    }
    
    CDbKey *idx = NULL;
    TRAP(error, idx = iDb.KeyL(KAutosaveIndex, KAutosaveTable));
    if (idx != NULL) {
        if (!idx->IsUnique()) {
            iDb.DropIndex(KAutosaveIndex, KAutosaveTable);
            delete idx;
            idx = NULL;
        } else {
            delete idx;
        }
    }
    if (idx == NULL) {
        TDbKeyCol keyCol(KAutosaveNameCol);
        idx = CDbKey::NewLC();
        idx->MakeUnique();
        idx->AddL(keyCol);
        User::LeaveIfError(iDb.CreateIndex(KAutosaveIndex, KAutosaveTable, *idx));
        CleanupStack::PopAndDestroy(idx);
    }
}
开发者ID:azaka,项目名称:puzzless60,代码行数:64,代码来源:CAppConfig.cpp

示例15: missingCols

// ---------------------------------------------------------
// RFavouritesSrvTable::VerifyStructureL
// ---------------------------------------------------------
//
void RFavouritesSrvTable::VerifyStructureL
( RDbNamedDatabase& aDb, TBool aUpgrade )
{
    CDbColSet* colset = aDb.ColSetL( KFavouritesTableName );
    CleanupStack::PushL( colset );

    if (
        colset->ColNo( KFavouritesDbUidColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbParentColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbTypeColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbNameColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbUrlColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbUserNameColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbPasswordColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbApIdColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbApValueKindColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbExtraDataColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbFactoryItemColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbReadOnlyColName ) == KDbNullColNo ||
        colset->ColNo( KFavouritesDbContextIdColName ) == KDbNullColNo
    )
    {
        // Mandatory column is missing, this database is corrupt.
        User::Leave( KErrCorrupt );
    }

    if ( aUpgrade )
    {
        // Check optional columns, upgrade if necessary.
        // If upgrade is not possible, we don't even check those; as the
        // database is still functional without them.

        TInt missingCols( EFalse );

        if ( colset->ColNo( KFavouritesDbModifiedColName ) == KDbNullColNo )
        {
            // Last modification column is missing.
            colset->AddL( TDbCol
                          ( KFavouritesDbModifiedColName, EDbColDateTime ) );
            missingCols = ETrue;
        }

        if ( colset->ColNo( KFavouritesDbPrefUidColName ) == KDbNullColNo )
        {
            // Preferred uid column is missing.
            colset->AddL( TDbCol( KFavouritesDbPrefUidColName, EDbColInt32 ) );
            missingCols = ETrue;
        }

        if ( colset->ColNo( KFavouritesDbBrowserDataColName ) == KDbNullColNo )
        {
            // Preferred uid column is missing.
            colset->AddL
            ( TDbCol( KFavouritesDbBrowserDataColName, EDbColLongBinary ) );
            missingCols = ETrue;
        }
        if( colset->ColNo( KFavouritesDbHiddenColName)  == KDbNullColNo )
        {
            // Preferred uid column is missing.
            colset->AddL
            ( TDbCol( KFavouritesDbHiddenColName, EDbColBit ) );
            missingCols = ETrue;
        }

        if ( missingCols )
        {
            // Some columns are missing, try to add them now.
            // Upgrade error is ignored, database is still functional (except
            // of course the missing columns).
            (void)aDb.AlterTable( KFavouritesTableName, *colset );
        }
    }

    CleanupStack::PopAndDestroy();  // colset
}
开发者ID:kuailexs,项目名称:symbiandump-mw4,代码行数:79,代码来源:FavouritesSrvTable.cpp


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