rm_Slot Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_Slot:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 359 of file rmdb.h.


Public Attributes

Int32_t slotKey
Int32_t libraryKey
rm_String slotAddr
Int32_t slotType
Int32_t status

Private Member Functions

void Insert ()
void Update ()
void Remove (Int32_t a_slotKey, Int32_t a_libraryKey)
void Select (Int32_t a_slotKey, Int32_t a_libraryKey)
void SelectByLibAddrType (Int32_t a_libraryKey, rm_String a_addr, Int32_t a_type)
void StartSelectAll ()
void EndSelectAll ()
rm_SlotNext ()
 rm_Slot ()
 rm_Slot (Int32_t a_slotKey, Int32_t a_libraryKey)
rm_Slot Find (Int32_t a_libkey, Int32_t a_status)
bool operator== (const rm_Slot &sl2) const

Private Attributes

 log_CLASSID_m

Friends

class rm_Operator
class rm_Medium

Constructor & Destructor Documentation

rm_Slot::rm_Slot (  )  [private]

Definition at line 2489 of file librmdb.exx.

02490     :   slotAddr(rmdb_MAX_SLOTADDR)    {
02491 }

rm_Slot::rm_Slot ( Int32_t  a_slotKey,
Int32_t  a_libraryKey 
) [private]

Definition at line 2493 of file librmdb.exx.

References Select().

02494     :   slotAddr(rmdb_MAX_SLOTADDR)    {
02495     Select(a_slotKey, a_libraryKey);
02496 }

Here is the call graph for this function:


Member Function Documentation

void rm_Slot::Insert (  )  [private]

Definition at line 2499 of file librmdb.exx.

References rm_String::cvalue_p, dbg_NORM, errorDesc(), libraryKey, log_DBG_m, log_FUNC_m, MAX, NAME, slotAddr, slotKey, slotType, SQL_CHECK_M, SQL_NOERROR, SQL_UNIQUEVIOLATION, and status.

Referenced by rm_Operator::Add().

02499                      {
02500     log_FUNC_m(Insert);
02501 
02502     EXEC SQL
02503         SET TRANSACTION NAME readWriteTrans;
02504 
02505     Int32_t k = 0;
02506     if (slotKey == 0) {
02507         EXEC SQL SELECT TRANSACTION readWriteTrans MAX(SLOTKEY) INTO :k FROM SLOT;
02508         slotKey = k + 1;
02509         log_DBG_m(dbg_NORM,"new key");
02510     }
02511     else {
02512         EXEC SQL
02513             SELECT TRANSACTION readWriteTrans
02514             SLOTKEY INTO :k FROM SLOT
02515             WHERE SLOTKEY = :slotKey;
02516         if (SQLCODE == SQL_NOERROR) {
02517             log_DBG_m(dbg_NORM,"key exists");
02518             throw ivd_DBException( SQL_UNIQUEVIOLATION ,"Slot Key already exists");
02519         }
02520     }
02521 
02522     EXEC SQL
02523         INSERT TRANSACTION readWriteTrans
02524         INTO SLOT VALUES(
02525                         :slotKey,
02526                         :libraryKey,
02527                         :slotAddr.cvalue_p,
02528                         :slotType,
02529                         :status
02530                );
02531     string sqlErrDesc = errorDesc(SQLCODE,"Insert record into Slot", slotKey);
02532     SQL_CHECK_M( sqlErrDesc );
02533 
02534 }// rm_Slot::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::Update (  )  [private]

Definition at line 2555 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), libraryKey, log_FUNC_m, NAME, slotAddr, slotKey, slotType, SQL_CHECK_M, and status.

Referenced by rm_Operator::InventoryUpdate(), rm_Operator::MediumUnLoaded(), and rm_Operator::Update().

02555                      {
02556     log_FUNC_m(Update);
02557     EXEC SQL
02558         SET TRANSACTION NAME readWriteTrans;
02559 
02560     EXEC SQL
02561         UPDATE TRANSACTION readWriteTrans
02562         SLOT SET
02563             LIBRARYKEY =    :libraryKey,
02564             SLOTADDR =      :slotAddr.cvalue_p,
02565             SLOTTYPE =      :slotType,
02566             STATUS =        :status
02567         WHERE SLOTKEY = :slotKey AND LIBRARYKEY = :libraryKey;
02568     string sqlErrDesc = errorDesc(SQLCODE,"Update Slot record", slotKey);
02569     SQL_CHECK_M( sqlErrDesc );
02570 
02571 }// rm_Slot::Update

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::Remove ( Int32_t  a_slotKey,
Int32_t  a_libraryKey 
) [private]

Definition at line 2538 of file librmdb.exx.

References errorDesc(), log_FUNC_m, NAME, and SQL_CHECK_M.

Referenced by rm_Operator::RemoveSlot().

02538                                                             {
02539     log_FUNC_m(Remove);
02540 
02541     EXEC SQL
02542         SET TRANSACTION NAME readWriteTrans;
02543 
02544     EXEC SQL
02545         DELETE TRANSACTION readWriteTrans
02546         FROM SLOT WHERE SLOTKEY = :a_slotKey AND LIBRARYKEY = :a_libraryKey;
02547 
02548     string sqlErrDesc = errorDesc(SQLCODE,"Update Slot record", a_slotKey);
02549     SQL_CHECK_M( sqlErrDesc );
02550 
02551 }// rm_Slot::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::Select ( Int32_t  a_slotKey,
Int32_t  a_libraryKey 
) [private]

Definition at line 2576 of file librmdb.exx.

References errorDesc(), libraryKey, log_FUNC_m, NAME, rmdb_MAX_SLOTADDR, slotAddr, slotKey, slotType, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::AllocateAdmin(), rm_Operator::AllocateRecall(), rm_Operator::MediumUnLoaded(), rm_Slot(), SelectByLibAddrType(), and rm_Operator::SelectDriveForMig().

02576                                                             {
02577     log_FUNC_m(Select);
02578 
02579     EXEC SQL
02580         SET TRANSACTION NAME readTrans
02581             READ ONLY
02582             ISOLATION LEVEL READ COMMITTED;
02583 
02584 
02585     char slotAddrVal[rmdb_MAX_SLOTADDR];
02586     EXEC SQL
02587         SELECT TRANSACTION readTrans
02588         * INTO
02589             :slotKey,
02590             :libraryKey,
02591             :slotAddrVal,
02592             :slotType,
02593             :status
02594         FROM SLOT WHERE SLOTKEY = :a_slotKey AND LIBRARYKEY = :a_libraryKey ORDER BY SLOTKEY;
02595     if (SQLCODE == SQL_NOERROR) {
02596         slotAddr = slotAddrVal;
02597     };
02598 
02599     string sqlErrDesc = errorDesc(SQLCODE,"Select Slot record", slotKey);
02600     SQL_CHECKREAD_M( sqlErrDesc );
02601 
02602 }// rm_Slot::Select()

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::SelectByLibAddrType ( Int32_t  a_libraryKey,
rm_String  a_addr,
Int32_t  a_type 
) [private]

Definition at line 2605 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), libraryKey, log_FUNC_m, NAME, rmdb_MAX_SLOTADDR, Select(), slotAddr, slotKey, slotType, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::Add(), rm_Operator::InventoryUpdate(), rm_Operator::MediumUnLoaded(), rm_Operator::RemoveSlot(), rm_Operator::SelectSlot(), and rm_Operator::Update().

02605                                                                                        {
02606     log_FUNC_m(Select);
02607 
02608     EXEC SQL
02609         SET TRANSACTION NAME readTrans
02610             READ ONLY
02611             ISOLATION LEVEL READ COMMITTED;
02612 
02613     char slotAddrVal[rmdb_MAX_SLOTADDR];
02614 
02615     EXEC SQL
02616         SELECT TRANSACTION readTrans
02617         * INTO
02618             :slotKey,
02619             :libraryKey,
02620             :slotAddrVal,
02621             :slotType,
02622             :status
02623         FROM SLOT WHERE
02624             LIBRARYKEY = :a_libraryKey AND
02625             SLOTADDR = :a_addr.cvalue_p AND
02626             SLOTTYPE = :a_type
02627         ORDER BY SLOTKEY;
02628 
02629     if (SQLCODE == SQL_NOERROR) {
02630         slotAddr = slotAddrVal;
02631     };
02632 
02633     string sqlErrDesc = errorDesc(SQLCODE,"Select Slot record by addr:" , a_addr);
02634     SQL_CHECKREAD_M( sqlErrDesc );
02635 
02636 }// rm_Slot::Select()

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::StartSelectAll (  )  [private]

Definition at line 2639 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), cmn_Mutex::Lock(), log_DBG_m, log_ERR_m, log_FUNC_m, NAME, SQL_NOERROR, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllSlots().

02639                             {
02640     log_FUNC_m(StartSelectAll);
02641 
02642     g_slotCursor_x.Lock();
02643     EXEC SQL
02644         SET TRANSACTION NAME readTrans
02645             READ ONLY
02646             ISOLATION LEVEL READ COMMITTED;
02647 
02648     EXEC SQL
02649         OPEN TRANSACTION readTrans SELECT_ALL_SLOT;
02650 
02651     log_DBG_m(dbg_DETAIL,"StartSelect All SQLCODE:" << SQLCODE);
02652 
02653     if ( SQLCODE != SQL_NOERROR ) {
02654         g_slotCursor_x.Unlock();
02655         string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_SLOT Cursor failed");
02656         log_ERR_m(sqlErrDesc);
02657         throw ivd_DBException( SQLCODE , sqlErrDesc, true);
02658     }
02659 }

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::EndSelectAll (  )  [private]

Definition at line 2661 of file librmdb.exx.

References errorDesc(), log_FUNC_m, SQL_CHECKREAD_M, and cmn_Mutex::Unlock().

02661                           {
02662     log_FUNC_m(EndSelectAll);
02663 
02664     EXEC SQL
02665         CLOSE SELECT_ALL_SLOT;
02666     g_slotCursor_x.Unlock();
02667 
02668     string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_SLOT" );
02669     SQL_CHECKREAD_M( sqlErrDesc );
02670 }

Here is the call graph for this function:

rm_Slot & rm_Slot::Next (  )  [private]

Definition at line 2672 of file librmdb.exx.

References errorDesc(), libraryKey, log_FUNC_m, rmdb_MAX_SLOTADDR, slotAddr, slotKey, slotType, SQL_CHECKREAD_M, SQL_NOERROR, status, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllSlots().

02672                        {
02673     log_FUNC_m(Next);
02674 
02675     char slotAddrVal[rmdb_MAX_SLOTADDR];
02676     EXEC SQL
02677         FETCH SELECT_ALL_SLOT
02678             INTO
02679                 :slotKey,
02680                 :libraryKey,
02681                 :slotAddrVal,
02682                 :slotType,
02683                 :status;
02684 
02685     if (SQLCODE == SQL_NOERROR) {
02686         slotAddr = slotAddrVal;
02687     }
02688     else {
02689         int fetchCode = SQLCODE;
02690         EXEC SQL
02691             CLOSE SELECT_ALL_SLOT;
02692         g_slotCursor_x.Unlock();
02693         SQLCODE = fetchCode;
02694         string sqlErrDesc = errorDesc(fetchCode, "CLOSE SELECT_ALL_SLOT" );
02695         SQL_CHECKREAD_M( sqlErrDesc );
02696     };
02697 
02698     return *this;
02699 }

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Slot rm_Slot::Find ( Int32_t  a_libkey,
Int32_t  a_status 
) [private]

bool rm_Slot::operator== ( const rm_Slot sl2  )  const [inline, private]

Definition at line 389 of file rmdb.h.

References libraryKey, slotAddr, and slotKey.

00389                                               {
00390         return (    ( slotKey == sl2.slotKey )          &&
00391                     ( libraryKey == sl2.libraryKey )    &&
00392                     ( slotAddr == sl2.slotAddr )        );
00393     };


Friends And Related Function Documentation

friend class rm_Operator [friend]

Definition at line 361 of file rmdb.h.

friend class rm_Medium [friend]

Definition at line 362 of file rmdb.h.


Member Data Documentation

Definition at line 393 of file rmdb.h.


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

Generated on Mon Feb 27 19:49:12 2012 for OPENARCHIVE by  doxygen 1.5.6