summaryrefslogtreecommitdiffstats
path: root/src/declarative/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/extra')
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp31
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp36
2 files changed, 35 insertions, 32 deletions
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index a39aa6f..25ab033 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -79,13 +79,14 @@ public:
Qml the query should connect using its name.
\qml
- <SqlConnection id="myConnection">
- <name>qmlConnection</name>
- <driver>QSQLITE</driver>
- <databaseName>"mydb.sqlite"</databaseName>
- </SqlConnection>
- <SqlQuery id="listmodel" connection="{myConnection}">SELECT * FROM mytable</SqlQuery>
- <SqlQuery id="othermodel" connection="qmlConnection">SELECT * FROM myothertable</SqlQuery>
+ SqlConnection {
+ id: myConnection
+ name: "qmlConnection"
+ driver: "QSQLITE"
+ databaseName: "mydb.sqlite"
+ }
+ SqlQuery { id: listmodel; connection: myConnection; query: "SELECT * FROM mytable" }
+ SqlQuery { id: othermodel; connection: "qmlConnection"; query: "SELECT * FROM myothertable" }
\endqml
*/
@@ -99,34 +100,34 @@ public:
*/
/*!
- \qmlproperty QStringList SqlConnection::tables
+ \qmlproperty list<string> SqlConnection::tables
Defines the set of tables that exist in the database for the connection.
*/
/*!
- \qmlproperty QString SqlConnection::databaseName
+ \qmlproperty string SqlConnection::databaseName
Defines the connection's database name. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::driver
+ \qmlproperty string SqlConnection::driver
Defines the driver type of the connection. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::connectOptions
+ \qmlproperty string SqlConnection::connectOptions
Defines the options used when connecting to the database. These are used
when opening the connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::hostName
+ \qmlproperty string SqlConnection::hostName
Defines the connection's host name. This is used when opening the
connection to the database.
@@ -140,21 +141,21 @@ public:
*/
/*!
- \qmlproperty QString SqlConnection::userName
+ \qmlproperty string SqlConnection::userName
Defines the connection's user name. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::password
+ \qmlproperty string SqlConnection::password
Defines the connection's password. This is used when opening the
connection to the database.
*/
/*!
- \qmlproperty QString SqlConnection::lastError
+ \qmlproperty string SqlConnection::lastError
Defines the last error, if one occurred, when working with the database.
If the error occurred in conjunction with an SQL query the error will be
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 70b3bdd..5bd1459 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -77,18 +77,19 @@ public:
values will only apply when the SqlQuery exec() slot is called.
\qml
- <SqlQuery>
- SELECT * FROM mytable WHERE name LIKE :value
- <bindings>
- <SqlBind name=":value" value="{searchText + '%'}"/>
- </bindings>
- </SqlQuery>
- <SqlQuery>
- SELECT * FROM mytable WHERE type = ?
- <bindings>
- <SqlBind value="simple"/>
- </bindings>
- <SqlQuery>
+ SqlQuery {
+ query: "SELECT * FROM mytable WHERE name LIKE :value"
+ bindings: SqlBind {
+ name: ":value"
+ value: searchText + '%'
+ }
+ }
+ SqlQuery {
+ query: "SELECT * FROM mytable WHERE type = ?"
+ bindings: SqlBind {
+ value: "simple"
+ }
+ }
\endqml
*/
@@ -254,11 +255,12 @@ public:
appropriate table column name for the result column.
\qml
- <SqlQuery connection="{qmlConnectionId}" query="DELETE FROM mytable"/>
- <SqlQuery connection="connectionName">
- SELECT * FROM mytable
- </SqlQuery>
- <SqlQuery>SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable</SqlQuery>
+ SqlQuery { connection: qmlConnectionId; query: "DELETE FROM mytable" }
+ SqlQuery {
+ connection: "connectionName"
+ query: "SELECT * FROM mytable"
+ }
+ SqlQuery { query: "SELECT id AS recordId, (firstName || ' ' || lastName) AS fullName FROM mytable" }
\endqml
*/