[Qt-qml] qml executeSql failure
jamiesun
jamiesun.net at gmail.com
Fri Jan 14 08:32:00 CET 2011
Thank you.
I added the code:
viewer.engine () -> setOfflineStoragePath ("E: / / DB //");
Now I find app just created a ini file, but no database files.
openDatabaseSync also failed
is BUG?
2011/1/14 Jason H <scorp1us at yahoo.com>
> I'm not sure of your problem, but everytime I have a problem with sqlite,
> it is because of the transaction isolation level. Normally, there wil be a
> -journal file created for your transaction and will go away when complete.
> If it remains, then you never finished the transaction. When you open the
> database the next time the journal file will not be commited, only removed.
>
> HTH
>
>
>
>
> ------------------------------
> *From:* jamiesun <jamiesun.net at gmail.com>
> *To:* QmlGroup <qt-qml at qt.nokia.com>
> *Sent:* Thu, January 13, 2011 10:29:02 PM
> *Subject:* [Qt-qml] qml executeSql failure
>
> 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/dabf4ee5/attachment-0001.html
More information about the Qt-qml
mailing list