×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    39

    Need Help!! DBMS insert row

    Hello all,
    I have a very strange problem, it's occurs only on device...
    I use symbian 9.1. The code is ported from symbian 8.X but it should not affect (works fine with 8.X)
    The device is a E50. Error code . kern-exec 3

    So here is the code :
    table creation (doesn't leave so it's created ok )

    Code:
    TDbCol promotionIdCol	(_L("PROMOTION_ID")	, EDbColUint16);
    	promotionIdCol.iAttributes = TDbCol::ENotNull; 
    	TDbCol okTextCol	(_L("OK_TEXT"), EDbColText, TEXT_SIZE);
    	TDbCol expiredTextCol (_L("EXPIRED_TEXT"), EDbColText, TEXT_SIZE);
    	TDbCol notValidTimeTextCol (_L("NOT_VALID_TIME_TEXT"),                        EDbColText, TEXT_SIZE);
    	TDbCol alreadyUsedTextCol (_L("ALREADY_USED_TEXT"), EDbColText, TEXT_SIZE);
    	TDbCol nbOfRedemptionCol (_L("NB_OF_REDEMPTION"), EDbColInt16);
    	TDbCol stDateCol (_L("ST_DATE") , EDbColInt64);
    	TDbCol edDateCol(_L("ED_DATE")	, EDbColInt64);
    
    	// Add the columns to column set
    	CDbColSet* gpsColSet = CDbColSet::NewLC ();
    	gpsColSet->AddL (promotionIdCol);
    	gpsColSet->AddL (okTextCol);
    	gpsColSet->AddL (expiredTextCol);
    	gpsColSet->AddL (notValidTimeTextCol);
    	gpsColSet->AddL (alreadyUsedTextCol);
    	gpsColSet->AddL (nbOfRedemptionCol);
    	gpsColSet->AddL (stDateCol);
    	gpsColSet->AddL (edDateCol);
    	
    	// Create the promotions table
    	User::LeaveIfError (iIFDb.CreateTable (KPromotionTable, *gpsColSet));
    	CleanupStack::PopAndDestroy (gpsColSet);
    then the insert statement :

    Code:
        sqlStr.Append(_L ("INSERT INTO "));
    			sqlStr.Append (KPromotionTable);
    			sqlStr.Append(_L (" VALUES ("));
    			sqlStr.AppendNum(aId);
    			sqlStr.Append(_L (", '"));
    			sqlStr.Append(aOkText);
    			sqlStr.Append(_L ("', '"));
    			sqlStr.Append(aExpiredText);
    			sqlStr.Append(_L ("', '"));
    			sqlStr.Append(aNotValidDateText);
    			sqlStr.Append(_L ("', '"));
    			sqlStr.Append(aAlreadyUsedText);
    			sqlStr.Append(_L ("', "));
    			sqlStr.AppendNum(aNbOfRedemption);
    			sqlStr.Append(_L (", "));
    			sqlStr.AppendNum(aStDate);
    			sqlStr.Append(_L (", "));
    			sqlStr.AppendNum(aEdDate);
    			sqlStr.Append(_L (")"));
    			
    			TInt rc = iIFDb.Execute (sqlStr);
    			return rc;
    An other way :

    Code:
    sqlStr.Append(_L ("SELECT "));
    	sqlStr.Append(_L ("PROMOTION_ID, "));
    	sqlStr.Append(_L ("OK_TEXT, "));
    	sqlStr.Append(_L ("EXPIRED_TEXT, "));
    	sqlStr.Append(_L ("NOT_VALID_TIME_TEXT, "));
    	sqlStr.Append(_L ("ALREADY_USED_TEXT, "));
    	sqlStr.Append(_L ("NB_OF_REDEMPTION, "));
    	sqlStr.Append(_L ("ST_DATE, "));
    	sqlStr.Append(_L ("ED_DATE "));			
    						
    	sqlStr.Append (_L ("FROM "));
    	sqlStr.Append (KPromotionTable);
    			
    	User::LeaveIfError (view.Prepare (iIFDb, TDbQuery (sqlStr, EDbCompareFolded)));
    			
    	//view.EvaluateAll();
    	//view.FirstL();
    				
    	view.InsertL (); // Insert a row. Column order matches sql select statement
    	view.SetColL	( 1, aId);
    	view.SetColL	( 2, aOkText);
    	view.SetColL	( 3, aExpiredText);
    	view.SetColL	( 4, aNotValidDateText);
    	view.SetColL	( 5, aAlreadyUsedText);
    	view.SetColL	( 6, aNbOfRedemption);
    	view.SetColL	( 7, aStDate);
    	view.SetColL	( 8, aEdDate);
    	
    	view.PutL(); // Complete insertion
    	view.Close	();
    Thanks for your help!

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    39

    Re: Need Help!! DBMS insert row

    I forgot to add that the panic occurs in the
    iIFDb.Execute (sqlStr);
    or
    in view.PutL() ;

  3. #3
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: Need Help!! DBMS insert row

    _L is deprecated...try using _LIT, maybe that could be the reason..just try and check if it works with this change..?

    Cheers
    mayank

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    39

    Re: Need Help!! DBMS insert row

    Thanks for your reply Mayank!
    unfortunatly it doesn't change anything...
    I'm wondering if the size of the text field can be a prb?
    For exemple :

    TDbCol okTextCol (KOkText, EDbColText, TEXT_SIZE);

    with TEXT_SIZE = 150

    I don't use the stream, but i don't think it necessary since the maximum number of charactere for EDbColText is 256.

    I'm lost now... I have also try to insert a row in a very simple table (just a in field) and the same error happend!
    I have enought memory, i do a check before inserting :

    if (SysUtil:iskSpaceBelowCriticalLevelL (&iFsSession, 204800, EDriveC))
    return -1;

    One more time, it work on symbian 8.X, emulator for s60 3ed MR, s603ed FP1 BUT not on device....
    What's wrong?????

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    39

    Re: Need Help!! DBMS insert row

    So even with c++ api it doesn't work on device...

    Code:
    RDbTable table;
    TInt err = table.Open(iIFDb, KPromotionTable, table.EUpdatable);
        		
    if(err!=KErrNone)
       {
       return err;
       }
        
    CDbColSet* PromoColSet = table.ColSetL();
    CleanupStack::PushL(PromoColSet);
        
    table.Reset();
        		
     TRAPD(error,
     	table.InsertL();
     	table.SetColL(PromoColSet->ColNo(KPromoId), aId); // col = 1
            table.SetColL(PromoColSet->ColNo(KOkText), aOkText);   // col = 2
        	table.SetColL(PromoColSet->ColNo(KExpiredText), aExpiredText);
        	table.SetColL(PromoColSet->ColNo(KNotValidTimeText), aNotValidDateText);   
        	table.SetColL(PromoColSet->ColNo(KAlreadyUsedText), aAlreadyUsedText); 
        	table.SetColL(PromoColSet->ColNo(KNbOfRedemption), aNbOfRedemption);  
        	table.SetColL(PromoColSet->ColNo(KStDate), aStDate); 
        	table.SetColL(PromoColSet->ColNo(KEdDate), aEdDate);  
        	);
    
    if(error!=KErrNone)
       {
       return error;
       }   
    	
    TRAP(err, table.PutL());    // Complete changes (the insertion)
    if(err!=KErrNone)
        {
        return err;
        }   
        
    CleanupStack::PopAndDestroy(PromoColSet);
    table.Close();

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    39

    Re: Need Help!! DBMS insert row

    All right I found it!!
    So it seems the text field can't be over 100 char... After that you have to use EDbColLongText.

    Julien

Similar Threads

  1. problems displaying video
    By gorsken in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2006-06-21, 17:18
  2. need help about DBMS
    By lengyuecau in forum Symbian
    Replies: 2
    Last Post: 2006-04-12, 08:35
  3. error when insert data twice on DBMS
    By Rx-lee in forum Symbian
    Replies: 1
    Last Post: 2005-03-21, 12:07
  4. update a DBMS row
    By white_dragon in forum Symbian
    Replies: 13
    Last Post: 2005-03-21, 12:06
  5. DBMS Insert panic error
    By zerglim in forum Symbian
    Replies: 3
    Last Post: 2004-07-23, 05:38

Posting Permissions

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