database issue

Login to reply to this topic.
Mon, 2004-08-23 08:14
Joined: 2004-06-22
Forum posts: 148
i write the following code in my dialog class for creating the database:-

CMyDatabase database;
database.MakeDatabase(database);

in CMyDatabase:-

void CMyDatabase::MakeDatabase(RDbNamedDatabase database)
{
   //create the file session

   RFs fsSession;
   User::LeaveIfError(fsSession.Connect());
   CleanupClosePushL(fsSession);
   
 //create the database   

   _LIT(KDbFileName,"C:\\mydatabase");
   User::LeaveIfError(database.Create(fsSession, KDbFileName));
   CleanupClosePushL(database);
   
// Create tables etc.
   CleanupStack::PopAndDestroy();//database
}

gives me an error:-

Error   : illegal access to protected/private member
CDemoTextListBoxControl.cpp line 66  
Error   : Compile failed

i know i am making a silly mistake will someone please point it out to me.
ciao

Mon, 2004-08-23 08:49
Joined: 2004-07-10
Forum posts: 364
Re: database issue
Well what's at line 66 in CDemoTextListBoxControl.cpp?
Mon, 2004-08-23 09:15
Joined: 2004-06-22
Forum posts: 148
database issue
database.MakeDatabase(database);
 this is the line 66 code..as i am calling the function and then passing the same object as well in it..could this be the error..?
ciao
Mon, 2004-08-23 09:23
Joined: 2004-05-24
Forum posts: 982
database issue
Quote from: mayankkedia
database.MakeDatabase(database);
  this is the line 66 code..as i am calling the function and then passing the same object as well in it..could this be the error..?
ciao

Can you provide h file for CMyDatabase?

pirosl

Mon, 2004-08-23 09:29
Joined: 2004-06-22
Forum posts: 148
database issue
*/

#ifndef CMyDatabase_H
#define CMyDatabase_H
#include "d32dbms.h "
#include "f32file.h"


class CMyDatabase: RDbNamedDatabase
{
public:
   CMyDatabase();
   virtual ~CMyDatabase();
   void MakeDatabase(RDbNamedDatabase);

};

#endif   // CMyDatabase_H

thats the .h for CMyDatabase
ciao
Mon, 2004-08-23 09:38
Joined: 2004-05-24
Forum posts: 982
database issue
Your problem is very simple. The error is because you don't have access to a copy constructor in RDbNamedDatabase.
To solve you problem make like this:
in h file:
class CMyDatabase: RDbNamedDatabase
{
public:
CMyDatabase();
virtual ~CMyDatabase();
void MakeDatabase(RDbNamedDatabase*);

};


in cpp file

CMyDatabase* database = new CMyDatabase();
database->MakeDatabase(database);

And of course other changes in MakeDatabase according to the fact that you have a pointer now.


Lucian

pirosl

Mon, 2004-08-23 09:48
Joined: 2004-06-22
Forum posts: 148
database issue
but once i have a pointer can i write things like..:-
User::LeaveIfError(database.Create(fsSession, KDbFileName));
CleanupClosePushL(database);
?
ciao
Mon, 2004-08-23 09:55
Joined: 2004-05-24
Forum posts: 982
database issue
Quote from: mayankkedia
but once i have a pointer can i write things like..:-
User::LeaveIfError(database.Create(fsSession, KDbFileName));
CleanupClosePushL(database);
?
ciao

User::LeaveIfError(database->Create(fsSession, KDbFileName));
CleanupClosePushL(database);

Normally it's possible

Lucian

pirosl

Mon, 2004-08-23 09:59
Joined: 2004-06-22
Forum posts: 148
database issue
i did what u suggested now m getting the following error..:-

Error   : illegal access to protected/private member
CDemoTextListBoxControl.cpp line 66  

Error   : Compile failed

Error   : expression syntax error  (instantiating: 'CleanupClose<RDbNamedDatabase *>::Close(void *)')
E32BASE.INL line 490  

Error   : Compile failed

ciao
Mon, 2004-08-23 10:14
Joined: 2004-05-24
Forum posts: 982
database issue
Can you provide line 66 from you cpp code?

pirosl

Mon, 2004-08-23 10:23
Joined: 2004-06-22
Forum posts: 148
database issue
in the CMyDatabase i am now making a class level variable of type RDbNamedDatabase and using it to make the database and from the DialogController i am not passing anything but simply calling the function i need.
now the problem i am facing is that the database that has been created cant be opened
it says:-UnRecognised database format 'C:\Symbian\UIQ_70\epoc32\winscw\c\mydatabase.mdb
 Also another issue that i am facing is that it shows me the database in the C drive but my application crashes..
   can anyone tell me what could be the issue?
ciao
Mon, 2004-08-23 10:26
Joined: 2004-05-24
Forum posts: 982
database issue
Can't be opened from your Symbian application or other application?

pirosl

Mon, 2004-08-23 10:32
Joined: 2004-06-22
Forum posts: 148
database issue
from other applications, for instance if i go to the path on my computer and try to open the database it gives me the error i have posted earlier..
 also my database is being created but the application crashes.
ciao
Mon, 2004-08-23 10:38
Joined: 2004-05-24
Forum posts: 982
database issue
Quote from: mayankkedia
from other applications, for instance if i go to the path on my computer and try to open the database it gives me the error i have posted earlier..
  also my database is being created but the application crashes.
ciao

Symbian db has a proprietary format. It's like you want to open an oracle db with ms sql (not possible). For  "also my database is being created but the application crashes." can you let us know what error do you have there....with what error code crashes your app.

Lucian

pirosl

Mon, 2004-08-23 10:49
Joined: 2004-06-22
Forum posts: 148
database issue
there are no errors on the emulator..the application hangs and displayes the dialog box with the following message:-

epoc.exe has encountered a problem and needs to close.  

Also what format is the database that is being created?do i have to specify such as *.mdb etc or just say the database name and it will take the database name on its own?
 one more thing once i have inserted things into the database and now i want to display the contents how do i do it..will a simple :iEikonEnv->InfoMsg(data); work for me?
ciao
Mon, 2004-08-23 11:19
Joined: 2004-06-22
Forum posts: 148
database issue
even my application can not access the data..when i try to open or query the database my application crashes in the same way it did when i try to create the database...can anyone help me out with it please?
ciao
  • Login to reply to this topic.