我有一个带有 SQLite 数据库的移动应用程序来在手机上存储详细信息,我想通过 PHP 将此表的内容同步到远程 mySQL 服务器。
我使用以下内容将行写入远程服务器。
protected function button_clickHandler(event:MouseEvent):void
{
var result:SQLResult;
var numRows:int ;
conn = new SQLConnection();
conn.open(file, SQLMode.CREATE);
selectStmt.sqlConnection = conn;
var sql:String = "SELECT * FROM surveyResponseHeader";
selectStmt.text = sql;
selectStmt.execute();
result = selectStmt.getResult();
numRows = result.data.length;
trace (result.data.length);
trace (numRows);
for (var i:int = 0; i< numRows; i++){
surveyresponse.surveyID = parseInt(result.data[i]["surveyID"]);
surveyresponse.surveySite =result.data[i]["surveySite"];
surveyresponse.surveyReference = result.data[i]["surveyReference"];
surveyresponse.siteManager =result.data[i]["siteManager"];
surveyresponse.surveyDate = result.data[i]["surveyDate"];
surveyresponse.surveyNextVisit = result.data[i]["surveyNextVisit"];
surveyresponse.surveySignature = result.data[i]["surveySignature"];
surveyresponse.surveyImage =result.data[i]["surveyImage"];
surveyresponseheaderService.createSurveyresponseheader(surveyresponse);
}
}
我的问题:
在第一次运行时只发布最后一行,并且根据 SQLLite 查询返回的行数多次发布,在第二次运行时它正确发布,这是为什么呢?
我已经盯着这个看了好几个小时,看不出我哪里出错了。
任何建议表示赞赏。