×

Discussion Board

Results 1 to 8 of 8

Thread: return RArray

  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129

    return RArray

    Hi,

    I need help in returning RArray.

    Here is my code
    Code:
    in header file
    --------------
    RArray<TData> ReadDbItemsL();
    
    in cpp file
    -----------
    RArray<TData> CDBManager::ReadDbItemsL()
    	{
    
    	RArray<TData> aItemArray;
    
    	TFileName QueryBuffer;
    	QueryBuffer.Copy(_L("SELECT * FROM "));
    	QueryBuffer.Append(KtxtDatalist);
    
    	RDbView Myview;
    	Myview.Prepare(iDatabase, TDbQuery(QueryBuffer));
    	CleanupClosePushL(Myview);
    	Myview.EvaluateAll();
    	Myview.FirstL();
    
    	Myview.GetL();
    	TData NewItem;
    	NewItem.Reset();
    	NewItem.iPhonenumber.Copy(Myview.ColDes(0));
    	NewItem.iSlid.Copy(Myview.ColDes(1));
    	NewItem.iMacaddress.Copy(Myview.ColDes(2));
    	NewItem.iPin.Copy(Myview.ColDes(3));
    	NewItem.iRid.Copy(Myview.ColDes(4));
    	aItemArray.Append(NewItem);
            CleanupStack::PopAndDestroy(1);
    	return aItemArray;//Multiple markers at this line
    	                    - 'RArray<TData> *'
    	                       - illegal implicit conversion from 
    	                          'RArray<TData>' to
    	}
    
    source file calling ReadDbItemsL
    I am doing like this 
    RArray<TSlimActData> aitemarray = iDBManager->ReadDbItemsL();
    
    ERROR:
    Multiple markers at this line
    	- 'RArray<TSlimActData>::RArray(int, int)'
    	- 'RArray<TSlimActData>::RArray(int, TSlimActData *, int)'
    	- function call '[RArray<TSlimActData>].RArray(RArray<TData>)' does not 
    	 match
    	- 'RArray<TSlimActData>::RArray(int)' (explicit)
    	- 'RArray<TSlimActData>::RArray(const RArray<TSlimActData> &)'
    	- 'RArray<TSlimActData>::RArray()'
    	- 'RArray<TSlimActData>::RArray(int, int, int)'
    Kindly let me know where exactly the problem arises.

    Regards,
    kusuma

  2. #2
    Super Contributor
    Join Date
    Nov 2004
    Posts
    1,009

    Re: return RArray

    Try return it like &aItemArray

  3. #3
    Regular Contributor
    Join Date
    Feb 2007
    Location
    Mumbai
    Posts
    67

    Re: return RArray

    Its simply a problem of type mismatch.. u are returning RArray<TData> and assigning it to RArray<TSlimActData>..

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,671

    Re: return RArray

    Besides that the compiler is usually right (there are some differences between the character sequences TSlimActData and TData), you should never attempt returning local RArray-s.
    Either get an reference of an array of the caller("void CDBManager::ReadDbItemsL(RArray<TData> &aItemArray)" - via this approach the name "aItemArray" also starts to make sense)
    Or return a pointer to a CArrayFix<TData>, which you create inside the method ("CArrayFix<TData> * CDBManager::ReadDbItemsL()").

  5. #5
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129

    Re: return RArray

    Hi wizard_hu_

    Thanks its working.

    I am having problem with the line in the code
    Code:
    
    TBuf<256> phonenumber;
    iDBManager->SaveToDatabaseL(phonenumber,0);
    
    and the fun def is like
    
    void DBManager::UpdateDatabaseL(const TDesC& aValue,TInt& iIndex){
    //mycode
    
    ERROR:
    ------
    CDBManager::SaveToDatabaseL(TDesC16&,int&)(non-static)
    function call [CDBManager].SaveToDatabaseL({Ival}TBuf<256>,int) does not match
    
    }
    please let me know the issue
    Regards,
    Lakshmi

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

    Re: return RArray

    either change the UpdateDatabaseL(const TDesC& aValue,TInt& iIndex) to UpdateDatabaseL(const TDesC& aValue,const TInt& iIndex)

    or define the TInt befor ecalling the func, i.e like this:

    TInt indexxx(0);
    iDBManager->SaveToDatabaseL(_L("887676"),indexxx);

  7. #7
    Regular Contributor
    Join Date
    Oct 2008
    Location
    Bangalore,India
    Posts
    129

    Re: return RArray

    hi symbianyucca

    Thanks

    i kept on finding the problem with descriptor and doesn't even look what is happening with integer.

    regards,
    Kusuma

  8. #8
    Nokia Developer Champion
    Join Date
    Jul 2004
    Posts
    2,015

    Re: return RArray

    iDBManager->SaveToDatabaseL(phonenumber,0);
    CDBManager::SaveToDatabaseL(TDesC16&,int&)


    Look at the & in int&, look at what you are passing as a parameter. Is a reference to 0 possible do you suspect?

    P.S.
    TDesC16& should be declared as const TDesC16&

Similar Threads

  1. return Rarray from the function
    By m_afatah in forum Symbian
    Replies: 8
    Last Post: 2009-06-02, 22:22
  2. can we return RArray ?
    By nokia_lin in forum Symbian
    Replies: 4
    Last Post: 2009-04-01, 04:16
  3. How to port Symbian OS String Descriptors
    By birol.sekerci in forum Symbian
    Replies: 17
    Last Post: 2007-11-08, 16:24
  4. Replies: 6
    Last Post: 2005-10-03, 05:51
  5. 关于Float的问题,急死了,各位帮忙一下,谢谢!
    By show_up in forum [Archived] Other Programming Discussion 关于其他编程技术的讨论
    Replies: 4
    Last Post: 2004-08-17, 08: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
  •  
×