What steps will reproduce the problem?
1. package
{
import com.maclema.mysql.Connection;
import com.maclema.mysql.events.MySqlErrorEvent;
import com.maclema.mysql.events.MySqlEvent;
import com.maclema.mysql.MySqlToken;
import com.maclema.mysql.ResultSet;
import com.maclema.mysql.Statement;
import com.maclema.mysql.Field;
import flash.display.Sprite;
import flash.events.Event;
import flash.utils.getDefinitionByName;
/**
* ...
* @author
*/
public class PersonDb
{
private var _host:String = "localhost";
private var _port:int = 3306;
private var _user:String = "qa";
private var _password:String = "87654321";
private var _dbname:String = "site";
private var con:Connection;
public var persons:Vector.<Person> = new Vector.<Person>();
public function PersonDb()
{
con = new Connection(_host, _port, _user, _password, _dbname);
con.addEventListener(Event.CONNECT, handleConnected);
con.connect();
}
private function handleConnected(e:Event):void
{
var st:Statement = con.createStatement();
var token:MySqlToken = st.executeQuery("SELECT * FROM person");
token.addEventListener(MySqlEvent.RESULT, onResult);
token.addEventListener(MySqlErrorEvent.SQL_ERROR, onError);
}
private function onResult(e:MySqlEvent):void
{
//var array:Array = new Array();
var index:int;
var resultSet:ResultSet = e.resultSet;
while (resultSet.next())
{
var cols:Array = resultSet.getColumns();
var row:Array = new Array();
for (var i:int = 0; i < cols.length; i++)
{
var field:Field = cols[i];
var nameCol:String = field.getName();
row[nameCol] = resultSet.getString(i);
}
row.length = cols.length;
var p:Person = new Person();
p.id = row["id"];
p.name = row["name"];
p.surname = row["surname"];
p.profession = row["profession"];
persons.push(p);
//array[index] = row;
//index++;
}
}
private function onError(e:MySqlErrorEvent):void
{
trace("Error");
trace(e.id, e.msg);
}
}
}
2. Any time work, but any time error about close connection.
What is the expected output? What do you see instead?
Error: Server terminated connection!
at com.maclema.mysql::Connection/onSocketClose().
What version of the product are you using? On what operating system?
2.8
Please provide any additional information below.
Original issue reported on code.google.com by dvy1...@gmail.com on 14 Sep 2013 at 6:48
Original issue reported on code.google.com by
dvy1...@gmail.com
on 14 Sep 2013 at 6:48