×

Discussion Board

Results 1 to 3 of 3

Thread: DBMS issues...

  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    54

    DBMS issues...

    Code:
    int CSettingsDBClass::ConstructL()
    {
    	User::LeaveIfError(iFsSession.Connect());
    	TInt kError=-1;
    	TFileName DBFileName;
    	
    	DBFileName.Copy(_L("c:\\"));
    	DBFileName.Append(KtxDatabaseName);
    				
    	if(BaflUtils::FileExists(iFsSession, DBFileName))
    	{
    		kError = User::LeaveIfError(iItemsDatabase.Open(iFsSession, DBFileName));
    		if (kError < 0 )
    			return OPEN_FAILED;
    		else
    			return OPEN_SUCCESS;
    			
    	}
    	else
    	{	// no database exists so we make one
    	        kError = User::LeaveIfError(iItemsDatabase.Create(iFsSession, DBFileName));
    		// and will create the onlt table needed for it
    		if ( kError < 0 )
    			return CREATE_FAILED;
    		else
    		{
    			kError = CreateTableL(iItemsDatabase); 
    			return kError;
    		}
    			 
    	}
    
    }
    
    
    int CSettingsDBClass::CreateTableL(RDbDatabase& aDatabase) 
    {
    	// Create a table definition
    	CDbColSet* columns=CDbColSet::NewLC();
    	TInt kError;
    	
    	// Add Columns
    	TDbCol id(NCol0,EDbColInt32);
    	// automatic indexing for items,it is our key field.
    	id.iAttributes=id.EAutoIncrement;
    	columns->AddL(id);				 
    	
    	columns->AddL(TDbCol(NCol1, EDbColText, MAX_KEY_LENGTH));
    	columns->AddL(TDbCol(NCol2, EDbColText, MAX_KEY_LENGTH));
    	columns->AddL(TDbCol(NCol3, EDbColText, MAX_KEY_LENGTH));
    	
    	// Create a table
    	kError=User::LeaveIfError(aDatabase.CreateTable(KtxtItemlist, *columns));
    	// cleanup the column set
    	CleanupStack::PopAndDestroy(columns);
    	if (kError < 0)
    		return CREATE_FAILED;
    	else
    		return CREATE_SUCCESS;
    
    }

    the code crash after CreateTable is called. i can`t see the error because my application crash after i set over this function. can someone help?

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,738

    Re: DBMS issues...

    You got an error, and LeaveIfError leaves then, that is its role actually. If you want to get the error code for yourself, do not use it:
    Code:
    k=aDatabase.CreateTable(KtxtItemlist, *columns);
    then you will get the CREATE_FAILED stuff, if it helps. Consider checking the actual error code, it may be more useful than this binary (go/no go) result.

  3. #3
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    54

    Re: DBMS issues...

    Quote Originally Posted by wizard_hu_ View Post
    You got an error, and LeaveIfError leaves then, that is its role actually. If you want to get the error code for yourself, do not use it:
    Code:
    k=aDatabase.CreateTable(KtxtItemlist, *columns);
    then you will get the CREATE_FAILED stuff, if it helps. Consider checking the actual error code, it may be more useful than this binary (go/no go) result.
    thanks a lot again!
    Last edited by andreip; 2009-06-04 at 23:06.

Similar Threads

  1. Nokia 6085 - Push Registry Issues
    By alam.sher in forum Mobile Java Networking & Messaging & Security
    Replies: 9
    Last Post: 2009-02-10, 21:09
  2. Symbian DBMS size and performance issues
    By pinkhardlionel in forum Symbian
    Replies: 9
    Last Post: 2009-01-21, 01:26
  3. DBMS initialization - Panic DBMS 2
    By baroonokia in forum Symbian
    Replies: 2
    Last Post: 2008-12-19, 10:17
  4. DBMS and 7650
    By spirit827 in forum Symbian
    Replies: 1
    Last Post: 2003-04-30, 10:04
  5. How to Access 9210 Dbms file from my desktop application?
    By Nokia_Archive in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2002-06-03, 03:46

Posting Permissions

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