aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/localstorage
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-18 13:07:22 +0200
committerUlf Hermann <ulf.hermann@qt.io>2016-09-21 11:16:28 +0200
commit02b4770c3d867bf0b562db63015a7137479db10a (patch)
tree57157d0101a295fd394bf9acc91dd216fb361264 /src/imports/localstorage
parent858c62583ff776edb8c9e539f0331f5d658de2d1 (diff)
parent345226aa3ecee8642c3bf46e40c981d4a49d958e (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/qml/qml/qqmltypeloader.cpp Change-Id: I07647700fc86764c95a5ef95c568e700a70fe45f
Diffstat (limited to 'src/imports/localstorage')
-rw-r--r--src/imports/localstorage/plugin.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index 7d96f11768..f76bca2747 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -585,9 +585,9 @@ import QtQuick.LocalStorage 2.0 as Sql
db = Sql.openDatabaseSync(identifier, version, description, estimated_size, callback(db))
\endcode
The above code returns the database identified by \e identifier. If the database does not already exist, it
-is created, and the function \e callback is called with the database as a parameter. \e description
-and \e estimated_size are written to the INI file (described below), but are otherwise currently
-unused.
+is created, and the function \e callback is called with the database as a parameter. \e identifier is the
+name of the physical file (with or without full path) containing the database. \e description and
+\e estimated_size are written to the INI file (described below), but are currently unused.
May throw exception with code property SQLException.DATABASE_ERR, or SQLException.VERSION_ERR.
@@ -595,7 +595,7 @@ When a database is first created, an INI file is also created specifying its cha
\table
\header \li \b {Key} \li \b {Value}
-\row \li Name \li The name of the database passed to \c openDatabase()
+\row \li Identifier \li The name of the database passed to \c openDatabase()
\row \li Version \li The version of the database passed to \c openDatabase()
\row \li Description \li The description of the database passed to \c openDatabase()
\row \li EstimatedSize \li The estimated size (in bytes) of the database passed to \c openDatabase()
@@ -615,12 +615,19 @@ you can call \e executeSql on \e tx to upgrade the database.
May throw exception with code property SQLException.DATABASE_ERR or SQLException.UNKNOWN_ERR.
+See example below.
+
+\snippet qml/localstorage/dbtransaction.js 2
+
\section3 db.transaction(callback(tx))
This method creates a read/write transaction and passed to \e callback. In this function,
you can call \e executeSql on \e tx to read and modify the database.
If the callback throws exceptions, the transaction is rolled back.
+Below you will find an example of a database transaction which catches exceptions.
+
+\snippet qml/localstorage/dbtransaction.js 0
\section3 db.readTransaction(callback(tx))
@@ -643,6 +650,9 @@ It returns a results object, with the following properties:
May throw exception with code property SQLException.DATABASE_ERR, SQLException.SYNTAX_ERR, or SQLException.UNKNOWN_ERR.
+See below for an example:
+
+\snippet qml/localstorage/dbtransaction.js 1
\section1 Method Documentation