To be more specific, I use firebird 2.1 and the DDEX provider for visual studio, and I work in C #.
I have a situation where I try to apply schema changes to a database from C # in order to “update” my database. During this process, I get the following exception from firebird:
FirebirdSql.Data.FirebirdClient.FbException: unsuccessful INDEX metadata update object used
I interpreted this as a problem of consistency when there is another processuality that accesses the database at the same time. I do not know that this is the reason for the certian, but it "seems" to be the most likely case. I thought that this could be due to the removal and addition of restrictions, since they are not additional, because the restriction is incorrect, but I can run commands on my local system without errors, and not on the client site. Anyway, currently I have several commands wrapped in a single transaction using the isolation level of “Serializable” and commit them all at once. Since this is an update, the thinking is that it can block all other users as needed.
Example:
FbTransaction transaction = Connection.BeginTransaction( IsolationLevel.Serializable );
string commandString = "ALTER TABLE Product DROP CONSTRAINT ProductType;";
FbCommand command = new FbCommand(commandString, Connection, transaction);
command.ExecuteNonQuery();
commandString = "ALTER TABLE Product ADD CONSTRAINT ProductType " +
"FOREIGN KEY ( TypeID ) REFERENCES Type ( TypeID ) " +
"ON UPDATE CASCADE ON DELETE NO ACTION;";
command.CommandText = commandString;
command.ExecuteNonQuery();
transaction.Commit();
, "" , , , , , , .
:
// Try to use FbTransactionOptions instead
// this statement complains about invalid options block when executing
FbTransaction transaction = Connection.BeginTransaction(
FbTransactionOptions.Consistency |
FbTransactionOptions.Exclusive |
FbTransactionOptions.Wait |
FbTransactionOptions.Write |
FbTransactionOptions.LockWrite |
FbTransactionOptions.NoRecVersion
);
, : db ? , . !!!
:
, :
FirebirdSql.Data.FirebirdClient.FbException: FOREIGN KEY "INTEG_72" ""
, .
, .
, , :
FirebirdSql.Data.FirebirdClient.FbException: INDEX
:
FirebirdSql.Data.FirebirdClient.FbException: FOREIGN KEY "INTEG_72" ""
. , , . - , , .
. jachguate, , .