#include <mw/QtWebKit/qwebdatabase.h>
class QWebDatabase |
The QWebDatabase class provides access to HTML 5 databases created with JavaScript.
Public Member Functions | |
---|---|
QWebDatabase(const QWebDatabase &) | |
~QWebDatabase() | |
QString | displayName() |
qint64 | expectedSize() |
QString | fileName() |
QString | name() |
QWebDatabase & | operator=(const QWebDatabase &) |
QWebSecurityOrigin | origin() |
void | removeAllDatabases() |
void | removeDatabase(const QWebDatabase &) |
qint64 | size() |
Databases are grouped together in security origins. To get access to all databases defined by a security origin, use QWebSecurityOrigin::databases(). Each database has an internal name(), as well as a user-friendly name, provided by displayName(). These names are specified when creating the database in the JavaScript code.
WebKit uses SQLite to create and access the local SQL databases. The location of the database file in the local file system is returned by fileName(). You can access the database directly through the QtSql database module.
For each database the web site can define an expectedSize(). The current size of the database in bytes is returned by size().
For more information refer to the {http://dev.w3.org/html5/webdatabase/}{HTML5 Web SQL Database Draft Standard}.
See also: QWebSecurityOrigin
~QWebDatabase | ( | ) |
Destroys the web database object. The data within this database is not destroyed.
QString | displayName | ( | ) | const |
Returns the name of the database in a format that is suitable for display to the user.
qint64 | expectedSize | ( | ) | const |
Returns the expected size of the database in bytes as defined by the web author.
QString | fileName | ( | ) | const |
Returns the file name of the web database.
QWebDatabase webdb = ... QSqlDatabase sqldb = QSqlDatabase::addDatabase("QSQLITE", "myconnection"); sqldb.setDatabaseName(webdb.fileName()); if (sqldb.open()) { QStringList tables = sqldb.tables(); ... }
Concurrent access to a database from multiple threads or processes is not very efficient because SQLite is used as WebKit's database backend.
void | removeAllDatabases | ( | ) | [static] |
See also: QWebSettings::setOfflineStoragePath()
void | removeDatabase | ( | const QWebDatabase & | ) | [static] |
Removes the database db from its security origin. All data stored in the database db will be destroyed.