-1

I am developing an app for Blackberry devices. This app contains a database. As the API are provided on the last API version, I decided to use SQLite.

I followed every sample I could find everywhere but whatever happens,I cannot see the database. From where i could retrieve the data.

I should add that I am currently working on the simulator.

If anybody have any idea how to store receiving message in messaging app then please help me out.

Nikkii
  • 15
  • 3

1 Answers1

0

I also found this very tricky, and remember it took a long while to work out. Eventually in desperation I wrote this handy function:

#include <QDebug>
#include <QDir>
#include <QList>
#include <QUrl>

#include <sstream>

using namespace bb::data;
using namespace std;

void listContents(QDir &src, int depth=0) {
    // You app's dirs can be symlinked into libraries, so the depth can go very deep.
    // We limit it.
    if (3<depth) return;
    QListIterator<QFileInfo> entries(src.entryInfoList());
    std::stringstream spaces;

    // If you want to indent files by depth
//  for (int i=0; i<depth; i++) {
//      spaces << ' ';
//  }

    while (entries.hasNext()) {
        QFileInfo entry = entries.next();
        QString canpath = entry.canonicalFilePath();
        QString relpath = src.relativeFilePath(entry.fileName());
        if ((relpath == ".") || (relpath=="..")) {
            continue;
        }
        if (entry.isDir()) {
            QDir subdir(canpath);
            if (!(subdir==src)) {
                listContents(subdir, depth+1);
            }
        } else {
                qDebug() << spaces.str().c_str() << canpath.toUtf8().data();
        }
    }
}

To use it, you must first strip the /data directory from your QDir::homePath():

QString appFolder(QDir::homePath());
qDebug() << "appFolder = " << appFolder;
appFolder.chop(4);

QDir listSource = appFolder + "app/native";
listContents(listSource);

Thereafter, just check the logs to find the proper path to your database file.

Note though that, if you want to write to the database, you should copy it from the app/native directory to the data directory.

craigmj
  • 4,827
  • 2
  • 18
  • 22