// -----------------------------------------------------------------------------
// CWPInternetAPDB::CreateandOpenL
// -----------------------------------------------------------------------------
//    
void CSCOMOAdapterDb::CreateandOpenL(TParse& name)
    {

    TInt err;

#ifdef SYMBIAN_SECURE_DBMS
    iDatabase.Create(iRdbSession, name.FullName(), KDBMSSecureID);
#else
    if( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, KEmptyDbSizeEstimate ) )
        {
        User::Leave( KErrDiskFull );
        }
    iDatabase.Create(iFsSession, name.FullName());
#endif	

    CreateTableL(iDatabase);
    iDatabase.Close();
#ifdef SYMBIAN_SECURE_DBMS

    err = iDatabase.Open(iRdbSession, name.FullName(), KDBMSSecureID);

#else
    err = iDatabase.Open(iFsSession, DBFileName);
#endif

    //Debug
    if (err != KErrNone)
        {

        User::LeaveIfError(err);
        }

    }
Пример #2
0
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/  
void CScheduleDB::ConstructL()
{
	User::LeaveIfError(iFsSession.Connect());

	TFindFile PrivFolder(iFsSession);
	if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive
	{
		TEntry anEntry;
		if(KErrNone == iFsSession.Entry(PrivFolder.File(),anEntry))
		{
			if(anEntry.iSize < 10)
			{
				iFsSession.Delete(PrivFolder.File());
			}
		}
		
		if(BaflUtils::FileExists(iFsSession,PrivFolder.File()))
		{
			User::LeaveIfError(iItemsDatabase.Open(iFsSession,PrivFolder.File()));
		}
		else
		{	// no database exists so we make one
			User::LeaveIfError(iItemsDatabase.Create(iFsSession,PrivFolder.File()));     
			// and will create the onlt table needed for it
			CreateTableL(iItemsDatabase);
		}
	}
}
Пример #3
0
void CDbTableDatabase::DoCreateTableL(const TDesC& aName,const CDbColSet& aColSet,const CDbKey* aPrimaryKey)
	{
	if (SchemaL().Find(aName))
		__LEAVE(KErrAlreadyExists);
// validate the colset set passed in
	Validate::NameL(aName);
	Validate::ColSetL(aColSet);
	Transaction().DDLBeginLC();
	iSchema.Add(CreateTableL(aName,aColSet,aPrimaryKey));
	Transaction().DDLCommitL();
	CleanupStack::Pop();		// rollback not required
	}
Пример #4
0
// -----------------------------------------------------------------------------
// CWPInternetAPDB::CreateandOpenL
// -----------------------------------------------------------------------------
//    
inline void CWPInternetAPDB::CreateandOpenL(TParse& name)
    {
    FLOG( _L( "[Provisioning] CWPInternetAPDB::CreateandOpenL" ) );
    TInt err;

#ifdef SYMBIAN_SECURE_DBMS
    iItemsDatabase.Create(iRdbSession, name.FullName(),
            KInternetSecureDBMShostID);
#else
    if( SysUtil::FFSSpaceBelowCriticalLevelL( &iFsSession, KEmptyDbSizeEstimate ) )
        {
        User::Leave( KErrDiskFull );
        }
    iItemsDatabase.Create(iFsSession, name.FullName());
#endif	

    CreateTableL(iItemsDatabase);
    iItemsDatabase.Close();
#ifdef SYMBIAN_SECURE_DBMS

    err = iItemsDatabase.Open(iRdbSession, name.FullName(),
            KInternetSecureDBMShostID);

#else
    err = iItemsDatabase.Open(iFsSession, DBFileName);
#endif

    //Debug
    if (err != KErrNone)
        {
        FLOG(_L("Error man?" ));
        User::LeaveIfError(err);
        }

    FLOG( _L( "[Provisioning] CWPInternetAPDB::CreateandOpenL:done" ) );
    }
Пример #5
0
LOCAL_C void InitL()
	{
	CreateDatabaseL();
	CreateTableL();
	}