我在C#中使用Firebird的dot net提供程序運行一些SQL命令。具體來說,我正在更改數據庫模式,並進行數據更新等。Firebird點網絡提供者沒有完全執行查詢?
作爲我的處理的一部分,我創建一個新表,運行查詢以從舊錶中複製數據,然後刪除舊錶。
當我做這個火鳥生成和錯誤:
unsuccessful metadata update object is in use
我已經做了一些看,它似乎像查詢複製的數據沒有被「清除」我們什麼呢。我的意思是當我檢查Firebird中的監控表時,我的c#執行已暫停,我在MON$STATEMENTS
表中看到查詢爲非活動狀態。這是我運行一個提交語句後。
我的問題:
有沒有辦法暫停,或等待,或強制查詢,全面完成之前,我嘗試運行下一個命令?
當我在ISQL中運行相同的查詢序列時,它可以很好地工作。有什麼不同的ISQL,我可以強制點網Firebird提供程序這樣做,它不會保持此查詢打開或什麼?
所以對於參考的代碼看起來是這樣的(顯然這是一個很簡單的):
// create the table
string commandString = "CREATE TABLE ...";
// run the command in a transaction and commit it
mtransaction = Connection.BeginTransaction(IsolationLevel.Serializable);
FbCommand command = new FbCommand(commandString, Connection, mtransaction);
command.ExecuteNonQuery();
transaction.Commit();
transaction.Dispose();
transaction = null;
// copy the data to the new table from the old
commandString = "INSERT INTO ...";
mtransaction = Connection.BeginTransaction(IsolationLevel.Serializable);
FbCommand command = new FbCommand(commandString, Connection, mtransaction);
command.ExecuteNonQuery();
transaction.Commit();
transaction.Dispose();
transaction = null;
// drop the old table
commandString = "DROP TABLE ...";
mtransaction = Connection.BeginTransaction(IsolationLevel.Serializable);
FbCommand command = new FbCommand(commandString, Connection, mtransaction);
command.ExecuteNonQuery();
// this command fails with the exception
// if I pause execution in c# before running this command, and
// use isql to look at the db I see the new table, and the data fully populated
// and I also see the inactive insert command in MON$STATEMENTS
transaction.Commit();
transaction.Dispose();
transaction = null;
作爲參考,我使用火鳥2.1.0窗口建設,我使用我相信DDEXProvider-2.0.1的事情 – Beau