TDbiCascader::Lock Class Reference

Private Locker object used by TDbiCascader. More...

Collaboration diagram for TDbiCascader::Lock:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Lock (TDbiStatement *stmtDB, const string &seqnoTable, const string &dataTable)
 ~Lock ()
 Purpose: Dtor: Clear lock.
Bool_t IsLocked () const

Private Member Functions

void SetLock (Bool_t setting=kTRUE)

Private Attributes

TDbiStatementfStmt
string fSeqnoTableName
string fDataTableName
Bool_t fLocked

Detailed Description

Private Locker object used by TDbiCascader.

Definition at line 133 of file TDbiCascader.hxx.


Constructor & Destructor Documentation

TDbiCascader::Lock::Lock ( TDbiStatement stmtDB,
const string &  seqnoTable,
const string &  dataTable 
)
   
     Purpose:  Ctor: Create a lock on a table accessed via connection.
               (will be released by dtor)
     Arguments:
             stmtDB    in  TDbiStatement (given to Lock).
   

Definition at line 583 of file TDbiCascader.cxx.

References fStmt, SetLock(), and SK_DBI_Severe.

00583                                                                                                :
00584 fStmt(stmtDB),
00585 fSeqnoTableName(seqnoTable),
00586 fDataTableName(dataTable),
00587 fLocked(kFALSE)
00588 {
00589 
00590 
00591   if ( ! fStmt ) {
00592        SK_DBI_Severe( "Cannot obtain statment to set lock" << "  ");
00593     return;
00594   }
00595 
00596   this->SetLock(kTRUE);
00597 
00598 }
//.....................................................................

Here is the call graph for this function:

TDbiCascader::Lock::~Lock (  ) 

Purpose: Dtor: Clear lock.

Definition at line 601 of file TDbiCascader.cxx.

References fStmt, and SetLock().

00601                         {
00602 //
00603 //
00604 
00605 
00606   this->SetLock(kFALSE);
00607   delete fStmt;
00608   fStmt = 0;
00609 
00610 }

Here is the call graph for this function:


Member Function Documentation

Bool_t TDbiCascader::Lock::IsLocked (  )  const [inline]

Definition at line 139 of file TDbiCascader.hxx.

References fLocked.

Referenced by TDbiCascader::ReserveNextSeqNo().

00139 { return fLocked; }

Here is the caller graph for this function:

void TDbiCascader::Lock::SetLock ( Bool_t  setting = kTRUE  )  [private]
   
     Purpose:  Set or clear lock.
   
     Arguments:
       setting      in    Required setting of lock. [default kTRUE]
   
     Program Notes:-
     =============
   
     No-op if locked otherwise use the LOCK TABLES command.
   

Definition at line 626 of file TDbiCascader.cxx.

References TDbiStatement::ExecuteUpdate(), fDataTableName, fLocked, fSeqnoTableName, fStmt, TDbiStatement::GetExceptionLog(), TDbiExceptionLog::IsEmpty(), TDbiStatement::PrintExceptions(), and SK_DBI_Log.

Referenced by Lock(), and ~Lock().

00626                                               {
00627 
00628 
00629   if ( setting == fLocked || ! fStmt ) return;
00630 
00631   string sql;
00632 
00633   if ( setting ) {
00634     sql = "LOCK TABLES ";
00635     sql += fSeqnoTableName + " WRITE";
00636     if ( fDataTableName != "" ) sql += ", " + fDataTableName  + "VLD WRITE";
00637   }
00638   else {
00639     sql = "UNLOCK TABLES;";
00640   }
00641   SK_DBI_Log( "Lock requested: " << setting
00642                          << " issuing lock command: " << sql << "  ");
00643   fStmt->ExecuteUpdate(sql.c_str());
00644   if ( fStmt->GetExceptionLog().IsEmpty() ) fLocked = setting;
00645   fStmt->PrintExceptions();
00646 
00647 }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 147 of file TDbiCascader.hxx.

Referenced by SetLock().

Bool_t TDbiCascader::Lock::fLocked [private]

Definition at line 148 of file TDbiCascader.hxx.

Referenced by IsLocked(), and SetLock().

Definition at line 146 of file TDbiCascader.hxx.

Referenced by SetLock().

Definition at line 145 of file TDbiCascader.hxx.

Referenced by Lock(), SetLock(), and ~Lock().


The documentation for this class was generated from the following files:

Generated on 11 Aug 2013 for SKDatabase by  doxygen 1.6.1