我讀過柔性語言參考: http://livedocs.adobe.com/flex/3/langref/flash/data/SQLStatement.html#executing什麼時候執行()返回錯誤在sqlite爲flex?
This property is true if execute() has been called and not all of the results have been returned from the database.
不過,我無法理解這意味着什麼究竟。我不斷收到一個錯誤:
Error #3106: Property cannot be changed while SQLStatement.executing is true.
我已經試過了SQLEvent.RESULT創建一個事件處理程序,我的想法是,是如何的結果會得到從數據庫返回,因此執行()將返回錯誤 - 沒」工作。
這是否意味着我想改變我的SQLStatement變量太快? execute()函數需要多長時間?
問題代碼:
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();
}
}
流是FILESTREAM
我試圖讀取一個文本,並把每行到一個新的sqlite的錶行。
我也嘗試使用sqlStatement.parameters作爲替代方式來做我的插入查詢,但沒有運氣。引發不同的錯誤:
Error #3110: Operation cannot be performed while SQLStatement.executing is true.
只是試了一下,沒有工作。但我很高興,因爲我不想取消sqlstatement.execute()。我希望它在每次再次被解僱之前完成 – marauder 2009-09-07 22:52:35