- This topic has 4 replies, 3 voices, and was last updated 12 years, 4 months ago by
support-octavio.
-
AuthorPosts
-
upasanaMemberI am trying to execute an insert sql query, this works fine on sqlite
The table isCREATE TABLE IF NOT EXISTS tbl_test (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, Date TEXT NOT NULL, MType TEXT NOT NULL, MItems TEXT NOT NULL )
the table is created as could be seen from the debugger.
Now i am trying to execute an insert query on the same
var date="12/12/2012"; var mType='1'; var mItems='1,2,3'; db.transaction(function (tx) { tx.executeSql("INSERT INTO tbl_test (Date, MType , MItems ) VALUES ('"+date+"','"+mType+"','"+mItems+"')",function(tx,result) {},function(tx,Error) { }); });
Now the problem is that this is not executing. But the query works fine in sqlite manageer, i have tested. I want to be able to debug and check db transaction errors. The mobione test center and design center hangs and I have to restart things again and again to test a single case.
Max87MemberHi upasana,
you have error in insert query.
Try to modify it by this key:db.transaction(function(tx) { tx.executeSql("INSERT INTO tbl_test (Date, MType , MItems ) VALUES (?,?,?)", [date, mType, mItems],db.onSuccess, db.onError ); });
upasanaMemberHi Max87
Thanks for correcting me. The insertion is now happening properly. I could test the same via chrome browser.
A weird thing is happening, after doing the insertion whenever I try to check the data in Localstorage databases, everything hangs up. perhaps a bug in the tools section. For the time being I have to check the functionality in browser only.
Thanks once again 🙂
Max87MemberYou’re welcome 🙂
It’s weird…
I use WebSQL queries all the time and sometimes, Test Center also freezes. I have to kill it from Task manager, restart it and then it’s working fine. This happens mostly if I have database, but no table in it(if I delete all tables programatically). May be it’s a bug in Test Center…
support-octavioMemberHi upasana,
Please take a look at this Wayne’s reply in a related thread to local DB:
http://www.genuitec.com/support-genuitec/viewtopic.php?p=13913#p13913 -
AuthorPosts