For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 13 replies, 3 voices, and was last updated 12 years, 10 months ago by
support-octavio.
-
AuthorPosts
-
arc-itechParticipantI 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 functionfunction 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
November 9, 2012 at 4:25 am #332156
support-octavioMemberHi 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?November 9, 2012 at 5:01 am #332158
arc-itechParticipantHi, 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?
November 9, 2012 at 7:23 am #332159
arc-itechParticipantHi 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?
November 9, 2012 at 1:28 pm #332165
support-michaelKeymasterResearch this now to see if we can replicate the web sql update issue. Will follow up as soon as we know more.
November 9, 2012 at 2:04 pm #332167
support-michaelKeymasterI 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
November 9, 2012 at 2:51 pm #332169
support-octavioMemberHi @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
November 10, 2012 at 8:31 am #332187
arc-itechParticipantBrilliant thanks for that, I have just the email to your support database
November 10, 2012 at 11:01 am #332190
support-michaelKeymasterWe 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
November 10, 2012 at 12:20 pm #332193
arc-itechParticipanthi 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?
November 11, 2012 at 8:28 am #332198
support-michaelKeymasterI’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.
November 12, 2012 at 8:16 am #332224
arc-itechParticipantHi, 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!
November 12, 2012 at 9:20 am #332225
arc-itechParticipantHi 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.
November 12, 2012 at 5:38 pm #332245
support-octavioMemberHi arc-itech,
Thanks for your follow up. Marking thread as closed. Good luck with your development.
-
AuthorPosts