×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    290

    Panic DBMS-Table 9 when view runs PutL

    Hi,


    first my table definition...

    Code:
    TBool CDatabaseEngine::CreateTableVoiceMailL()
    	{
    	_LIT( KTablename, "VoiceMail" );
    	_LIT( KIdCol, "vm_Id" );
    	_LIT( KRecordDateCol, "record_date" );
    	_LIT( KSoundCol, "sound" );
    	
    	if ( !DoesTableExistsL( KTablename ) )
    		{
    		CDbColSet *ColSet = CDbColSet::NewLC();
    				
    		TDbCol Fld_id( KIdCol, EDbColUint32 );	
    		Fld_id.iAttributes = TDbCol::ENotNull | TDbCol::EAutoIncrement;
    		ColSet->AddL( Fld_id );
    				
    		TDbCol Fld_RecordDate( KRecordDateCol, EDbColInt64 );
    		Fld_RecordDate.iAttributes = TDbCol::ENotNull;
    		ColSet->AddL( Fld_RecordDate );
    		
    		TDbCol Fld_Sound( KSoundCol, EDbColLongBinary ); 
    		Fld_Sound.iAttributes = TDbCol::ENotNull;			
    		ColSet->AddL( Fld_Sound );
    				
    		TInt Err = iDatabase.CreateTable( KTablename, *ColSet);
    		CleanupStack::PopAndDestroy( ColSet );
    		
    		return ( Err == KErrNone );
    		}
    	return ETrue; //no error nothing to do!
    	}

    and when i put data into ths table i got the error when reaching PutL

    Code:
    void CDatabaseEngine::CreateVoiceMailRecordSetL(const TDesC& aVMFilename, TUint32& aIndex )
    	{
    	RFile AMRFile;
    	TInt FileSize( -1 );
    	RDbColWriteStream SoundFileCol;
    	
    	TInt VMIndex( -1 );
    	TInt Err = AMRFile.Open( CCoeEnv::Static()->FsSession(), 
    							 aVMFilename, 
    							 EFileRead);
    	
    	if ( Err == KErrNone )
    		{
    		AMRFile.Size( FileSize );
    		HBufC8* FileContent = HBufC8::NewLC( FileSize );	
    		TPtr8 ptr = FileContent->Des();
    		AMRFile.Read( ptr, FileSize );		
    		AMRFile.Close();
    		
    		//prepare your RDbView with your query, execute etc.
    		_LIT( KSelectQuery, "SELECT * FROM %S" );
    		_LIT( KTablename, "VoiceMail" );
    		
    		HBufC* SQLStmt = HBufC::NewLC( 255 );	
    		SQLStmt->Des().Format(  KSelectQuery, &KTablename() );			
    		//Start transaction
    		TInt Err = iDatabase.Begin();
    		
    		if ( Err == KErrNone )
    			{		
    			RDbView table;	
    			
    			table.Prepare( iDatabase, TDbQuery( *SQLStmt ) );
    			CleanupClosePushL( table );
    			table.InsertL();
    		
    			TInt64 record_date ( GetCurrentTimeMillis() );
    			table.SetColL( 2, record_date );
    					
    			SoundFileCol.OpenL( table, 3);
    			SoundFileCol.WriteL( *FileContent, FileSize );			
    			
    			table.PutL();
    			
    			aIndex = table.ColUint32(1);
    		
    			table.Close();
    	    
    			CleanupStack::PopAndDestroy( 1 ); //table
    			}
    		
    		CleanupStack::PopAndDestroy( SQLStmt );	    
    		CleanupStack::PopAndDestroy( FileContent );
    		//End transaction
    		iDatabase.Commit();
    		iDatabase.Compact();	
    		
    		TRAPD(FileErr, CCoeEnv::Static()->FsSession().Delete( aVMFilename ) );
    		if( FileErr != KErrNone )
    			{
    			//ToDo
    			}
    		}	
    	}

    But what went wrong?

    Greetz
    Franky

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Panic DBMS-Table 9 when view runs PutL

    Have you closed SoundFileCol (RDbColWriteStream )???

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    290

    Thumbs up Re: Panic DBMS-Table 9 when view runs PutL

    Hi,

    Thanks for your reply!
    Yes! My fault. I forgot to close the stream. One Question : when do i use Commit?


    Greetz
    Franky

Similar Threads

  1. View changing
    By ckt in forum Symbian
    Replies: 7
    Last Post: 2007-02-22, 13:02
  2. Trigger event after view is Activated?
    By inc0gn1t007 in forum Symbian
    Replies: 0
    Last Post: 2006-03-29, 02:55
  3. Replies: 1
    Last Post: 2005-10-17, 04:23
  4. Embedded application gives panic when runs for the second time
    By hesham.galal in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2005-01-02, 20:42
  5. Replies: 2
    Last Post: 2004-02-05, 12:12

Posting Permissions

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