lexcorp / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

Then using assql in pure AS3 mode error in MySqlToken.getRows() #102

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
Create as3 project using FlashDevelop and Flex SDK
2.
Create test database
3.

        private function handleConnected(e:Event):void {
            var st:Statement = con.createStatement();

            var token:MySqlToken = st.executeQuery("SELECT * FROM users LIMIT 10");
            token.addEventListener(MySqlEvent.RESULT, onResult);
            token.addEventListener(MySqlErrorEvent.SQL_ERROR, onError);
        }

        private function onResult(e:MySqlEvent):void {
            var resultSet:ResultSet = e.resultSet as ResultSet;
//ERORR!!
/*
Error text:
ReferenceError: Error #1065: Variable ArrayCollection is not defined.
    at global/flash.utils::getDefinitionByName()
    at com.maclema.mysql::ResultSet/getRows()[/Users/Matt/Documents/Adobe Flash Builder Beta 2/asSQL_PureAS3/src/com/maclema/mysql/ResultSet.as:344]
*/          
var ar:Array = resultSet.getRows();
            for (var i:int = 0; i < ar.length; i++) {
                trace(ar[i]);
            }
            trace("onResult", e.resultSet);
        }

If you look at adobe reference about getDefinitionByName function
You will find, that it throws error     ReferenceError  ( — No public definition 
exists with the specified name. )

Obviously, you should add try-catch block to this part of code.

PS And thank you for such good and useful library.

Original issue reported on code.google.com by terboo...@gmail.com on 9 Jun 2010 at 9:05