本文整理汇总了C++中CDbColSet::Col方法的典型用法代码示例。如果您正苦于以下问题:C++ CDbColSet::Col方法的具体用法?C++ CDbColSet::Col怎么用?C++ CDbColSet::Col使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbColSet
的用法示例。
在下文中一共展示了CDbColSet::Col方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AlterEventTblIfNoSimIdL
/**
Alters the "Event" table if the the table does not have "SimId" column.
@return KErrNone, The "alter" operation has completed successfully, system wide or database specific error code otherwise.
@leave KErrNoMemory, an out of memory condition has occurred;
Some other failure codes, not related to the "alter" opertaion.
*/
TInt CLogServDatabaseMarshall::AlterEventTblIfNoSimIdL(CDbColSet& aEventTblColSet)
{//Compiled only when SYMBIAN_ENABLE_EVENTLOGGER_DUALSIM macro is defined
const TDbCol* simIdCol = aEventTblColSet.Col(KLogFieldEventSimId);
TInt err = KErrNone;
if(!simIdCol)
{
TDbCol col(KLogFieldEventSimId, EDbColUint32);
aEventTblColSet.AddL(col);
err = iDatabase.AlterTable(KLogNameEventString, aEventTblColSet);
}
return err;
}
示例2: AlterEventTblIfOldFmt
/**
Alters the "Event" table if the number column length is not KLogMaxNumberLength.
@return KErrNone, The "alter" operation has completed successfully, system wide or database specific error code otherwise.
*/
TInt CLogServDatabaseMarshall::AlterEventTblIfOldFmt(CDbColSet& aEventTblColSet)
{
const TDbCol* numberCol = aEventTblColSet.Col(KLogFieldEventNumberString);
__ASSERT_DEBUG(numberCol != NULL, User::Invariant());
TInt err = KErrNone;
// check the column width is correct
if(numberCol->iMaxLength != KLogMaxNumberLength)
{
//The column width is not correct, so this is an old format database.
//Modify the database so the number length is KLogMaxNumberLength.
(const_cast <TDbCol*> (numberCol))->iMaxLength = KLogMaxNumberLength;
err = iDatabase.AlterTable(KLogNameEventString, aEventTblColSet);
}
return err;
}
示例3: ExtHintFieldExistsL
TBool ExtHintFieldExistsL(RFs& theFS)
{
TBool theResult;
RDbNamedDatabase theDatabase;
TestNoErrL(theDatabase.Open(theFS, KDatabaseFileName,KCntDbSecureFormat));
CDbColSet* theIdentitiTable = theDatabase.ColSetL(KIdentityTableName);
CleanupStack::PushL(theIdentitiTable);
const TDbCol* theExtHint = theIdentitiTable->Col(KContactExtHintField);
theResult = (theExtHint != NULL); //The field shouldn't exits
CleanupStack::PopAndDestroy(); //theIdentitiTable
theDatabase.Close();
return theResult;
}
示例4: MakeColumnAutoIncremetingL
void CLogServDatabaseMarshall::MakeColumnAutoIncremetingL(const TDesC& aTable, const TDesC& aColumn)
{
CDbColSet* newTable = iDatabase.ColSetL(aTable);
CleanupStack::PushL(newTable);
const TDbCol* oldCol = newTable->Col(aColumn);
__ASSERT_DEBUG(oldCol != NULL, Panic(ELogNoSuchColumn));
TDbCol newCol = *oldCol;
newCol.iAttributes |= TDbCol::EAutoIncrement;
newTable->Remove(aColumn);
newTable->AddL(newCol);
User::LeaveIfError(iDatabase.DropTable(aTable));
User::LeaveIfError(iDatabase.CreateTable(aTable, *newTable));
CleanupStack::PopAndDestroy(newTable);
}