Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
azazello
Posts: 40
Registered: ‎01-15-2012
My Device: Playbook Tablet
My Carrier: MTS

Re: QML database problem

[ Edited ]

default value for offlineStoragePath is

"/accounts/1000/appdata/com.example.appName/data/.qws/share/data///QML/OfflineStorage"

while some sqlite db stored in "/accounts/1000/appdata/com.example.appName/db"

 

upd:

changing of OfflineStoragePath works well for me: now it's look like "/accounts/1000/appdata/com.example.appName/data"

 

 

 

/rgds
Andrey Yaromenok aka azazello
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML database problem

./db is another symlink, pointing to a folder where the system-maintained media library is kept. It's also read-only for apps.

I forgot ./logs though. That's writable as well. Not, however, that neither ./logs nor ./tmp provides any guarantee about how long data written there will persist. Generally both should be cleared every time your app starts, and may be deleted at any time it's not running, to clear up flash storage space.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
dw87
Posts: 13
Registered: ‎02-25-2012
My Device: Blackberry Playbook
My Carrier: ...

Re: QML database problem

Ok, I've managed to set offline storage path to /accounts/1000/appdata/com.tester.Fiszki.testDev_ster_Fiszki48c4afc/data but still I can't create table. 

In line:

tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)');

my findGreetings() function is stopped.

I have no more ideas what is wrong... 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML database problem

Not knowing QtQuick well yet, I can't say exactly what's wrong but can only provide suggestions.

 

I notice the example code in the docs (on which you've obviously based this) does not include the empty array argument in the CREATE TABLE call.

 

In the same docs, it notes that an INI file should be created by the openDatabaseSync() call, with some metadata written to it. Can you check in the ./data folder to see whether that's been created?  You'd need to know how to SSH in, or use some other technique.  See http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeglobalobject.html#db-opendatabasesync-identifier-ve... for where it mentions the INI.

 

If you don't see the INI file anywhere, I would assume the database is not really open...


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
dw87
Posts: 13
Registered: ‎02-25-2012
My Device: Blackberry Playbook
My Carrier: ...

Re: QML database problem

INI file I see, but I can't fount .sqlite / .db file. 

openDatabaseSync create *.ini file and empty dir "Databases".

I think that I must go sleep:smileywink: Thanks for your help. Goodnight.

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML database problem

Can you post the contents of the INI file here, and also say what folder it is found in?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Contributor
dw87
Posts: 13
Registered: ‎02-25-2012
My Device: Blackberry Playbook
My Carrier: ...

Re: QML database problem

[ Edited ]

This folder is empty (or I can't open correctly) .  I will attempt to open the ini file at the morning. I'm going to sleep, because is 5a.m. in Europe already :smileywink:p

Please use plain text.
Contributor
dw87
Posts: 13
Registered: ‎02-25-2012
My Device: Blackberry Playbook
My Carrier: ...

Re: QML database problem

Hi,

I've managed to open the ini file.

It includes data who I set in my qml:

[General]

Description=Fiszki

Driver=QSQLITE 

EstimatedSize=1000000 

Name=Base 

Version=1.0 

 

In the Databases folder I've found the same ini file like in. /data (the same name, and the same content)

Still I can't find database file.

 

 

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML database problem

There probably shouldn't be 2 INI files, and in any case the content of the one you posted there doesn't match the code you originally posted. Could you try to delete both of these and re-run to show which folder actually gets the INI file (assuming there is only one) and confirm that you're running different code than what you showed earlier?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: QML database problem

Also, you said your findGreetings() function is "stopped". Is that all you can say about that? No exception or traceback shown, or an error message? Have you checked the ./logs folder (a sibling of the ./data folder) to see if the log file can add any info? I would think there should be an error code reported somewhere, at least.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.