Mobile Web

Web SQL Database

This feature is supported in mobile applications only.

The Web SQL database provides a way to store databases that can be queried using various SQL statements.

Each Tizen application can store multiple databases and each one of them can store multiple tables. Databases can be accessed using the SQL language, which is a common standard for these kinds of applications.

When working with the SQL database, you can use the following approaches:

  • Asynchronous database API

    A script is not blocked during calls of statements described in the API. Succession of operations is provided by event handlers. This approach does not block user interface during long operations and can be used anywhere in your application.

  • Synchronous database API

    To start an operation, you must wait for the previous one to be completed. This approach can be used only with Web Workers.

The main Web SQL database features include:

  • SQL database creation

    You can create and open a SQL database asynchronously or synchronously.

  • SQL statement execution

    You can execute SQL statements asynchronously or synchronously.

  • SQL statement result access

    You can access the result object asynchronously or synchronously.

  • Error management

    You can handle errors asynchronously or synchronously.

    The following table describes the properties that can be delivered with the sqlError object.

    Table: Web SQL errors
    Name Description

    message

    Read-only. Message describing the error that has occurred (must respect user language).

    code

    Read-only. Code of the error that has occurred (equals to one of below constants).

    UNKNOWN_ERR

    Constant. The transaction failed for reasons unrelated to the database itself and not covered by any other error code.

    DATABASE_ERR

    Constant. The statement failed for database reasons not covered by any other error code.

    VERSION_ERR

    Constant. The operation failed because of an invalid database version.

    TOO_LARGE_ERR

    Constant. The statement failed because the data returned from the database was too large. The SQL LIMIT modifier can be used to reduce the size of the result set.

    QUOTA_ERR

    Constant. The statement failed because there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.

    SYNTAX_ERR

    Constant. The statement failed because of a syntax error, or the number of arguments did not match the number of placeholders in the statement, or the statement tried to use a statement that is not allowed, such as BEGIN, COMMIT, or ROLLBACK, or the statement tried to use a verb that can modify the database but the transaction was read-only.

    CONSTRAINT_ERR

    Constant. An INSERT, UPDATE, or REPLACE statement failed due to a constraint, for example, because a row was being inserted and the value given for the primary key column duplicated the value of an existing row.

    TIMEOUT_ERR

    Constant. A lock for the transaction was not obtained in a reasonable time.

Note
The Web SQL Database API is still in group note state, but Tizen supports it as it is already widely used in the industry.
Go to top