[Qt-qml] qml executeSql failure

jamiesun jamiesun.net at gmail.com
Fri Jan 14 04:29:02 CET 2011


I installed qt_installer.sis and sqlite3.sis

I copy the code from "declarative/sqllocalstorage/hello.qml"

I created a qtquick app and packaged into sis. (use the command
"qmake-symbian"
and "make sis" on ubuntu10.04)

But it can not get the right results.

It has been shown "?"

I modified the code:

   import Qt 4.7
>
>  Rectangle{
>
>     id: rectangle1
>
>     width: 320
>
>     height: 240
>
>     color: "#555555"
>
>     Component.onCompleted: text2.findGreetings()
>
>     Text {
>
>         id: text2
>
>         x: 10
>
>         y: 12
>
>         text: "?"
>
>         font.pointSize: 7
>
>         function findGreetings() {
>
>             var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000);
>
>             text1.text += "\n"+db.version
>
>              db.transaction(
>
>                 function(tx) {
>
>                     // Create the database if it doesn't already exist
>
>                     tx.executeSql('CREATE TABLE IF NOT EXISTS test(salutation TEXT, salutee TEXT)',[]);
>
>                     text1.text += "\n"+ "sql1 exec"
>
>                     // Add (another) greeting row
>
>                     tx.executeSql('INSERT INTO test VALUES(?, ?)', [ 'hello', 'world' ]);
>
>                     text1.text += "\n"+ "sql2 exec"
>
>                     // Show all added greetings
>
>                     var rs = tx.executeSql('SELECT * FROM test',[]);
>
>                     text1.text += "\n"+ "sql3 exec"
>
>                     text1.text += "\n"+ rs.rows.length
>
>                      var r = ""
>
>                     for(var i = 0; i < rs.rows.length; i++) {
>
>                         r += rs.rows.item(i).salutation + ", " + rs.rows.item(i).salutee + "\n"
>
>                     }
>
>                     text = r
>
>                 }
>
>             )
>
>         }
>
>      }
>
>      Text {
>
>         id: text1
>
>         y: 12
>
>         text: "msg:"
>
>         anchors.fill: parent
>
>         anchors.leftMargin: 120
>
>         anchors.rightMargin: 10
>
>         anchors.bottomMargin: 10
>
>         wrapMode: Text.WrapAnywhere
>
>         anchors.topMargin: 12
>
>         font.pointSize: 11
>
>     }
>
> }
>
>
The results:
? msg
       1.0

Now get the version, openDatabaseSync should be successful

I am sure that when running the first executeSql failed.

Why?

When I uninstall sqlite3.sis, my app does not open, I am sure that the
databasedriver is not a problem.

When the app run on the symbian, how do I get console log info, use the Text
widget is not very good
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-qml/attachments/20110114/8aeb414a/attachment-0001.html 


More information about the Qt-qml mailing list