Public Attributes | Private Member Functions | Private Attributes | Friends

rm_Slot Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_Slot:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 373 of file rmdb.h.


Constructor & Destructor Documentation

rm_Slot::rm_Slot (  )  [private]

Definition at line 2515 of file librmdb.exx.

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

Definition at line 2519 of file librmdb.exx.

References Select().

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

Here is the call graph for this function:


Member Function Documentation

void rm_Slot::EndSelectAll (  )  [private]

Definition at line 2687 of file librmdb.exx.

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

                          {
    log_FUNC_m(EndSelectAll);

    EXEC SQL
        CLOSE SELECT_ALL_SLOT;
    g_slotCursor_x.Unlock();

    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_SLOT" );
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

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

Definition at line 2525 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().

                     {
    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    Int32_t k = 0;
    if (slotKey == 0) {
        EXEC SQL SELECT TRANSACTION readWriteTrans MAX(SLOTKEY) INTO :k FROM SLOT;
        slotKey = k + 1;
        log_DBG_m(dbg_NORM,"new key");
    }
    else {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            SLOTKEY INTO :k FROM SLOT
            WHERE SLOTKEY = :slotKey;
        if (SQLCODE == SQL_NOERROR) {
            log_DBG_m(dbg_NORM,"key exists");
            throw ivd_DBException( SQL_UNIQUEVIOLATION ,"Slot Key already exists");
        }
    }

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO SLOT VALUES(
                        :slotKey,
                        :libraryKey,
                        :slotAddr.cvalue_p,
                        :slotType,
                        :status
               );
    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into Slot", slotKey);
    SQL_CHECK_M( sqlErrDesc );

}// rm_Slot::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Slot & rm_Slot::Next (  )  [private]

Definition at line 2698 of file librmdb.exx.

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

Referenced by rm_Operator::SelectAllSlots().

                       {
    log_FUNC_m(Next);

    char slotAddrVal[rmdb_MAX_SLOTADDR];
    EXEC SQL
        FETCH SELECT_ALL_SLOT
            INTO
                :slotKey,
                :libraryKey,
                :slotAddrVal,
                :slotType,
                :status;

    if (SQLCODE == SQL_NOERROR) {
        slotAddr = slotAddrVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_SLOT;
        g_slotCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "CLOSE SELECT_ALL_SLOT" );
        SQL_CHECKREAD_M( sqlErrDesc );
    };

    return *this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 403 of file rmdb.h.

References libraryKey, rm_Medium::libraryKey, slotAddr, slotKey, and rm_Medium::slotKey.

                                              {
        return (    ( slotKey == sl2.slotKey )          &&
                    ( libraryKey == sl2.libraryKey )    &&
                    ( slotAddr == sl2.slotAddr )        );
    };

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

Definition at line 2564 of file librmdb.exx.

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

Referenced by rm_Operator::RemoveSlot().

                                                            {
    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM SLOT WHERE SLOTKEY = :a_slotKey AND LIBRARYKEY = :a_libraryKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Update Slot record", a_slotKey);
    SQL_CHECK_M( sqlErrDesc );

}// 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 2602 of file librmdb.exx.

References errorDesc(), libraryKey, log_FUNC_m, NAME, 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().

                                                            {
    log_FUNC_m(Select);

    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;


    char slotAddrVal[rmdb_MAX_SLOTADDR];
    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :slotKey,
            :libraryKey,
            :slotAddrVal,
            :slotType,
            :status
        FROM SLOT WHERE SLOTKEY = :a_slotKey AND LIBRARYKEY = :a_libraryKey ORDER BY SLOTKEY;
    if (SQLCODE == SQL_NOERROR) {
        slotAddr = slotAddrVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE,"Select Slot record", slotKey);
    SQL_CHECKREAD_M( sqlErrDesc );

}// 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 2631 of file librmdb.exx.

References rm_String::cvalue_p, errorDesc(), libraryKey, log_FUNC_m, NAME, 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().

                                                                                       {
    log_FUNC_m(Select);

    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char slotAddrVal[rmdb_MAX_SLOTADDR];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :slotKey,
            :libraryKey,
            :slotAddrVal,
            :slotType,
            :status
        FROM SLOT WHERE
            LIBRARYKEY = :a_libraryKey AND
            SLOTADDR = :a_addr.cvalue_p AND
            SLOTTYPE = :a_type
        ORDER BY SLOTKEY;

    if (SQLCODE == SQL_NOERROR) {
        slotAddr = slotAddrVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE,"Select Slot record by addr:" , a_addr);
    SQL_CHECKREAD_M( sqlErrDesc );

}// 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 2665 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().

                            {
    log_FUNC_m(StartSelectAll);

    g_slotCursor_x.Lock();
    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    EXEC SQL
        OPEN TRANSACTION readTrans SELECT_ALL_SLOT;

    log_DBG_m(dbg_DETAIL,"StartSelect All SQLCODE:" << SQLCODE);

    if ( SQLCODE != SQL_NOERROR ) {
        g_slotCursor_x.Unlock();
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_SLOT Cursor failed");
        log_ERR_m(sqlErrDesc);
        throw ivd_DBException( SQLCODE , sqlErrDesc, true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Slot::Update (  )  [private]

Definition at line 2581 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().

                     {
    log_FUNC_m(Update);
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        SLOT SET
            LIBRARYKEY =    :libraryKey,
            SLOTADDR =      :slotAddr.cvalue_p,
            SLOTTYPE =      :slotType,
            STATUS =        :status
        WHERE SLOTKEY = :slotKey AND LIBRARYKEY = :libraryKey;
    string sqlErrDesc = errorDesc(SQLCODE,"Update Slot record", slotKey);
    SQL_CHECK_M( sqlErrDesc );

}// rm_Slot::Update

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class rm_Medium [friend]

Definition at line 376 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 375 of file rmdb.h.


Member Data Documentation

Definition at line 407 of file rmdb.h.


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