CopperSpice API  1.8.1
QWebDatabase Class Reference

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

Public Methods

 QWebDatabase (const QWebDatabase &other)
 ~QWebDatabase ()
QString displayName () const
qint64 expectedSize () const
QString fileName () const
QString name () const
QWebDatabase & operator= (const QWebDatabase &other)
QWebSecurityOrigin origin () const
qint64 size () const

Static Public Methods

static void removeAllDatabases ()
static void removeDatabase (const QWebDatabase &db)


class QWebSecurityOrigin

Detailed Description

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

The 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.

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 CsSql database library.

For each database the web site can define an expectedSize(). The current size of the database in bytes is returned by size().

See also

Constructor & Destructor Documentation

QWebDatabase::QWebDatabase ( const QWebDatabase &  other)

Constructs a web database from other.

QWebDatabase::~QWebDatabase ( )

Destroys the web database object. The data within this database is not destroyed.

Method Documentation

QString QWebDatabase::displayName ( ) const

Returns the name of the database in a format that is suitable for display to the user.

qint64 QWebDatabase::expectedSize ( ) const

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

QString QWebDatabase::fileName ( ) const

Returns the file name of the web database. The name can be used to access the database through the CsSql database library.

QWebDatabase webdb = ...
QSqlDatabase sqldb = QSqlDatabase::addDatabase("QSQLITE", "myconnection");
if ( {
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.
QString QWebDatabase::name ( ) const

Returns the name of the database.

QWebDatabase & QWebDatabase::operator= ( const QWebDatabase &  other)

Copy assigns from other and returns a reference to this object.

QWebSecurityOrigin QWebDatabase::origin ( ) const

Returns the database's security origin.

void QWebDatabase::removeAllDatabases ( )

Deletes all web databases in the configured offline storage path.

See also
void QWebDatabase::removeDatabase ( const QWebDatabase &  db)

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

qint64 QWebDatabase::size ( ) const

Returns the current size of the database in bytes.