aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2016-12-28 12:51:36 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2016-12-28 12:58:48 +0100
commitae9e6d4ad7b7a67e90a16af432b55de5b3d7dbb5 (patch)
treef37c6631d4b9854d1f3667622c132893a66e56f0 /src/imports
parent3eeffae835b3474c8a3ca62125cb8ec24acdaa84 (diff)
parent9a272ad1854d744ea57296ba633b9d0dc19d1625 (diff)
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/localstorage/plugin.cpp22
-rw-r--r--src/imports/testlib/TestCase.qml11
2 files changed, 23 insertions, 10 deletions
diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp
index ebffb07346..d3ea93c80a 100644
--- a/src/imports/localstorage/plugin.cpp
+++ b/src/imports/localstorage/plugin.cpp
@@ -640,14 +640,32 @@ Below you will find an example of a database transaction which catches exception
\snippet qml/localstorage/dbtransaction.js 0
+In the example you can see an \c insert statement where values are assigned to the fields,
+and the record is written into the table. That is an \c insert statement with a syntax that is usual
+for a relational database. It is however also possible to work with JSON objects and
+store them in a table.
+
+Let's suppose a simple example where we store trips in JSON format using \c date as the unique key.
+An example of a table that could be used for that purpose:
+
+\snippet qml/localstorage/dbtransaction.js 3
+
+The assignment of values to a JSON object:
+
+\snippet qml/localstorage/dbtransaction.js 4
+
+In that case, the data could be saved in the following way:
+
+\snippet qml/localstorage/dbtransaction.js 5
+
\section3 db.readTransaction(callback(tx))
This method creates a read-only transaction and passed to \e callback. In this function,
-you can call \e executeSql on \e tx to read the database (with SELECT statements).
+you can call \e executeSql on \e tx to read the database (with \c select statements).
\section3 results = tx.executeSql(statement, values)
-This method executes a SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
+This method executes an SQL \e statement, binding the list of \e values to SQL positional parameters ("?").
It returns a results object, with the following properties:
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index ad7533c550..18c70e1169 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -567,7 +567,7 @@ Item {
\qmlmethod object TestCase::createTemporaryObject(Component component, object parent, object properties)
This function dynamically creates a QML object from the given
- \a component with the specified \a parent and \a properties.
+ \a component with the specified optional \a parent and \a properties.
The returned object will be destroyed (if it was not already) after
\l cleanup() has finished executing, meaning that objects created with
this function are guaranteed to be destroyed after each test,
@@ -589,12 +589,6 @@ Item {
throw new Error("QtQuickTest::fail");
}
- if (!parent && parent !== null) {
- qtest_results.fail("Second argument must be a parent object or null; actual type is " + typeof parent,
- util.callerFile(), util.callerLine());
- throw new Error("QtQuickTest::fail");
- }
-
if (properties && typeof properties !== "object") {
qtest_results.fail("Third argument must be an object; actual type is " + typeof properties,
util.callerFile(), util.callerLine());
@@ -614,7 +608,8 @@ Item {
function qtest_destroyTemporaryObjects() {
for (var i = 0; i < qtest_temporaryObjects.length; ++i) {
var temporaryObject = qtest_temporaryObjects[i];
- if (temporaryObject)
+ // ### the typeof check can be removed when QTBUG-57749 is fixed
+ if (temporaryObject && typeof temporaryObject.destroy === "function")
temporaryObject.destroy();
}
qtest_temporaryObjects = [];