Public Attributes | Private Member Functions | Private Attributes | Friends

rm_Library Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_Library:
Collaboration graph
[legend]

List of all members.

Public Attributes

Int32_t libraryKey
rm_String libraryName
Int32_t status
rm_String host
rm_String controlDevice
Int32_t libraryType
Int32_t mediaFamily
Int32_t capabilities
Int32_t auditTime
Int32_t mediaAccessTime
Int32_t mediaXChgTime
Int32_t options
Int32_t loadNr
Int32_t unloadNr
rm_String vendorID
rm_String productID
rm_String serialNo
rm_String firmwareRev
rm_String scsiID

Private Member Functions

void Insert ()
void Update ()
void Remove (Int32_t a_libraryKey)
void Select (Int32_t a_libraryKey)
void SelectByName (rm_String a_name)
void StartSelectAll ()
void EndSelectAll ()
rm_LibraryNext ()
void Print ()
 rm_Library ()
 rm_Library (Int32_t a_key)
bool operator== (const rm_Library &lib2) const

Private Attributes

 log_CLASSID_m

Friends

class rm_Operator
class rm_Medium

Detailed Description

Definition at line 124 of file rmdb.h.


Constructor & Destructor Documentation

rm_Library::rm_Library (  )  [private]
rm_Library::rm_Library ( Int32_t  a_key  )  [private]

Member Function Documentation

void rm_Library::EndSelectAll (  )  [private]

Definition at line 726 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_LIB;

    g_libraryCursor_x.Unlock();
    string sqlErrDesc = errorDesc(SQLCODE,"EXEC SQL CLOSE SELECT_ALL_LIB");
    SQL_CHECKREAD_M(sqlErrDesc);
}

Here is the call graph for this function:

void rm_Library::Insert (  )  [private]

Definition at line 477 of file librmdb.exx.

References auditTime, capabilities, controlDevice, rm_String::cvalue_p, dbg_NORM, errorDesc(), firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, log_DBG_m, log_FUNC_m, MAX, mediaAccessTime, mediaFamily, mediaXChgTime, NAME, options, productID, scsiID, serialNo, SQL_CHECK_M, SQL_UNIQUEVIOLATION, status, unloadNr, and vendorID.

Referenced by rm_Operator::Add().

                        {
    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    Int32_t  k(0);
    if (libraryKey == 0) {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans MAX(libraryKey)
                INTO :k FROM Library;
        libraryKey = ++k;
        log_DBG_m(dbg_NORM,"New libraryKey:" << libraryKey);
    }
    else {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            libraryKey INTO :k FROM LIBRARY
                    WHERE libraryKey = :libraryKey;
        if (SQLCODE == 0) {
            log_DBG_m(dbg_NORM,"key exists:" << libraryKey);
            throw ivd_DBException( SQL_UNIQUEVIOLATION ,"Library Key already exists:" );
        }
    }
    log_DBG_m(dbg_NORM,"Inserting record");
    EXEC SQL
        INSERT TRANSACTION readWriteTrans
            INTO Library VALUES(
                                    :libraryKey,
                                    :libraryName.cvalue_p,
                                    :status,
                                    :host.cvalue_p,
                                    :controlDevice.cvalue_p,
                                    :libraryType,
                                    :mediaFamily,
                                    :capabilities,
                                    :auditTime,
                                    :mediaAccessTime,
                                    :mediaXChgTime,
                                    :options,
                                    :loadNr,
                                    :unloadNr,
                                    :vendorID.cvalue_p,
                                    :productID.cvalue_p,
                                    :serialNo.cvalue_p,
                                    :firmwareRev.cvalue_p,
                                    :scsiID.cvalue_p
                                );

    log_DBG_m(dbg_NORM,"Inserting record finished SQLCODE:"  << SQLCODE );

    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into Library",libraryKey);
    SQL_CHECK_M( sqlErrDesc );
} // rm_Library::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Library & rm_Library::Next (  )  [private]

Definition at line 737 of file librmdb.exx.

References auditTime, capabilities, controlDevice, errorDesc(), firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, log_FUNC_m, mediaAccessTime, mediaFamily, mediaXChgTime, options, productID, scsiID, serialNo, SQL_CHECKREAD_M, SQL_NOERROR, status, unloadNr, cmn_Mutex::Unlock(), and vendorID.

Referenced by rm_Operator::SelectAllLibraries().

                             {
    log_FUNC_m(Next);

    char libraryNameVal[rmdb_MAX_LIBRARYNAME];
    char controlDeviceVal[rmdb_MAX_CTRLDEVICE];
    char hostVal[rmdb_MAX_HOSTNAME];
    char vendorIDVal[rmdb_MAX_VENDORID];
    char productIDVal[rmdb_MAX_PRODUCTID];
    char serialNoVal[rmdb_MAX_SERIALNO];
    char firmwareRevVal[rmdb_MAX_FIRMWAREREV];
    char scsiIDVal[rmdb_MAX_SCSIID];

    EXEC SQL
        FETCH SELECT_ALL_LIB
            INTO
                :libraryKey,
                :libraryNameVal,
                :status,
                :hostVal,
                :controlDeviceVal,
                :libraryType,
                :mediaFamily,
                :capabilities,
                :auditTime,
                :mediaAccessTime,
                :mediaXChgTime,
                :options,
                :loadNr,
                :unloadNr,
                :vendorIDVal,
                :productIDVal,
                :serialNoVal,
                :firmwareRevVal,
                :scsiIDVal;

    if (SQLCODE == SQL_NOERROR) {
        libraryName = libraryNameVal;
        host        = hostVal;
        controlDevice = controlDeviceVal;
        vendorID    = vendorIDVal;
        productID   = productIDVal;
        serialNo    = serialNoVal;
        firmwareRev     = firmwareRevVal;
        scsiID          = scsiIDVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_LIB;

        g_libraryCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode,"EXEC SQL Fetch SELECT_ALL_LIB");
        SQL_CHECKREAD_M(sqlErrDesc);

    };
    return *this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Library::operator== ( const rm_Library lib2  )  const [inline, private]

Definition at line 191 of file rmdb.h.

References capabilities, libraryKey, rm_Medium::libraryKey, libraryName, mediaFamily, productID, serialNo, and vendorID.

                                                  {
        return (    (libraryKey   == lib2.libraryKey)   &&
                    (mediaFamily  == lib2.mediaFamily)  &&
                    (capabilities == lib2.capabilities) &&
                    (libraryName  == lib2.libraryName)  &&
                    (vendorID     == lib2.vendorID)     &&
                    (productID    == lib2.productID)    &&
                    (serialNo     == lib2.serialNo)
               );
    };

void rm_Library::Print (  )  [private]

Definition at line 799 of file librmdb.exx.

References auditTime, capabilities, controlDevice, firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, mediaAccessTime, mediaFamily, mediaXChgTime, options, productID, scsiID, serialNo, status, unloadNr, and vendorID.

                       {
    cout << "libraryKey :" <<     libraryKey<< "<-" << endl;
    cout << "libraryName :" <<     libraryName<< "<-" << endl;
    cout << "status :" <<     status<< "<-" << endl;
    cout << "host :" <<     host<< "<-" << endl;
    cout << "controlDevice :" <<     controlDevice<< "<-" << endl;
    cout << "libraryType :" <<     libraryType<< "<-" << endl;
    cout << "mediaFamily :" <<     mediaFamily<< "<-" << endl;
    cout << "capabilities :" <<     capabilities<< "<-" << endl;
    cout << "auditTime :" <<     auditTime<< "<-" << endl;
    cout << "mediaAccessTime :" <<     mediaAccessTime<< "<-" << endl;
    cout << "mediaXChgTime :" <<     mediaXChgTime<< "<-" << endl;
    cout << "options :" <<     options<< "<-" << endl;
    cout << "loadNr :" <<     loadNr<< "<-" << endl;
    cout << "unloadNr :" <<     unloadNr<< "<-" << endl;
    cout << "vendorID :" <<     vendorID<< "<-" << endl;
    cout << "productID :" <<     productID<< "<-" << endl;
    cout << "serialNo :" <<     serialNo<< "<-" << endl;
    cout << "firmwareRev :" <<     firmwareRev << "<-" << endl;
    cout << "scsiID :" <<     scsiID << "<-" << endl;

} //  rm_Library::Select

void rm_Library::Remove ( Int32_t  a_libraryKey  )  [private]

Definition at line 535 of file librmdb.exx.

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

Referenced by rm_Operator::RemoveLibrary().

                                            {

    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM LIBRARY WHERE LIBRARYKEY = :a_libraryKey;

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

    string sqlErrDesc = errorDesc(SQLCODE,"Remove Library record", a_libraryKey);
    SQL_CHECK_M( sqlErrDesc );
    log_DBG_m(dbg_DETAIL,"SQLCODE:" << SQLCODE);

} //  rm_Library::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Library::Select ( Int32_t  a_libraryKey  )  [private]

Definition at line 595 of file librmdb.exx.

References auditTime, capabilities, controlDevice, errorDesc(), firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, log_FUNC_m, mediaAccessTime, mediaFamily, mediaXChgTime, NAME, options, productID, scsiID, serialNo, SQL_CHECKREAD_M, SQL_NOERROR, status, unloadNr, and vendorID.

Referenced by rm_Operator::AllocateAdmin(), rm_Operator::AllocateRecall(), rm_Library(), rm_Operator::SelectDrive(), and rm_Operator::SelectLibrary().

                                            {
    log_FUNC_m(Select);

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

    char libraryNameVal[rmdb_MAX_LIBRARYNAME];
    char controlDeviceVal[rmdb_MAX_CTRLDEVICE];
    char hostVal[rmdb_MAX_HOSTNAME];
    char vendorIDVal[rmdb_MAX_VENDORID];
    char productIDVal[rmdb_MAX_PRODUCTID];
    char serialNoVal[rmdb_MAX_SERIALNO];
    char firmwareRevVal[rmdb_MAX_FIRMWAREREV];
    char scsiIDVal[rmdb_MAX_SCSIID];

    EXEC SQL SELECT TRANSACTION readTrans * INTO
                        :libraryKey,
                        :libraryNameVal,
                        :status,
                        :hostVal,
                        :controlDeviceVal,
                        :libraryType,
                        :mediaFamily,
                        :capabilities,
                        :auditTime,
                        :mediaAccessTime,
                        :mediaXChgTime,
                        :options,
                        :loadNr,
                        :unloadNr,
                        :vendorIDVal,
                        :productIDVal,
                        :serialNoVal,
                        :firmwareRevVal,
                        :scsiIDVal
                 FROM LIBRARY WHERE LIBRARYKEY = :a_libraryKey;

    if (SQLCODE == SQL_NOERROR) {
        libraryName     = libraryNameVal;
        controlDevice   = controlDeviceVal;
        host            = hostVal;
        vendorID        = vendorIDVal;
        productID       = productIDVal;
        serialNo        = serialNoVal;
        firmwareRev     = firmwareRevVal;
        scsiID          = scsiIDVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE,"Select record Library", a_libraryKey);
    SQL_CHECKREAD_M( sqlErrDesc );
} //  rm_Library::Select

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Library::SelectByName ( rm_String  a_name  )  [private]

Definition at line 651 of file librmdb.exx.

References auditTime, capabilities, controlDevice, rm_String::cvalue_p, errorDesc(), firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, log_FUNC_m, mediaAccessTime, mediaFamily, mediaXChgTime, NAME, options, productID, scsiID, serialNo, SQL_CHECKREAD_M, SQL_NOERROR, status, unloadNr, and vendorID.

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

                                              {
    log_FUNC_m(SelectByName);

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

    char libraryNameVal[rmdb_MAX_LIBRARYNAME];
    char controlDeviceVal[rmdb_MAX_CTRLDEVICE];
    char hostVal[rmdb_MAX_HOSTNAME];
    char vendorIDVal[rmdb_MAX_VENDORID];
    char productIDVal[rmdb_MAX_PRODUCTID];
    char serialNoVal[rmdb_MAX_SERIALNO];
    char firmwareRevVal[rmdb_MAX_FIRMWAREREV];
    char scsiIDVal[rmdb_MAX_SCSIID];

    EXEC SQL SELECT TRANSACTION readTrans * INTO
                        :libraryKey,
                        :libraryNameVal,
                        :status,
                        :hostVal,
                        :controlDeviceVal,
                        :libraryType,
                        :mediaFamily,
                        :capabilities,
                        :auditTime,
                        :mediaAccessTime,
                        :mediaXChgTime,
                        :options,
                        :loadNr,
                        :unloadNr,
                        :vendorIDVal,
                        :productIDVal,
                        :serialNoVal,
                        :firmwareRevVal,
                        :scsiIDVal
                 FROM LIBRARY WHERE LIBRARYNAME = :a_name.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        libraryName     = libraryNameVal;
        controlDevice   = controlDeviceVal;
        host            = hostVal;
        vendorID        = vendorIDVal;
        productID       = productIDVal;
        serialNo        = serialNoVal;
        firmwareRev     = firmwareRevVal;
        scsiID          = scsiIDVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE, "Selecting Library record by Name " , a_name);
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Library::StartSelectAll (  )  [private]

Definition at line 705 of file librmdb.exx.

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

Referenced by rm_Operator::SelectAllLibraries().

                               {
    log_FUNC_m(StartSelectAll);

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

    EXEC SQL
        OPEN TRANSACTION readTrans SELECT_ALL_LIB;

    if ( SQLCODE != 0 ) {
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_LIB Cursor failed");
        log_DBG_m(dbg_LOW, sqlErrDesc);
        log_ERR_m(sqlErrDesc);
        g_libraryCursor_x.Unlock();
        throw ivd_DBException( SQLCODE ,sqlErrDesc, true);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Library::Update (  )  [private]

Definition at line 556 of file librmdb.exx.

References auditTime, capabilities, controlDevice, rm_String::cvalue_p, errorDesc(), firmwareRev, host, libraryKey, libraryName, libraryType, loadNr, log_FUNC_m, mediaAccessTime, mediaFamily, mediaXChgTime, NAME, options, productID, scsiID, serialNo, SQL_CHECK_M, status, unloadNr, and vendorID.

Referenced by rm_Operator::Update().

                        {

    log_FUNC_m(Update);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        LIBRARY SET
                    LIBRARYKEY =    :libraryKey,
                    LIBRARYNAME =   :libraryName.cvalue_p,
                    STATUS =        :status,
                    HOST =          :host.cvalue_p,
                    CONTROLDEVICE = :controlDevice.cvalue_p,
                    LIBRARYTYPE =   :libraryType,
                    MEDIAFAMILY =   :mediaFamily,
                    CAPABILITIES =  :capabilities,
                    AUDITTIME =     :auditTime,
                    MEDIAACCESSTIME = :mediaAccessTime,
                    MEDIAXCHGTIME = :mediaXChgTime,
                    OPTIONS =       :options,
                    LOADNR =        :loadNr,
                    UNLOADNR =      :unloadNr,
                    VENDORID =      :vendorID.cvalue_p,
                    PRODUCTID =     :productID.cvalue_p,
                    SERIALNO =      :serialNo.cvalue_p,
                    FIRMWAREREV =   :firmwareRev.cvalue_p,
                    SCSIID =        :scsiID.cvalue_p
             WHERE libraryKey = :libraryKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Update record Library", libraryKey);
    SQL_CHECK_M( sqlErrDesc );
} //  rm_Library::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 127 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 126 of file rmdb.h.


Member Data Documentation

Definition at line 200 of file rmdb.h.


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