Well after a lot of fighting with the database engine of symbian and finding some problem and thank god was able to fix them. I am faced with a new one that i have no idea how to move around. I have a two databases and I read from one some information and insert into the other. Doing the inserting once and seeing the output of the other database works fine and the data has been moved normally. The problem is that when i try to enter data twice in arrow the second database is locked since I guess the insertion is still working on the database file. But i has returned from the function call. Closing the database doesn't work. Here is a sample of my insertion code.
Code:
_LIT(KSQLInsert, "SELECT Word, Definition FROM Words"); view->Prepare((RDbDatabase&) *this,TDbQuery(KSQLInsert)); view->InsertL(); view->SetColL(1,Word); view->SetColL(2,Defintion); view->PutL(); //Using the Begin and Commit style doesn't work either
Did you open a connection to the DBMS server and your database file before ? Something like the code below should work :
Code:
RDbNamedDatabase db; TBuf<255> query; User::LeaveIfError(db.Open(iDbs,KYourDatabase)); // iDBs is connection to the DBMS server CleanupClosePushL(db); _LIT(KSQLQuery,"Insert into Words (Word,Definition) values ('%S','%S')")); query.Format(KSQLQuery,&Word,&Definition); db.Execute(query); CleanupStack::PopAndDestroy(); // db
(Note that - as you did - using HBufC instead of TBuf is preferable )
Cheers, Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Sorry may be i didn't make myself clear. I have two view one with list and the other has txt editor. The first view displays the words and the second one displays the word and definition. The problem happens when i insert twice to another database. When i try going back to view the words that I have inserted in the other database and i try to open it It would return that it is already in use. This problems doesn't happen when i enter only once into the database it happens when i enter twice after each other. So I am not sure what the problem is but the words are inserted correctly but I have to close the application and then open it to see the words that I have added.
Eric YOU ARE THE MAN!!! your advice althought I don't understand it really works. I changed my code to open the database with the RDbs instead of and RFs and it worx fine. The question WHY?? what makes it so diffrent.
The reason is that using the DBMS server adds a little bit of overhead but allow several entities to acces a same database simultaneously while using it directly through the file server locks it to the first views that opened it.
Cheers, Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
This will most probably not work. Paths in the Symbian Environment (Emulator or Target) have to be relative to the disk setup. In other words, remove the Windows specific path and just leave c:\\Document\\VoiceCalendar\\vcalnotes.db.
Forum posts: 2133
Something like the code below should work :
TBuf<255> query;
User::LeaveIfError(db.Open(iDbs,KYourDatabase)); // iDBs is connection to the DBMS server
CleanupClosePushL(db);
_LIT(KSQLQuery,"Insert into Words (Word,Definition) values ('%S','%S')"));
query.Format(KSQLQuery,&Word,&Definition);
db.Execute(query);
CleanupStack::PopAndDestroy(); // db
(Note that - as you did - using HBufC instead of TBuf is preferable )
Cheers,
Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 93
Forum posts: 93
Forum posts: 2133
Cheers,
Eric
Eric Bustarret
NewLC Founder & CEO / Professional Symbian OS Consultant
Forum posts: 2
Orginally i have this function to create database
RFs fsSession;
RDbNamedDatabase database;
void CNoteAppViewStub::CreateDB()
{
_LIT(KDbFileName,"C:\\Symbian\\UIQ_70\\epoc32winscw\\c\\Documents\\VoiceCalendar\\vcalnotes.db");
_LIT(KSQLCreateTable, "CREATE TABLE notesEntry(id COUNTER,note varchar,alarm varchar,private varchar)");
User::LeaveIfError(fsSession.Connect());
User::LeaveIfError(database.Create(fsSession, KDbFileName));
User::LeaveIfError(database.Execute(KSQLCreateTable));
database.Close();
fsSession.Close();
}
However, i get this error msg:
Link Error : Undefined symbol: 'int RFs::Connect(int) (?Connect@RFs@@QAEHH@Z)'
i have tried changing
RFs fsSession to RDbs fsSession, but i still encounter problems as followed :
illegal implicit conversion from 'RDbs' to 'RFs &'
What should i do to create a database?
Forum posts: 106
Link Error : Undefined symbol: 'int RFs::Connect(int) (?Connect@RFs@@QAEHH@Z)'
Are you linking with efsrv.lib?
This will most probably not work. Paths in the Symbian Environment (Emulator or Target) have to be relative to the disk setup. In other words, remove the Windows specific path and just leave c:\\Document\\VoiceCalendar\\vcalnotes.db.
Regards,
Varun
Forum posts: 2
But the error still show::
Link Error : Undefined symbol: 'int RFs::Connect(int) (?Connect@RFs@@QAEHH@Z)'
Forum posts: 24
mayb its a late reply...
hav u re-build ur mmp files?
hope u olredi solved it anyway...