0 Replies Latest reply on Nov 10, 2008 5:08 AM by Matt Gifford

    SQLIte question

    Matt Gifford
      Hello all

      I'm stuck on this issue.

      I am calling a sql select function from a page, which runs the following:

      public function checkFileDownloadHistory(thisVersionNumber:String):void {
      var sqlText:String = "SELECT * FROM fileHistory WHERE VERSION_NUMBER = " + thisVersionNumber;
      selectFileHistorySQL = new SQLStatement();
      selectFileHistorySQL.sqlConnection = conn;
      selectFileHistorySQL.addEventListener(SQLEvent.RESULT, fileDownloadHistoryResult);
      selectFileHistorySQL.addEventListener(SQLErrorEvent.ERROR, errorHandler);
      selectFileHistorySQL.text = sqlText;
      selectFileHistorySQL.execute();
      }

      private function fileDownloadHistoryResult(event:SQLEvent): void {
      var result:SQLResult = selectFileHistorySQL.getResult();
      var totalResults:Number = 0;
      if(result.data != null) {
      trace('there are ' + result.data.length + ' results');
      } else {
      trace('there are no results');
      }
      }

      Those two functions are within an .as package. I want to be able to send the result.data.length back to the original calling function, which is on the main .mxml file.

      I am calling this like so: (dm references the DataManager package that holds the above two functions)

      import com.mg.DataManager;
      private var dm:DataManager = new DataManager();

      private function checkUpdates():void {
      dm.checkFileDownloadHistory(fileDownloadServerVersion);
      }

      I want to send the results data back to the original calling function. How can I do this?

      Many thanks,

      Matt