i've read the flex language reference: http://livedocs.adobe.com/flex/3/langref/flash/data/SQLStatement.html#executing
This property is true if execute() has been called and not all of the results have been returned from the database.
however, i'm having trouble understanding what that means exactly. I keep receiving an error:
Error #3106: Property cannot be changed while SQLStatement.executing is true.
i've tried creating an event handler for SQLEvent.RESULT, my thinking was that's how the results would get returned from the database and therefore executing() would return false - didn't work.
does this mean i'm trying to change my SQLStatement variable too quickly? how long does the execute() function take?
the code in question:
private function fileProgress(p_evt:ProgressEvent):void {
var char:String;
var line:String = "";
var counter:int = 1;
sqlStatement = new SQLStatement();
sqlStatement.sqlConnection = dbConn;
while(stream.position < stream.bytesAvailable)
{
char = stream.readMultiByte(1, File.systemCharset);
if(char == "\n")
{
sqlStatement.text = "INSERT INTO stats VALUES ('" + counter + "','" + line + "');";
sqlStatement.execute();
counter++;
line = "";
}
else
{
line += char;
}
readProgress.text = ((p_evt.bytesLoaded/1048576).toFixed(2)) + "MB out of " + ((p_evt.bytesTotal/1048576).toFixed(2)) + "MB read";
}
if(line != "")
{
sqlStatement.text = "INSERT INTO stats VALUES ('" + line + "');";
sqlStatement.execute();
}
}
stream is a filestream
i'm trying to read a textfile and put every line into a new sqlite table row.
i've also tried using sqlStatement.parameters as an alternative way to do my insert queries, but to no luck. that throws a different error:
Error #3110: Operation cannot be performed while SQLStatement.executing is true.