2 Replies Latest reply on Aug 29, 2013 6:14 AM by Ibarim

    air and sqlite problem - cumulating results

    Ibarim Level 1

      Hi,

      I got problem with sqlite in air.

      The problem is that sqlStmt.getResult().data is gathering data from separate Select statements, when  it should be separate results. As in this example, where I call "select" function once, and AFTER geting it's result I call it again with different query.

       

       

      public function select(q:String):void {

      conn.open(dbFile);

      sqlStmt.addEventListener(SQLEvent.RESULT,selectComplete);

      sqlStmt.text = q;

      sqlStmt.execute();

      }

       

      private function selectComplete(e:SQLEvent):void {

      oSqlReturn = sqlStmt.getResult().data;          //this is where sqlStmt.getResult().data remembers previous results and adds current ones to the array.

      conn.close();                                                  //but here sqlStmt.getResult() is null

      sqlStmt.removeEventListener(SQLEvent.RESULT,selectComplete);

      }

       

      So  after second Select returns I got sqlStmt.getResult().data with results from the first and the second statement.

       

      Maybe one of You had some simmilar problem and is able to help me with this.