facebook

SQLite Update: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    arc-itech
    Participant

    I have tried to develop a database in Mobione. I have successfully created the database and a table, I have also successfully inserted records, however when it comes to updating a record, it will successfully update one instance. After this no updates will work unless I restart the emulator.

    Its confusing as the code I am using I have used several times before and they work fine, just seems to be mobione where this problem is occurring.

    Is this a bug in the software or do I need to code updates differently in the javascript for mobione?

    I have spent 3 days on this and got nowhere :-/

    Any help would be much aprreciated
    this is a sample of my update function

    function OGVal(){
    var OGVal = $(‘#m1-AddOG-AddOGText’).val();
    var idVal = $(‘#m1-index-TextField’).val();

    db.transaction(updateSignoff, errorCBA, successDB);

    function updateSignoff(tx) {
    var updatestatement = “UPDATE Batch SET OG=? WHERE id=?”;
    tx.executeSql(updatestatement,[OGVal,idVal]);

    }
    }

    Note: errorCBA is just to check for SQL errors and successDB just for now gives me an alert to inform me that the database has been updated

    #332156

    Hi arc-itech,

    I’ve tried to replicate your issue but I can see the changes after I do the update first time, second time, n times…
    How are you checking that the data on database have been updated?

    #332158

    arc-itech
    Participant

    Hi, Thanks for getting back to me,

    I am using the emulator tools and checking the database there. even if I reload the emulator the second updates do not show. I am still using a trial and really want to purchase this product but I need to get it working before I make this purchase.

    Could you post what you have built to text my issue so that I can check against what I have?

    #332159

    arc-itech
    Participant

    Hi support sorry to bother but any luck with sending the an example of how you got it working as I am not sure as to why its worked for you and no me?

    #332165

    support-michael
    Keymaster

    @arc-itech

    Research this now to see if we can replicate the web sql update issue. Will follow up as soon as we know more.

    #332167

    support-michael
    Keymaster

    @arc-itech

    I should have looked closer at the snippet you posted. The webdb on ios and android devices and the Test Center are sqlite implementations: http://www.sqlite.org/index.html Note the “lite” in the db implement name. Can you verify that your sql syntax is compatible with sqlite http://www.sqlite.org/lang_update.html

    #332169

    Hi @arc-itech,

    Could you provide us your files to see what is problem? If you want to keep the data in privacy send us a zip file with your project to support at genuitec dot com. Use title mobione data from arc-itech

    #332187

    arc-itech
    Participant

    Brilliant thanks for that, I have just the email to your support database

    #332190

    support-michael
    Keymaster

    @arc-itech

    We received your project. I did a quick inspection of your code and it appears that the code does not account for the asynchronous nature of the db api. That is, all db apis are run asynchronously. This is a big change from the traditional atomic programming model most of us are used to. See this topic http://www.genuitec.com/support-genuitec/viewtopic.php?p=11735#p11735

    #332193

    arc-itech
    Participant

    hi thanks for getting back to me.

    im sure i have coded using as asynchronous coding.
    e.g db.transaction(updateSignoff, errorCBA, successDB);

    do you have any example scripts to demonstrate what you mean?

    #332198

    support-michael
    Keymaster

    I’ll look closer. My 1st inspection of the code I thought I observed unsynchronized control flow that could result in undefined outcomes. I did not try to run the code just gave it a quick look.

    #332224

    arc-itech
    Participant

    Hi, just an update on this error. I have discovered how this error occurs. Once I click save to store the value, I stay on the same screen and continue to update then the update works, however if i click back to the main screen and then go back or go to a different screen to update the records, for some reason this stops the sql from working!

    #332225

    arc-itech
    Participant

    Hi Octavio,

    I have now solved it – it seems using a transition instea of the back button doesn’t crash the database

    so on save i call a call function that takes the user back to the main page
    phoneui.gotoPage(‘#m1-index’, ‘SLIDE_LEFT’)

    thanks for your help, really appreciated.

    #332245

    Hi arc-itech,

    Thanks for your follow up. Marking thread as closed. Good luck with your development.

Viewing 14 posts - 1 through 14 (of 14 total)
Reply To: SQLite Update: CLOSED

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