我在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