|  | Home · All Classes · Modules

# QWebDatabase Class Reference
[QtWebKit module]

The QWebDatabase class provides access to HTML 5 databases created with JavaScript. More...

### Methods

- __init__ (self, QWebDatabase)
- QStringQString displayName (self)
- int expectedSize (self)
- QStringQString fileName (self)
- QStringQString name (self)
- QWebSecurityOrigin origin (self)
- int size (self)

### Static Methods

- removeAllDatabases ()
- removeDatabase (QWebDatabase)

## Detailed Description

The QWebDatabase class provides access to HTML 5 databases created with JavaScript.

The upcoming HTML 5 standard includes support for SQL databases that web sites can create and access on a local computer through JavaScript. QWebDatabase is the C++ interface to these databases.

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().

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 HTML 5 Draft Standard.

See also QWebSecurityOrigin.

## Method Documentation

### QWebDatabase.__init__ (self, QWebDatabase)

Constructs a web database from other.

### QStringQString QWebDatabase.displayName (self)

Returns the name of the database as seen by the user.

### int QWebDatabase.expectedSize (self)

Returns the expected size of the database in bytes as defined by the web author.

### QStringQString QWebDatabase.fileName (self)

Returns the file name of the web database.

The name can be used to access the database through the QtSql database module, for example:

     QWebDatabase webdb = ...
     QSqlDatabase sqldb = QSqlDatabase.addDatabase("QSQLITE", "myconnection");
     sqldb.setDatabaseName(webdb.fileName());
     if (sqldb.open()) {
         QStringList tables = sqldb.tables();
         ...
     }

Note: Concurrent access to a database from multiple threads or processes is not very efficient because SQLite is used as WebKit's database backend.

### QStringQString QWebDatabase.name (self)

Returns the name of the database.

### QWebSecurityOrigin QWebDatabase.origin (self)

Returns the databases's security origin.

### QWebDatabase.removeAllDatabases ()

Deletes all web databases in the configured offline storage path.

This function was introduced in Qt 4.6.

See also QWebSettings.setOfflineStoragePath().

### QWebDatabase.removeDatabase (QWebDatabase)

Removes the database db from its security origin. All data stored in the database db will be destroyed.

### int QWebDatabase.size (self)

Returns the current size of the database in bytes.