When i execute a query with Flex which contain some expression like “select count(id) as idCount from users” the result is coming in some strange way.
The 1st object from the result data array ( which is supposed to store the actual result from the query above ) having the follow “idCount = 0”
if i try to parse it as property – the result is always “undefined”
sqlStatement = new SQLStatement();
sqlStatement.sqlConnection = mainConnection;
sqlStatement.text = 'select count( id ) as countID from Users';
sqlStatement.addEventListener( SQLEvent.RESULT, onSelectQuerySucceed );
sqlStatement.execute();
protected function onSelectQuerySucceed( event : SQLEvent ) : void
{
var sqlResult : SQLResult = sqlStatement.getResult();
Alert.show( sqlResult.data[ 0 ].idCount ); // <- it is undefined :|
}
- How to properly execute such query and check the result ?
The code above working fine 😐
Seems like it was my mistake in other procedure which causing the bug. 😐