facebook

Tracking db transaction/sql errors

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #334550 Reply

    upasana
    Member

    I am trying to execute an insert sql query, this works fine on sqlite
    The table is

    CREATE 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.

    #334552 Reply

    Max87
    Member

    Hi 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 );
    });
    
    #334580 Reply

    upasana
    Member

    Hi 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 🙂

    #334586 Reply

    Max87
    Member

    You’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…

    #334598 Reply

    Hi 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

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Tracking db transaction/sql errors

You must be logged in to post in the forum log in