Public Member Functions | Public Attributes | Private Member Functions | Friends

rm_Medium Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_Medium:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void Select (Int32_t a_mediumKey)
void SelectByBarcode (rm_String a_name)
void StartSelectAll ()
void EndSelectAll ()
rm_MediumNext ()
rm_MedList SelectByStatus (Int32_t a_status)
rm_Medium SelectByDrive (Int32_t a_driveKey)
void SelectBySlot (Int32_t a_slotKey)
vector< rm_MediumSelectByPartition (rm_String a_partName)
void Print ()
 rm_Medium ()
 rm_Medium (Int32_t a_mediumKey)
i_Medium_t Convert2Corba ()
bool operator== (const rm_Medium &m2) const

Public Attributes

Int32_t mediumKey
Int32_t mediaPoolKey
Int32_t libraryKey
Int32_t slotKey
Int32_t diskSubsysKey
Int32_t driveKey
rm_String barcode
Int32_t status
rm_String location
Int32_t mediumType
rm_String mediumSerialNo
Int32_t blockSize
Int16_t numOfVolumes
Int16_t idxOfSysVol
Int32_t sizeOfSysVol
Int16_t currentVolume
 log_CLASSID_m

Private Member Functions

void Insert ()
void Update ()
void Remove (Int32_t a_mediumKey)

Friends

class rm_Operator
class rm_MediumPos_t

Detailed Description

Definition at line 485 of file rmdb.h.


Constructor & Destructor Documentation

rm_Medium::rm_Medium (  ) 
rm_Medium::rm_Medium ( Int32_t  a_mediumKey  ) 

Definition at line 2741 of file librmdb.exx.

References Select().

Here is the call graph for this function:


Member Function Documentation

i_Medium_t rm_Medium::Convert2Corba (  ) 

Definition at line 2153 of file rm_operator.cpp.

References barcode, i_Medium_t::barcode, blockSize, i_Medium_t::blockSize, currentVolume, i_Medium_t::currentVolume, i_Medium_t::diskSubsysName, driveKey, rm_Drive::driveName, i_Medium_t::driveName, idxOfSysVol, i_Medium_t::idxOfSysVol, ipc_nilStr, rm_Library::libraryKey, libraryKey, rm_Library::libraryName, i_Medium_t::libraryName, location, i_Medium_t::location, log_FUNC_m, mediaPoolKey, rm_MediaPool::mediaPoolName, i_Medium_t::mediaPoolName, mediumKey, i_Medium_t::mediumKey, mediumSerialNo, i_Medium_t::mediumSerialNo, mediumType, i_Medium_t::mediumType, numOfVolumes, i_Medium_t::numOfVolumes, rm_Partition::partitionName, i_Medium_t::partitionName, rm_MediaPool::partitionUUIDString, rm_Partition::SelectByUuid(), sizeOfSysVol, i_Medium_t::sizeOfSysVol, rm_Slot::slotAddr, i_Medium_t::slotAddr, slotKey, rm_Slot::slotType, i_Medium_t::slotType, status, and i_Medium_t::status.

Referenced by rm_Operator::GetMediaInfo(), and rm_Operator::SelectMedium().

                                    {
    log_FUNC_m(Convert2Corba);
    try {
        i_Medium_t iMedium;
        iMedium.mediumKey         =  mediumKey;
        if ( mediaPoolKey > 0 ) {
            rm_MediaPool mp( mediaPoolKey);
            iMedium.mediaPoolName    = CORBA::string_dup(mp.mediaPoolName.c_str());
            if (!mp.partitionUUIDString.empty()){
                rm_Partition pm;
                pm.SelectByUuid(mp.partitionUUIDString);
                iMedium.partitionName = CORBA::string_dup(pm.partitionName.c_str());
            } else {
                iMedium.partitionName = CORBA::string_dup(ipc_nilStr);
            }
        } else {
            iMedium.mediaPoolName    = CORBA::string_dup(ipc_nilStr);
        }


        if ( libraryKey > 0) {
            rm_Library lib( libraryKey);
            iMedium.libraryName       = CORBA::string_dup(lib.libraryName.c_str());

            if ( slotKey > 0) {
                rm_Slot s( slotKey,lib.libraryKey);
                iMedium.slotAddr          = CORBA::string_dup(s.slotAddr.c_str());
                iMedium.slotType          = s.slotType;
            } else {
                iMedium.slotAddr          = CORBA::string_dup(ipc_nilStr);
                iMedium.slotType          = 0;
            }


        } else {
            iMedium.libraryName       = CORBA::string_dup(ipc_nilStr);
        }


        if ( driveKey > 0) {
            rm_Drive d( driveKey);
            iMedium.driveName    = CORBA::string_dup(d.driveName.c_str());
        } else {
            iMedium.driveName    = CORBA::string_dup(ipc_nilStr);
        }


        iMedium.diskSubsysName    = CORBA::string_dup(ipc_nilStr);

        iMedium.barcode          = CORBA::string_dup( barcode.c_str());
        iMedium.status           =  status;
        iMedium.location         = CORBA::string_dup( location.c_str());
        iMedium.mediumType        =  mediumType;
        iMedium.mediumSerialNo    = CORBA::string_dup( mediumSerialNo.c_str());
        iMedium.blockSize        =  blockSize;
        iMedium.numOfVolumes     =  numOfVolumes;
        iMedium.idxOfSysVol      =  idxOfSysVol;
        iMedium.sizeOfSysVol     =  sizeOfSysVol;
        iMedium.currentVolume    =  currentVolume;

    return iMedium;
    }rm_CATCH_DB_THROW_IVD_m;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Medium::EndSelectAll (  ) 

Definition at line 3055 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_MEDIA;
    g_mediumCursor_x.Unlock();
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIA" );
    SQL_CHECKREAD_M( sqlErrDesc );

}

Here is the call graph for this function:

void rm_Medium::Insert (  )  [private]

Definition at line 2750 of file librmdb.exx.

References barcode, blockSize, currentVolume, rm_String::cvalue_p, dbg_NORM, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, ie_PRECONDITION, ivd_Error, libraryKey, location, log_DBG_m, log_FUNC_m, MAX, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECK_M, SQL_NOERROR, SQL_UNIQUEVIOLATION, and status.

Referenced by rm_Operator::Add(), and rm_Operator::InventoryUpdate().

                       {
    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    Int32_t  k(0);
    if (mediumKey == 0) {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            MAX(MEDIAKEY) INTO :k FROM MEDIA;
        mediumKey = ++k;
        if (k > USHRT_MAX) {
            stringstream err;
            err << " The medium key is too large ("
                << k << "). Not supported by the FSC. "
                << " (Barcode: " << barcode.cvalue_p << ")\n";
            throw ivd_Error(ie_PRECONDITION, err.str(), true);
        }
        log_DBG_m(dbg_NORM,"new key:" << mediumKey);
    }
    else {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            MEDIAKEY INTO :k FROM MEDIA
            WHERE MEDIAKEY = :mediumKey;
        if (SQLCODE == SQL_NOERROR) {
            log_DBG_m(dbg_NORM,"key exists");
            throw ivd_DBException( SQL_UNIQUEVIOLATION ,"Medium Key already exists");
        }
    }
    if (mediaPoolKey < 1)  bi1 = -1; else bi1 = 0;
    if (libraryKey < 1)    bi2 = -1; else bi2 = 0;
    if (slotKey < 1)       bi3 = -1; else bi3 = 0;
    if (diskSubsysKey < 1) bi4 = -1; else bi4 = 0;
    if (driveKey < 1)      bi5 = -1; else bi5 = 0;
    if (currentVolume < 1) bi6 = -1; else bi6 = 0;

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO MEDIA VALUES(
                   :mediumKey,
                   :mediaPoolKey INDICATOR :bi1,
                   :libraryKey INDICATOR :bi2,
                   :slotKey INDICATOR :bi3,
                   :diskSubsysKey INDICATOR :bi4,
                   :driveKey INDICATOR :bi5,
                   :barcode.cvalue_p,
                   :status,
                   :location.cvalue_p,
                   :mediumType,
                   :mediumSerialNo.cvalue_p,
                   :blockSize,
                   :numOfVolumes,
                   :idxOfSysVol,
                   :sizeOfSysVol,
                   :currentVolume INDICATOR :bi6
                );
    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into Medium", mediumKey);
    SQL_CHECK_M( sqlErrDesc );

}// rm_Medium::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_Medium & rm_Medium::Next (  ) 

Definition at line 3066 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, status, and cmn_Mutex::Unlock().

Referenced by rm_Operator::SelectAllMedium().

                           {
    log_FUNC_m(Next);

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    EXEC SQL
        FETCH SELECT_ALL_MEDIA
            INTO
               :mediumKey,
               :mediaPoolKey,
               :libraryKey,
               :slotKey,
               :diskSubsysKey,
               :driveKey,
               :barcodeVal,
               :status,
               :locationVal,
               :mediumType,
               :mediumSerialNoVal,
               :blockSize,
               :numOfVolumes,
               :idxOfSysVol,
               :sizeOfSysVol,
               :currentVolume;

    if (SQLCODE == SQL_NOERROR) {
        barcode =  barcodeVal;
        location = locationVal;
        mediumSerialNo = mediumSerialNoVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_MEDIA;
        g_mediumCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "CLOSE SELECT_ALL_MEDIA" );
        SQL_CHECKREAD_M( sqlErrDesc );
    };

    return *this;

}

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_Medium::operator== ( const rm_Medium m2  )  const [inline]

Definition at line 534 of file rmdb.h.

References barcode, mediaPoolKey, mediumKey, rm_MediumPos_t::mediumKey, mediumSerialNo, and mediumType.

                                               {
        return (    ( mediumKey      == m2.mediumKey )        &&
                    ( mediaPoolKey  == m2.mediaPoolKey )    &&
                    ( mediumType     == m2.mediumType )       &&
                    ( mediumSerialNo == m2.mediumSerialNo )   &&
                    ( barcode        == m2.barcode )               );
    };

void rm_Medium::Print (  ) 

Definition at line 3288 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, idxOfSysVol, libraryKey, location, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, numOfVolumes, sizeOfSysVol, slotKey, and status.

                      {
    cout << "NOW PRINTING MEDIA:    " << endl;
    cout << "mediumKey :         " <<     mediumKey     << "<-" << endl;
    cout << "mediaPoolKey :     " <<     mediaPoolKey << "<-" << endl;
    cout << "libraryKey :       " <<     libraryKey   << "<-" << endl;
    cout << "slotKey :          " <<     slotKey      << "<-" << endl;
    cout << "diskSubsysKey :    " <<     diskSubsysKey<< "<-" << endl;
    cout << "driveKey :         " <<     driveKey     << "<-" << endl;
    cout << "barcode:           " <<     barcode      << "<-" << endl;
    cout << "status :           " <<     status       << "<-" << endl;
    cout << "location :         " <<     location     << "<-" << endl;
    cout << "mediumType :        " <<     mediumType    << "<-" << endl;
    cout << "mediumSerialNo :    " <<     mediumSerialNo << "<-" << endl;
    cout << "blockSize :        " <<     blockSize    << "<-" << endl;
    cout << "numOfVolumes :     " <<     numOfVolumes << "<-" << endl;
    cout << "idxOfSysVol :      " <<     idxOfSysVol  << "<-" << endl;
    cout << "sizeOfSysVol :     " <<     sizeOfSysVol << "<-" << endl;
    cout << "currentVolume :    " <<     currentVolume<< "<-" << endl;

} //  rm_Medium::Print

void rm_Medium::Remove ( Int32_t  a_mediumKey  )  [private]

Definition at line 2815 of file librmdb.exx.

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

Referenced by rm_Operator::RemoveMedium().

                                          {
    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM MEDIA WHERE MEDIAKEY = :a_mediumKey;

    string sqlErrDesc = errorDesc(SQLCODE,"check for free slot", a_mediumKey);
    SQL_CHECK_M( sqlErrDesc );

}// rm_Medium::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Medium::Select ( Int32_t  a_mediumKey  ) 

Definition at line 2874 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::AllocateAdmin(), rm_Operator::AllocateMigCollocation(), rm_Operator::GetBestCopy(), rm_Medium(), rm_Operator::SelectMedium(), rm_Operator::SelectMediumVol(), and rm_Operator::VolumeFull().

                                          {

    log_FUNC_m(Select);

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

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];
    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
               :mediumKey,
               :mediaPoolKey,
               :libraryKey,
               :slotKey,
               :diskSubsysKey,
               :driveKey,
               :barcodeVal,
               :status,
               :locationVal,
               :mediumType,
               :mediumSerialNoVal,
               :blockSize,
               :numOfVolumes,
               :idxOfSysVol,
               :sizeOfSysVol,
               :currentVolume
        FROM MEDIA WHERE MEDIAKEY = :a_mediumKey;

    if (SQLCODE == SQL_NOERROR) {
        barcode =  barcodeVal;
        location = locationVal;
        mediumSerialNo = mediumSerialNoVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE,"Select record from Medium", a_mediumKey);
    SQL_CHECKREAD_M( sqlErrDesc );
}// rm_Medium::Select()

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Medium::SelectByBarcode ( rm_String  a_name  ) 

Definition at line 2917 of file librmdb.exx.

References barcode, blockSize, currentVolume, rm_String::cvalue_p, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::Add(), rm_Operator::InventoryUpdate(), rm_Operator::MediumLoaded(), rm_Operator::MediumUnLoaded(), rm_Operator::RemoveMedium(), rm_Operator::RemoveMediumVol(), rm_Operator::SelectAllMediumVolByMedium(), rm_Operator::SelectMedium(), rm_Operator::SelectMediumVol(), and rm_Operator::Update().

                                                {
    log_FUNC_m(SelectByName);

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

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
               :mediumKey,
               :mediaPoolKey,
               :libraryKey,
               :slotKey,
               :diskSubsysKey,
               :driveKey,
               :barcodeVal,
               :status,
               :locationVal,
               :mediumType,
               :mediumSerialNoVal,
               :blockSize,
               :numOfVolumes,
               :idxOfSysVol,
               :sizeOfSysVol,
               :currentVolume
         FROM MEDIA WHERE BARCODE = :a_name.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        barcode =  barcodeVal;
        location = locationVal;
        mediumSerialNo = mediumSerialNoVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE, "Selecting Medium 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:

rm_Medium rm_Medium::SelectByDrive ( Int32_t  a_driveKey  ) 

Definition at line 3112 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::AllocateAdmin(), rm_Operator::AllocateRecall(), rm_Operator::InventoryUpdate(), rm_Operator::SelectDriveForMig(), and rm_Operator::SelectMediumByDrive().

                                                    {
    log_FUNC_m(SelectByDrive);
    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
               :mediumKey,
               :mediaPoolKey,
               :libraryKey,
               :slotKey,
               :diskSubsysKey,
               :driveKey,
               :barcodeVal,
               :status,
               :locationVal,
               :mediumType,
               :mediumSerialNoVal,
               :blockSize,
               :numOfVolumes,
               :idxOfSysVol,
               :sizeOfSysVol,
               :currentVolume
         FROM MEDIA WHERE DRIVEKEY = :a_driveKey;

    if (SQLCODE == SQL_NOERROR) {
        barcode =  barcodeVal;
        location = locationVal;
        mediumSerialNo = mediumSerialNoVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE, "Selecting Medium record by Drive");
    SQL_CHECKREAD_M( sqlErrDesc );
    return *this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

vector< rm_Medium > rm_Medium::SelectByPartition ( rm_String  a_partName  ) 

Definition at line 3196 of file librmdb.exx.

References barcode, blockSize, cmn_Num2Str(), currentVolume, rm_String::cvalue_p, dbg_DETAIL, dbg_LOW, dbg_NORM, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, ie_RMDB_ERROR, ivd_Error, libraryKey, location, log_DBG_m, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, and status.

Referenced by rm_Operator::GetMediaInfo(), and rm_Operator::SelectAllMediaByPart().

                                                                  {
    log_FUNC_m(SelectByPartition);

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

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];


    EXEC SQL
        DECLARE SELECT_MEDIA_BY_PARTITION CURSOR FOR
        SELECT MEDIA.*
            FROM MEDIA, MEDIAPOOL, PARTITION
        WHERE
            MEDIA.MEDIAPOOLKEY = MEDIAPOOL.MEDIAPOOLKEY AND
            MEDIAPOOL.PARTITIONUUID = PARTITION.PARTUUID AND
            PARTITION.PARTNAME = :a_partName.cvalue_p
        ORDER BY MEDIA.MEDIAKEY;

    log_DBG_m(dbg_DETAIL,"Will select all media for Partition:" << a_partName);

    if (SQLCODE != SQL_NOERROR) {
        log_DBG_m(dbg_DETAIL,"SQLERROR when declaring Cursor SELECT_MEDIA_BY_PARTITION " << SQLCODE);
        throw ivd_Error(ie_RMDB_ERROR, "Declare SELECT_MEDIA_BY_PARTITION Cursor failed");
    }

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MEDIA_BY_PARTITION;

    vector<rm_Medium> mediumVec;
    bool endOfCursor = false;
    do {
        EXEC SQL
            FETCH SELECT_MEDIA_BY_PARTITION
                INTO
                :mediumKey,
                :mediaPoolKey,
                :libraryKey,
                :slotKey,
                :diskSubsysKey,
                :driveKey,
                :barcodeVal,
                :status,
                :locationVal,
                :mediumType,
                :mediumSerialNoVal,
                :blockSize,
                :numOfVolumes,
                :idxOfSysVol,
                :sizeOfSysVol,
                :currentVolume;

            if (SQLCODE == SQL_NOERROR) {
                log_DBG_m(dbg_DETAIL,"Selected volume [BarcodeVal, MediumKey, PartName]: ["
                                 << barcodeVal << "," << mediumKey << "," << a_partName );

                barcode =  barcodeVal;
                location = locationVal;
                mediumSerialNo = mediumSerialNoVal;

                mediumVec.push_back(*this);
            }
            else if (SQLCODE == SQL_NOTFOUND) {
                log_DBG_m(dbg_NORM,"reached end of cursor");
                endOfCursor = true;
            }
            else {
                log_DBG_m(dbg_LOW,"Fatal Medium error sqlcode: " << SQLCODE );
                throw ivd_Error (
                            ie_RMDB_ERROR,
                            "Fatal Medium select by Partition error sqlcode:"
                            + cmn_Num2Str((Int32_t)SQLCODE),
                            true);
            };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_MEDIA_BY_PARTITION;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIA_BY_PARTITION" );
    SQL_CHECKREAD_M( sqlErrDesc );
    return mediumVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_Medium::SelectBySlot ( Int32_t  a_slotKey  ) 

Definition at line 3154 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::InventoryUpdate().

                                             {
    log_FUNC_m(SelectBySlot);
    EXEC SQL
        SET TRANSACTION NAME readTrans
            READ ONLY
            ISOLATION LEVEL READ COMMITTED;

    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :mediumKey,
            :mediaPoolKey,
            :libraryKey,
            :slotKey,
            :diskSubsysKey,
            :driveKey,
            :barcodeVal,
            :status,
            :locationVal,
            :mediumType,
            :mediumSerialNoVal,
            :blockSize,
            :numOfVolumes,
            :idxOfSysVol,
            :sizeOfSysVol,
            :currentVolume
        FROM MEDIA WHERE SLOTKEY = :a_slotKey;

    if (SQLCODE == SQL_NOERROR) {
        barcode =  barcodeVal;
        location = locationVal;
        mediumSerialNo = mediumSerialNoVal;
    };
    string sqlErrDesc = errorDesc(SQLCODE, "Selecting Medium record by Slot " , a_slotKey);
    SQL_CHECKREAD_M( sqlErrDesc );

}

Here is the call graph for this function:

Here is the caller graph for this function:

rm_MedList rm_Medium::SelectByStatus ( Int32_t  a_status  ) 

Definition at line 2961 of file librmdb.exx.

References barcode, blockSize, currentVolume, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_ERR_m, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, and status.

                                                    {
    log_FUNC_m(SelectByStatus);

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

    EXEC SQL
        DECLARE SELECT_FREE_MEDIA CURSOR FOR
        SELECT * FROM MEDIA
            WHERE
            bin_and(MEDIA.STATUS,  :a_status) = 0;

    EXEC SQL
        OPEN TRANSACTION readTrans SELECT_FREE_MEDIA;

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

    rm_MedList medVec;
    char barcodeVal[rmdb_MAX_BARCODE];
    char locationVal[rmdb_MAX_LOCATION];
    char mediumSerialNoVal[rmdb_MAX_MEDIUMSERIALNO];

    while (SQLCODE == SQL_NOERROR){

        EXEC SQL
            FETCH SELECT_FREE_MEDIA
                INTO
                   :mediumKey,
                   :mediaPoolKey,
                   :libraryKey,
                   :slotKey,
                   :diskSubsysKey,
                   :driveKey,
                   :barcodeVal,
                   :status,
                   :locationVal,
                   :mediumType,
                   :mediumSerialNoVal,
                   :blockSize,
                   :numOfVolumes,
                   :idxOfSysVol,
                   :sizeOfSysVol,
                   :currentVolume;

        if (SQLCODE == SQL_NOERROR) {
            barcode =  barcodeVal;
            location = locationVal;
            mediumSerialNo = mediumSerialNoVal;
        };
        medVec.push_back(*this);
    };

    if (SQLCODE != SQL_NOTFOUND){
        string sqlErrDesc = errorDesc(SQLCODE,"end of SELECT_ALL_MEDIA cursor");
        SQL_CHECKREAD_M( sqlErrDesc );
    };
    EXEC SQL
        CLOSE SELECT_ALL_MEDIA;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIA" );
    SQL_CHECKREAD_M( sqlErrDesc );

    return medVec;
}

Here is the call graph for this function:

void rm_Medium::StartSelectAll (  ) 

Definition at line 3033 of file librmdb.exx.

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

Referenced by rm_Operator::SelectAllMedium().

                              {
    log_FUNC_m(StartSelectAll);

    g_mediumCursor_x.Lock();

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_MEDIA;

    if ( SQLCODE != SQL_NOERROR ) {
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_MEDIA Cursor failed");
        log_ERR_m(sqlErrDesc);
        g_mediumCursor_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_Medium::Update (  )  [private]

Definition at line 2833 of file librmdb.exx.

References barcode, blockSize, currentVolume, rm_String::cvalue_p, diskSubsysKey, driveKey, errorDesc(), idxOfSysVol, libraryKey, location, log_FUNC_m, mediaPoolKey, mediumKey, mediumSerialNo, mediumType, NAME, numOfVolumes, sizeOfSysVol, slotKey, SQL_CHECK_M, and status.

Referenced by rm_Operator::AllocateAdmin(), rm_Operator::AllocateRecall(), rm_Operator::InventoryUpdate(), rm_Operator::MediumLoaded(), rm_Operator::MediumUnLoaded(), rm_Operator::ReleaseResources(), rm_Operator::Update(), and rm_Operator::VolumeFull().

                       {
    log_FUNC_m(Update);

    if (mediaPoolKey    < 1)  bi1 = -1; else bi1 = 0;
    if (libraryKey      < 1)  bi2 = -1; else bi2 = 0;
    if (slotKey         < 1)  bi3 = -1; else bi3 = 0;
    if (diskSubsysKey   < 1)  bi4 = -1; else bi4 = 0;
    if (driveKey        < 1)  bi5 = -1; else bi5 = 0;
    if (currentVolume   < 1)  bi6 = -1; else bi6 = 0;

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        MEDIA SET
            MEDIAPOOLKEY    = :mediaPoolKey INDICATOR :bi1,
            LIBRARYKEY      = :libraryKey INDICATOR :bi2,
            SLOTKEY         = :slotKey INDICATOR :bi3,
            DISKSUBSYSKEY   = :diskSubsysKey INDICATOR :bi4,
            DRIVEKEY        = :driveKey INDICATOR :bi5,
            BARCODE         = :barcode.cvalue_p,
            STATUS          = :status,
            LOCATION        = :location.cvalue_p,
            MEDIATYPE       = :mediumType,
            MEDIASERIALNO   = :mediumSerialNo.cvalue_p,
            BLOCKSIZE       = :blockSize,
            NUMOFVOLUMES    = :numOfVolumes,
            IDXOFSYSVOL     = :idxOfSysVol,
            SIZEOFSYSVOL    = :sizeOfSysVol,
            CURRENTVOLUME   = :currentVolume INDICATOR :bi6

       WHERE MEDIAKEY = :mediumKey;
    string sqlErrDesc = errorDesc(SQLCODE,"Update Medium record", mediumKey);
    SQL_CHECK_M( sqlErrDesc );

}// rm_Medium::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_MediumPos_t [friend]

Definition at line 488 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 487 of file rmdb.h.


Member Data Documentation

Definition at line 540 of file rmdb.h.


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