Solved

deleterow();

Posted on 2013-12-29
1
339 Views
Last Modified: 2013-12-31
I'm trying to loop through the sqlite database to transmit the data to the server ... once the data is transmitted successfully and the server returns "1" I want it to delete the row just transmitted (.deleterow) then next transmit the next row (.next)... but the way I am doing it isn't working

if(jObject.Result == 1)
{ getGroundData.deleteRow();
 getGroundData.next();

Open in new window



var Groundy = function(){
var db = Ti.Database.open('TennisApp');
var getGroundData = db.execute('SELECT user, MatchUID,Ossys, UserID, SetPrKey, Game, Point, Stroke, XCor, YCor FROM GroundStrokeData');
while (getGroundData.isValidRow())
{
     var user = getGroundData.fieldByName('UserID');
     var UserID = getGroundData.fieldByName('UserID');
     var MatchUID = getGroundData.fieldByName('MatchUID'); 
     var Ossys = getGroundData.fieldByName('Ossys');
     var SetPrKey = getGroundData.fieldByName('SetPrKey'); 
     var Game = getGroundData.fieldByName('Game');
     var Point = getGroundData.fieldByName('Point');  
     var Stroke = getGroundData.fieldByName('Stroke'); 
 
     var XCor = getGroundData.fieldByName('XCor');
     var YCor = getGroundData.fieldByName('YCor');
  GroundDtrokeTransmit(user, MatchUID, Ossys, UserID, SetPrKey, Game,  Point, Stroke, XCor, YCor);
 
}
db.execute('DELETE FROM GroundStrokeData');
getGroundData.close();
db.close();
 
};
 
var GroundDtrokeTransmit = function(user, MatchUID, Ossys,  UserID, SetPrKey){ 
var xhr=Titanium.Network.createHTTPClient();    
 xhr.onerror = function(e){ 
 Ti.API.error('groundy Bad Sever =>'+e.error);
};

Open in new window

0
Comment
Question by:dolamitejenkins
1 Comment
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 500 total points
ID: 39745619
I'm no js expert, but usually you just update a column in the row to show the record has been sent. E.g make a column called issent with a default of 0 and set it to 1 instead of trying to delete the row. Then at the end you can delete where issent=1 if you want, or just leave them for clean up later and add where issent !=1 to your input query.

I don't know if the row is locked or what your current problem is, but this may fix it. If it doesn't it's still a good idea.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question