ERROR in writing to database in N9
my pakcage in N9 contains a sqlite database file located in opt/myproject/Databases/
and i 've successfully connect the database through my codes
Then i do the following codes:
db.transaction(function(tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');
// Add (another) greeting row
tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ]);
when i debug it with QT simulator ,it began error like the below description.
Error: attempt to write a readonly database Unable to fetch row
//And i 've found that ,if i deploy any files in the N9's opt/ directory ,i can only read and cant write to it .
What was wrong ,and how i could do to write the file???
Re: ERROR in writing to database in N9
Most likely the actual files are in read only mode. That's the standard unless you specifically do something about it.
However recommended place for user writable files are in user's home directory /home/user. So perhaps you could copy database files to /home/user/.somedir on applications first startup?
Other possibility is to change file permissions in postinst script.
Edit:
Maybe you should refer again to data storage locations documentation. /home/user/.somedir is just quick and dirty, but you should you the official locations.
[url]http://harmattan-dev.nokia.com/docs/library/html/guide/html/Developer_Library_Essential_concepts_for_Harmattan_developers_Data_storage.html[/url]
Re: ERROR in writing to database in N9
yeah,thank you for answering my problem.
Hoever i cant find any useful imfomation in thu url you given,and i 've read much of the developer doucument and didnt find any useful imfomation.
Perhaps i am not familiar with what solution you were talking,I wonder if you or anyone can directly tell me a solution to solve this problem.
'could copy database files to /home/user/.somedir on applications first startup?' as this you told, how could i do so?
Re: ERROR in writing to database in N9
I've solved this problem by myself.Just use the postinst file and add some commands in it such as change the database's permissions in local file system is OK.
Very easy..