void TransactionImpl::DetachDatabase(IBPP::Database db) { if (db.intf() == 0) throw LogicExceptionImpl("Transaction::DetachDatabase", _("Can't detach an unbound Database.")); DetachDatabaseImpl(dynamic_cast<DatabaseImpl*>(db.intf())); }
void TransactionImpl::AttachDatabase(IBPP::Database db, IBPP::TAM am, IBPP::TIL il, IBPP::TLR lr, IBPP::TFF flags) { if (db.intf() == 0) throw LogicExceptionImpl("Transaction::AttachDatabase", _("Can't attach an unbound Database.")); AttachDatabaseImpl(dynamic_cast<DatabaseImpl*>(db.intf()), am, il, lr, flags); }
void TransactionImpl::AddReservation(IBPP::Database db, const std::string& table, IBPP::TTR tr) { if (mHandle != 0) throw LogicExceptionImpl("Transaction::AddReservation", _("Can't add table reservation if Transaction started.")); if (db.intf() == 0) throw LogicExceptionImpl("Transaction::AddReservation", _("Can't add table reservation on an unbound Database.")); // Find the TPB associated with this database std::vector<DatabaseImpl*>::iterator pos = std::find(mDatabases.begin(), mDatabases.end(), dynamic_cast<DatabaseImpl*>(db.intf())); if (pos != mDatabases.end()) { size_t index = pos - mDatabases.begin(); TPB* tpb = mTPBs[index]; // Now add the reservations to the TPB switch (tr) { case IBPP::trSharedWrite : tpb->Insert(isc_tpb_lock_write); tpb->Insert(table); tpb->Insert(isc_tpb_shared); break; case IBPP::trSharedRead : tpb->Insert(isc_tpb_lock_read); tpb->Insert(table); tpb->Insert(isc_tpb_shared); break; case IBPP::trProtectedWrite : tpb->Insert(isc_tpb_lock_write); tpb->Insert(table); tpb->Insert(isc_tpb_protected); break; case IBPP::trProtectedRead : tpb->Insert(isc_tpb_lock_read); tpb->Insert(table); tpb->Insert(isc_tpb_protected); break; default : throw LogicExceptionImpl("Transaction::AddReservation", _("Illegal TTR value detected.")); } } else throw LogicExceptionImpl("Transaction::AddReservation", _("The database connection you specified is not attached to this transaction.")); }