The way I get data is through a callback function [processclinicResults],
and it gives the array Collection to the value object _ClinicVO.
I have a problem that I can not directly get the return arrayCollection through getTableContent function, I tried to return value after
but it returns null.
Does anyone know how to make it easy to get the array? I just don't want to declare the variables every time when I use the similar funciotn. Or I have to overwrite [clinicData]?
public function getTableContent( resultHandler:Function, faultHandler:Function = null ):void
{
var stmt:SQLStatement = new SQLStatement();
stmt.sqlConnection = sqlConnection;
stmt.text = 'SELECT * FROM Clinic;';
stmt.itemClass = ClinicVO;
stmt.addEventListener( SQLEvent.RESULT,
function ( event:SQLEvent ):void {
resultHandler.call( this, new ArrayCollection( stmt.getResult().data ) );
});
stmt.addEventListener( SQLErrorEvent.ERROR, faultHandler == null ? sqlErrorHandler : faultHandler );
stmt.execute();
}
public function errorConnectingToTable(evt:SQLErrorEvent):void {
trace("Error getting information from DB");
}
protected function processClinicResults(resultsArray:ArrayCollection=null):void {
if (resultsArray == null) {
trace("DB has NO data");
//there is no data
} else {
clinicData = resultsArray;
}
}