×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Mumbai
    Posts
    59

    Application Closed! KERN-EXEC 0

    I get

    Application Closed!
    Application Name
    KERN-EXEC 0

    When creating the database...
    My code for creating the database is ::
    /*
    ============================================================================
    Name : CDictionaryDB.cpp
    Author : Simon Noel Solomon
    Version :
    Copyright : Your copyright notice
    Description : CCDictionaryDB implementation
    ============================================================================
    */

    #include "CDictionaryDB.h"
    #include <s32file.h>
    #include <d32dbms.h>
    #include <f32file.h>

    CCDictionaryDB::CCDictionaryDB()
    {
    // No implementation required
    }


    CCDictionaryDB::~CCDictionaryDB()
    {
    }

    CCDictionaryDB* CCDictionaryDB::NewLC()
    {
    CCDictionaryDB* self = new (ELeave)CCDictionaryDB();
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

    CCDictionaryDB* CCDictionaryDB::NewL()
    {
    CCDictionaryDB* self=CCDictionaryDB::NewLC();
    CleanupStack::Pop(); // self;
    return self;
    }

    void CCDictionaryDB::ConstructL()
    {

    }
    void CCDictionaryDB::doExampleL()
    {
    _LIT(KDbCreateDb,"dbDictionary.db");

    // The database dbcreate.db is created as a permanent file store
    // in the app's private directory

    User::LeaveIfError(fsSession.CreatePrivatePath(EDriveC));
    TFileName name;
    User::LeaveIfError(fsSession.PrivatePath(name));
    name.Append(KDbCreateDb);
    // create database
    CCDictionaryDB::doMakeDatabaseL(name);
    // add items
    CCDictionaryDB::doAddDataL(name);
    }
    void CCDictionaryDB::doMakeDatabaseL(const TDesC& aDatabaseFileName)
    {
    // construct a file store object - the file to contain the
    // database replaces any existing file of the same name.
    CFileStore* store = CPermanentFileStore::ReplaceLC(fsSession,aDatabaseFileName,EFileRead|EFileWrite);
    // Complete file store creation
    store->SetTypeL(store->Layout());

    // Create a database in the store
    RDbStoreDatabase database;
    TStreamId id=database.CreateL(store);
    // NB. The database won't be closed on failure
    // Cleanup can be done; more usually database objects
    // are not automatic variables.

    // Keep database id as root of store
    store->SetRootL(id);

    // Complete database creation by commiting the store
    store->CommitL();

    // create the CDs table
    doCreateTableL(database);

    // create an index
    doCreateIndexL(database);

    // close the database
    database.Close();

    // Do not commit store: database has taken control of commit
    CleanupStack::PopAndDestroy();
    }


    void CCDictionaryDB::doAddDataL(const TDesC& aDatabaseFileName)
    {
    _LIT(KSQLStatement,"select ID,Word,Meaning from Dictionary order by ID");
    _LIT(KWord, "Good");
    _LIT(KMeaning, "Best");
    _LIT(KWord2, "Best");
    _LIT(KMeaning2, "Good");

    // Open the file store
    CFileStore* store = CFileStore::OpenLC(fsSession,aDatabaseFileName,EFileRead|EFileWrite);

    // open the database from the root stream
    RDbStoreDatabase database;
    database.OpenL(store,store->Root());

    // create a view on the database
    RDbView view;
    User::LeaveIfError(view.Prepare(database,TDbQuery(KSQLStatement,EDbCompareNormal)));
    User::LeaveIfError(view.EvaluateAll());
    // NB. a similar caveat about cleanup applies as mentioned above

    // insert a row
    view.InsertL();
    // column numbers match the order specified in the select statement
    // data type must match almost exactly (a few exceptions)

    view.SetColL(1,1);
    view.SetColL(2,KWord);
    view.SetColL(3,KMeaning);
    // complete the insertion
    view.PutL();

    // insert another row
    view.InsertL();


    view.SetColL(1,2);
    view.SetColL(2,KWord);
    view.SetColL(3,KMeaning);
    // complete the insertion
    view.PutL();

    // show the records
    _LIT(KShowInfo, "Rowset contents...");
    //doShowL(KShowInfo, view);

    // close the view
    view.Close();

    // close the database
    database.Close();

    // Do not commit store: database has taken control of commit
    CleanupStack::PopAndDestroy();
    }
    RDbRowSet CCDictionaryDB::GetMeaning(const TDesC& aWord)
    {
    _LIT(KDbCreateDb,"C:\\dbDictionary.db");
    TFileName name;
    name.Append(KDbCreateDb);
    const TDesC& aDatabaseFileName=name;
    _LIT(KSQLStatement,"select ID,Word,Meaning from Dictionary where Word like 'Best' order by ID");
    CFileStore* store = CFileStore::OpenLC(fsSession,aDatabaseFileName,EFileRead|EFileWrite);

    // open the database from the root stream
    RDbStoreDatabase database;
    database.OpenL(store,store->Root());

    // create a view on the database
    RDbView view;
    User::LeaveIfError(view.Prepare(database,TDbQuery(KSQLStatement,EDbCompareNormal)));
    User::LeaveIfError(view.EvaluateAll());
    return view;
    }
    void CCDictionaryDB::doShowL(const TDesC& aHeading,RDbRowSet& aSet)
    {
    _LIT(KNewline, "\n") ;
    _LIT(KRowHeadingFormatter, "\n%d row(s):");
    _LIT(KRowFormatter, "\n %S, %S: %d.%02.2d");

    // console->Printf(KNewline);
    // console->Printf(aHeading);
    //
    // console->Printf(KRowHeadingFormatter,aSet.CountL());
    // iterate across the row set
    for (aSet.FirstL();aSet.AtRow();aSet.NextL())
    {
    // retrieve the row
    aSet.GetL();
    // while the rowset is on this row, can use a TPtrC to
    // refer to any text columns
    TPtrC title=aSet.ColDes(1);
    TPtrC artist=aSet.ColDes(2);

    // simple currency formatting; not locale-dependent
    TInt pricePounds=(aSet.ColInt(3)/100);
    TInt pricePence=(aSet.ColInt(3)-(pricePounds*100));
    // console->Printf(KRowFormatter,&artist,&title,pricePounds,pricePence);
    }
    // console->Printf(KNewline);
    }


    void CCDictionaryDB::doCreateTableL(RDbDatabase& aDatabase)
    {
    _LIT(KCol1, "ID");
    _LIT(KCol2, "Word");
    _LIT(KCol3, "Meaning");
    _LIT(KTable, "Dictionary");

    // Create a table definition
    CDbColSet* columns=CDbColSet::NewLC();

    // add the columns
    // text columns default to 50 characters (variable length)
    columns->AddL(TDbCol(KCol1,EDbColText));

    // specify an alternative length
    TDbCol title(KCol2,EDbColText,60);
    title.iAttributes=TDbCol::ENotNull;
    columns->AddL(title);

    TDbCol price(KCol3,EDbColInt32);

    // columns are Nullable by default
    price.iAttributes=TDbCol::ENotNull;
    columns->AddL(price);

    // Create a table
    User::LeaveIfError(aDatabase.CreateTable(KTable,*columns));

    // cleanup the column set
    CleanupStack::PopAndDestroy();
    }


    void CCDictionaryDB::doCreateIndexL(RDbDatabase& aDatabase)
    {
    _LIT(KCol1, "ID");
    _LIT(KTable, "Dictionary");

    // create the index key
    CDbKey* key=CDbKey::NewLC();

    // add the key columns
    TDbKeyCol ID(KCol1);
    key->AddL(ID);

    // create the index
    User::LeaveIfError(aDatabase.CreateIndex(KTable,KTable,*key));

    // cleanup the key
    CleanupStack::PopAndDestroy();
    }

    I am calling doExampleL() function
    in my other .cpp file
    the error is thrown on
    line: User::LeaveIfError(fsSession.CreatePrivatePath(EDriveC));
    as well if I comment this line the error is caused at the next line.
    i.e. :User::LeaveIfError(fsSession.PrivatePath(name));
    Also if I comment this line the error
    is thrown at line :doMakeDatabaseL(name);
    which is a call to a function within the same class.

    Thanks....
    Simon

  2. #2
    Super Contributor
    Join Date
    Feb 2006
    Location
    Beijing
    Posts
    4,361

    Re: Application Closed! KERN-EXEC 0

    Hi, please do fsSession.Connect(); first.
    Stay Hungry. Stay Foolish.
    Sina Weibo:
    http://weibo.com/cxt728
    QQ Weibo:
    http://t.qq.com/Cxt_programmer

  3. #3
    Regular Contributor
    Join Date
    Nov 2007
    Location
    Mumbai
    Posts
    59

    Re: Application Closed! KERN-EXEC 0

    Quote Originally Posted by Cxt_programmer View Post
    Hi, please do fsSession.Connect(); first.
    Hey I added fsSession.connect(KFileServerDefaultMessageSlots)
    but It gives System Error(-28)
    ????
    Wats the solution?
    Simon

  4. #4
    Regular Contributor
    Join Date
    Jun 2003
    Location
    Jakarta, Indonesia
    Posts
    164

    Re: Application Closed! KERN-EXEC 0

    Hi, see code below :

    Code:
    	RFs fs;
    	fs.Connect();
    	fs.CreatePrivatePath(EDriveC);
    
    	TFileName fName;
    	fs.PrivatePath(fName);
    
    	CEikonEnv::Static()->AlertWin(fName);
    	//Here fName contains '\Private\E0000001\'  --> E0000001 is the app UID
    
    	fs.Close();
    So, you must append the drive on the file name returns by the PrivatePath() function to make it a valid file name.

    And the error code -28 you can find it on the system include path \epoc32\include\e32err.h.
    Code:
    const TInt KErrBadName=(-28);
    Regards,



    Herwin

Similar Threads

  1. Listbox in dialog gives 'Kern Exec 3' on mobile
    By hansapariya in forum Symbian User Interface
    Replies: 1
    Last Post: 2009-07-24, 07:01
  2. Application closed: Standby mode View Srv 11
    By Mr.Y in forum Symbian Tools & SDKs
    Replies: 9
    Last Post: 2008-04-02, 19:47
  3. KERN EXEC 3 while deleting listbox
    By hansapariya in forum Symbian
    Replies: 4
    Last Post: 2008-03-29, 09:09
  4. Replies: 1
    Last Post: 2007-12-10, 17:05
  5. please help! setting page issue (checkbox) kern exec 3
    By flicker82 in forum Symbian User Interface
    Replies: 4
    Last Post: 2005-02-10, 12:57

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×