本文整理汇总了C++中CDbColSet::AddL方法的典型用法代码示例。如果您正苦于以下问题:C++ CDbColSet::AddL方法的具体用法?C++ CDbColSet::AddL怎么用?C++ CDbColSet::AddL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDbColSet
的用法示例。
在下文中一共展示了CDbColSet::AddL方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateTablesL
// -----------------------------------------------------------------------------
// CreateTablesL
// Create table through database session
// -----------------------------------------------------------------------------
//
LOCAL_C void CreateTablesL(RDbDatabase& aDatabase)
{
#ifdef _DRM_TESTING
WriteL(_L8("CreateTablesL"));
#endif
CDbColSet* columns = CDbColSet::NewLC();
//filename columns
TDbCol filename(KColFilename,EDbColLongText16);
filename.iAttributes = TDbCol::ENotNull;
columns->AddL(filename);
//position columns
TDbCol position(KColPosition,EDbColUint16);
position.iAttributes = TDbCol::ENotNull;
columns->AddL(position);
//content id columns
TDbCol cid(KColCid,EDbColLongText16);
cid.iAttributes = TDbCol::ENotNull;
columns->AddL(cid);
//content group id columns
TDbCol group(KColGroupId,EDbColLongText16);
columns->AddL(group);
//transaction id columns
TDbCol ttid(KColTtid,EDbColText16,KTtidLen);
columns->AddL(ttid);
aDatabase.CreateTable( KTable,*columns);
CleanupStack::PopAndDestroy(columns); //columns
}
示例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);
}
}
示例3: CreateUserCityTableL
/**
Creates the user added city database table if it doesn't exist
@return KErrNone if succesful, or one of the DBMS Leave codes
@internalTechnology
*/
TInt CTzLocalizationDbAccessor::CreateUserCityTableL()
{
//Create the columns for the user aded cities table
RArray<TDbCol> cityTableCols;
CleanupClosePushL(cityTableCols);
cityTableCols.AppendL(TDbCol(KUCTableTzId, EDbColUint16));
cityTableCols.AppendL(TDbCol(KUCTableCity, EDbColText));
cityTableCols.AppendL(TDbCol(KUCTableGroup, EDbColUint8));
cityTableCols.AppendL(TDbCol(KUCTableResourceId, EDbColUint32));
// Create the columnset - add the columns
// Columns MUST be added in the same order they appear in TTzCityColumn
CDbColSet* userCityColSet = CDbColSet::NewLC();
TInt numCols = cityTableCols.Count();
for(TInt i = 0; i < numCols; ++i)
{
userCityColSet->AddL(cityTableCols[i]);
}
// Create the User City table
TInt error = iLocalizedTimeZoneDb.CreateTable(KUCTableName,*userCityColSet);
CleanupStack::PopAndDestroy(userCityColSet);
CleanupStack::PopAndDestroy(); //cityTableCols
return error;
}
示例4: 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;
}
示例5: while
//
// build a column set for the table
//
void CDbTableDatabase::CInterface::ColumnsL(CDbColSet& aColSet,const TDesC& aName)
{
TDbCol col;
const HDbColumnSet& set=Database().SchemaL().FindL(aName).Columns();
HDbColumnSet::TIteratorC iter=set.Begin();
const HDbColumnSet::TIteratorC end=set.End();
do
{
iter->AsTDbCol(col);
aColSet.AddL(col);
} while (++iter<end);
}
示例6: CreateTestTableL
//Creates a test table
static void CreateTestTableL(RDbNamedDatabase& aDb)
{
CDbColSet* colSet = CDbColSet::NewLC();
for(const TColDef* colDef=KColDefs;colDef->iName;++colDef)
{
TDbCol col(TPtrC(colDef->iName), colDef->iType);
col.iAttributes = colDef->iAttributes;
colSet->AddL(col);
}
TEST2(aDb.CreateTable(KTestTableName, *colSet), KErrNone);
CleanupStack::PopAndDestroy(colSet);
}
示例7: 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
}
示例8: InternalizeL
GLDEF_C void InternalizeL(CDbColSet& aColSet,RReadStream& aStream)
{
__ASSERT(aColSet.Count()==0);
TDbCol col;
TPtr name(col.iName.Des());
TInt cc=aStream.ReadInt32L();
while (--cc>=0)
{
aStream>>name;
col.iType=TDbColType(aStream.ReadUint8L());
col.iMaxLength=aStream.ReadInt32L();
col.iAttributes=aStream.ReadUint8L();
aColSet.AddL(col);
}
}
示例9: 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);
}
示例10: 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
}
示例11: CreateStructureL
// ---------------------------------------------------------
// RFavouritesSrvTable::CreateStructureL
// ---------------------------------------------------------
//
void RFavouritesSrvTable::CreateStructureL( RDbNamedDatabase& aDb )
{
// Create columns.
CDbColSet* colset = CDbColSet::NewLC();
TDbCol col( KFavouritesDbUidColName, EDbColInt32 );
col.iAttributes = TDbCol::EAutoIncrement;
colset->AddL( col );
colset->AddL( TDbCol( KFavouritesDbParentColName, EDbColInt32 ) );
colset->AddL( TDbCol( KFavouritesDbTypeColName, EDbColInt32 ) );
colset->AddL( TDbCol
( KFavouritesDbNameColName, EDbColText, KFavouritesMaxName ) );
colset->AddL( TDbCol
( KFavouritesDbUrlColName, EDbColLongText, KFavouritesMaxUrl ) );
colset->AddL( TDbCol( KFavouritesDbApIdColName, EDbColUint32 ) );
colset->AddL( TDbCol( KFavouritesDbApValueKindColName, EDbColInt32 ) );
colset->AddL( TDbCol
( KFavouritesDbUserNameColName, EDbColText, KFavouritesMaxUserName ) );
colset->AddL( TDbCol
( KFavouritesDbPasswordColName, EDbColText, KFavouritesMaxPassword ) );
colset->AddL( TDbCol( KFavouritesDbExtraDataColName, EDbColLongBinary ) );
colset->AddL( TDbCol( KFavouritesDbFactoryItemColName, EDbColBit ) );
colset->AddL( TDbCol( KFavouritesDbReadOnlyColName, EDbColBit ) );
colset->AddL( TDbCol( KFavouritesDbContextIdColName, EDbColInt32 ) );
colset->AddL( TDbCol( KFavouritesDbModifiedColName, EDbColDateTime ) );
colset->AddL( TDbCol( KFavouritesDbPrefUidColName, EDbColInt32 ) );
colset->AddL
( TDbCol( KFavouritesDbBrowserDataColName, EDbColLongBinary ) );
colset->AddL( TDbCol( KFavouritesDbHiddenColName, EDbColBit ) );
User::LeaveIfError
( aDb.CreateTable( KFavouritesTableName, *colset ) );
CleanupStack::PopAndDestroy(); // colset
// Create index by uid.
CDbKey* key = CDbKey::NewLC();
// Create key on Uid column, ascending order.
key->AddL( TDbKeyCol ( KFavouritesDbUidColName ) );
User::LeaveIfError( aDb.CreateIndex
( KFavouritesDbUidIdxName, KFavouritesTableName, *key ) );
CleanupStack::PopAndDestroy(); // key
}
示例12: CreateFrequentlyUsedZoneTableL
/**
Creates the Cached Zone Table if it doesn't already exist.
@return KErrNone if succesful, or one of the DBMS Leave codes
@internalTechnology
*/
TInt CTzLocalizationDbAccessor::CreateFrequentlyUsedZoneTableL()
{
// Create the columns for the cached zones table
RArray<TDbCol> cachedTableCols;
CleanupClosePushL(cachedTableCols);
cachedTableCols.AppendL(TDbCol(KCZTableTzIdCol, EDbColUint16));
cachedTableCols.AppendL(TDbCol(KCZTableStdCol, EDbColText));
cachedTableCols.AppendL(TDbCol(KCZTableDSTCol, EDbColText));
cachedTableCols.AppendL(TDbCol(KCZTableShortStdCol, EDbColText));
cachedTableCols.AppendL(TDbCol(KCZTableShortDSTCol, EDbColText));
cachedTableCols.AppendL(TDbCol(KCZTableCityCol, EDbColText));
cachedTableCols.AppendL(TDbCol(KCZTableCityGroupCol, EDbColUint8));
cachedTableCols.AppendL(TDbCol(KCZTableResourceIdCol, EDbColUint32));
cachedTableCols.AppendL(TDbCol(KCZTableCityIndexCol, EDbColInt32));
// Create the columnset - add the columns
// Columns MUST be added in the same order they appear in TTzZoneColumn
CDbColSet* FrequentlyUsedZoneColSet = CDbColSet::NewLC();
TInt numCols = cachedTableCols.Count();
for(TInt i = 0; i < numCols; ++i)
{
FrequentlyUsedZoneColSet->AddL(cachedTableCols[i]);
}
// Create the Cached Time Zone table
TInt error = iLocalizedTimeZoneDb.CreateTable(KCZTableName,*FrequentlyUsedZoneColSet);
User::LeaveIfError(error);
//Open the newly created table
PrepareZoneViewL();
iZoneView.Reset();
//Populate with initial (blank) data.
_LIT(KEmptyString," ");
for (TInt x = 0; x < CTzLocalizedTimeZone::ECachedTimeZones; ++x)
{
iZoneMutex.Wait() ;
CleanupStack::PushL(TCleanupItem(ReleaseMutex,&iZoneMutex));
// Insert empty row
iZoneView.InsertL();
// Fill the table with blank data
iZoneView.SetColL(ETzZoneId, 0);
iZoneView.SetColL(ETzZoneStdName, KEmptyString);
iZoneView.SetColL(ETzZoneDSTName, KEmptyString);
iZoneView.SetColL(ETzZoneShortStdName, KEmptyString);
iZoneView.SetColL(ETzZoneShortDSTName, KEmptyString);
iZoneView.SetColL(ETzZoneCity, KEmptyString);
iZoneView.SetColL(ETzZoneGroupId, 0);
iZoneView.SetColL(ETzZoneResourceId, 0);
iZoneView.SetColL(ETzZoneCityIndex, 0);
iZoneView.PutL(); // Complete insertion
CleanupStack::Pop() ;
iZoneMutex.Signal() ;
}
iZoneView.Close();
CleanupStack::PopAndDestroy(FrequentlyUsedZoneColSet);
CleanupStack::PopAndDestroy(&cachedTableCols); //cachedTableCols
return error;
}
示例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;
//.........这里部分代码省略.........
示例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);
}
}