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

rm_MediumVol Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_MediumVol:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void Select (Int32_t a_mediumKey, Int32_t a_medVolNr)
void SelectByMedVolId (rm_String &a_medVolId)
vector< rm_MediumVolSelectByPartition (rm_String a_partName)
vector< rm_MediumVolSelectByMedium (Int32_t a_mediumKey)
vector< rm_MediumVolSelectEmptyCollocation (UInt32_t a_poolKey)
vector< rm_MediumVolSelectByMajColId (UInt64_t a_majColId)
void StartSelectAll ()
void EndSelectAll ()
rm_MediumVolNext ()
 rm_MediumVol ()
 rm_MediumVol (Int32_t a_mediumKey, Int32_t a_medVolNr)
bool operator== (const rm_MediumVol &mv2) const

Public Attributes

Int32_t mediumKey
Int32_t medVolNr
rm_String medVolId
Int32_t status
Int32_t volType
Int32_t volUsed
Int32_t volSize
Int32_t accessNr
Int32_t writeNr
Int32_t owriteNr
rm_TimeStamp initTime
rm_TimeStamp accessTime
rm_TimeStamp writeTime
rm_TimeStamp owriteTime
rm_TimeStamp lastVerification
Int32_t totalData
Int32_t validData
 log_CLASSID_m

Private Member Functions

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

Friends

class rm_Operator
class rm_Medium

Detailed Description

Definition at line 545 of file rmdb.h.


Constructor & Destructor Documentation

rm_MediumVol::rm_MediumVol (  ) 

Definition at line 3317 of file librmdb.exx.

rm_MediumVol::rm_MediumVol ( Int32_t  a_mediumKey,
Int32_t  a_medVolNr 
)

Definition at line 3321 of file librmdb.exx.

References Select().

    :   medVolId(ivd_UUID_STR_SIZE_d) {
    Select(a_mediumVolKey, a_medVolNr);
}

Here is the call graph for this function:


Member Function Documentation

void rm_MediumVol::EndSelectAll (  ) 

Definition at line 3709 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_MEDIAVOL;
    g_mediumVolCursor_x.Unlock();
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIAVOL" );
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

void rm_MediumVol::Insert (  )  [private]

Definition at line 3328 of file librmdb.exx.

References accessNr, accessTime, rm_String::cvalue_p, errorDesc(), initTime, lastVerification, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECK_M, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::Add().

                          {
    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO MEDIAVOL VALUES(
                :mediumKey,
                :medVolNr,
                :medVolId.cvalue_p,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData
            );
    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into MediumVol");
    SQL_CHECK_M( sqlErrDesc );

}// rm_insert_MediumVol

Here is the call graph for this function:

Here is the caller graph for this function:

rm_MediumVol & rm_MediumVol::Next (  ) 

Definition at line 3719 of file librmdb.exx.

References accessNr, accessTime, errorDesc(), initTime, ivd_UUID_STR_SIZE_d, lastVerification, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, status, totalData, cmn_Mutex::Unlock(), validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::SelectAllMediumVol().

                                 {
    log_FUNC_m(Next);
    char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];

    EXEC SQL
        FETCH SELECT_ALL_MEDIAVOL
            INTO
                :mediumKey,
                :medVolNr,
                :medVolIdVal,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData;

    if (SQLCODE == SQL_NOERROR) {
        medVolId = medVolIdVal;
        initTime = initTime.m_iscTime;
        accessTime = accessTime.m_iscTime;
        writeTime = writeTime.m_iscTime;
        owriteTime = owriteTime.m_iscTime;
        lastVerification = lastVerification.m_iscTime;

    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_MEDIAVOL;

        g_mediumVolCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "reached end of SELECT_ALL_MEDIAVOL cursor");
        SQL_CHECKREAD_M( sqlErrDesc );
    };

    return *this;

}

Here is the call graph for this function:

Here is the caller graph for this function:

bool rm_MediumVol::operator== ( const rm_MediumVol mv2  )  const [inline]

Definition at line 595 of file rmdb.h.

References mediumKey, rm_Medium::mediumKey, medVolId, medVolNr, and volType.

                                                   {
        return (    ( medVolNr == mv2.medVolNr )    &&
                    ( mediumKey == mv2.mediumKey )    &&
                    ( volType  == mv2.volType )     &&
                    ( medVolId == mv2.medVolId )    );
    };

void rm_MediumVol::Remove ( Int32_t  a_mediumKey,
Int32_t  a_medVolNr 
) [private]

Definition at line 3363 of file librmdb.exx.

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

Referenced by rm_Operator::RemoveMediumVol().

                                                                 {
    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM MEDIAVOL
            WHERE
                MEDIAKEY = :a_mediumKey    AND
                MEDVOLNR = :a_medVolNr;

    string sqlErrDesc = errorDesc(SQLCODE,"Remove MediumVol record");
    SQL_CHECK_M( sqlErrDesc );
}// rm_insert_MediumVol

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediumVol::Select ( Int32_t  a_mediumKey,
Int32_t  a_medVolNr 
)

Definition at line 3416 of file librmdb.exx.

References accessNr, accessTime, cmn_Num2Str(), errorDesc(), initTime, ivd_UUID_STR_SIZE_d, lastVerification, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::AllocateMigCollocation(), rm_Operator::RemoveMediumVol(), rm_MediumVol(), rm_Operator::SelectMediumForMig(), rm_Operator::SelectMediumVol(), rm_Operator::SelectMediumVolumeCol(), rm_Operator::SelectMediumVolumeMig(), and rm_Operator::Update().

                                                                 {
    log_FUNC_m(Select);

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


    char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];
    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :mediumKey,
            :medVolNr,
            :medVolIdVal,
            :status,
            :volType,
            :volUsed,
            :volSize,
            :accessNr,
            :writeNr,
            :owriteNr,
            :initTime.m_iscTime,
            :accessTime.m_iscTime,
            :writeTime.m_iscTime,
            :owriteTime.m_iscTime,
            :lastVerification.m_iscTime,
            :totalData,
            :validData
         FROM MEDIAVOL WHERE
                MEDIAKEY = :a_mediumKey AND
                MEDVOLNR = :a_medVolNr;
    if (SQLCODE == SQL_NOERROR) {
        medVolId = medVolIdVal;
        initTime = initTime.m_iscTime;
        accessTime = accessTime.m_iscTime;
        writeTime = writeTime.m_iscTime;
        owriteTime = owriteTime.m_iscTime;
        lastVerification= lastVerification.m_iscTime;
    };
    string sqlErrDesc = errorDesc(SQLCODE,
                                    "Select MediumVol record with medVolNum:"
                                    + cmn_Num2Str(a_medVolNr) +
                                    +" mediumKey: " + cmn_Num2Str(a_mediumKey));
    SQL_CHECKREAD_M( sqlErrDesc );

}// rm_select_MediumVol

Here is the call graph for this function:

Here is the caller graph for this function:

vector< rm_MediumVol > rm_MediumVol::SelectByMajColId ( UInt64_t  a_majColId  ) 

Definition at line 3857 of file librmdb.exx.

References accessNr, accessTime, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, initTime, ivd_Error, ivd_UUID_STR_SIZE_d, lastVerification, log_DBG_m, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

                                                                       {
    log_FUNC_m(SelectByMajColId);

    Int32_t majHi = RMDB_COL_ID_HI(a_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(a_majColId);

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

    EXEC SQL
        DECLARE SELECT_MEDIAVOL_MAJCOLID CURSOR FOR
        SELECT MEDIAVOL.*
            FROM MEDIAVOL, MAJORCOL, MINORCOL, COLMEDIAVOL
        WHERE
            MAJORCOL.MAJCOLIDHI = :majHi AND
            MAJORCOL.MAJCOLIDLO = :majLo AND
            MINORCOL.MINCOLIDHI = COLMEDIAVOL.MINCOLIDHI AND
            MINORCOL.MINCOLIDLO = COLMEDIAVOL.MINCOLIDLO AND
            MEDIAVOL.MEDVOLNR   = COLMEDIAVOL.MEDVOLNR AND
            MAJORCOL.MAJCOLIDHI = MINORCOL.MAJCOLIDHI AND
            MAJORCOL.MAJCOLIDLO = MINORCOL.MAJCOLIDLO

        ORDER BY MEDIAVOL.VOLSIZE;

    log_DBG_m(dbg_DETAIL,"will select all volumes for majCol:" << a_majColId);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MEDIAVOL_MAJCOLID;

    vector<rm_MediumVol> mvVec;
    bool endOfCursor = false;
    do {
        char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];
        EXEC SQL
            FETCH SELECT_MEDIAVOL_MAJCOLID
                INTO
                :mediumKey,
                :medVolNr,
                :medVolIdVal,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData;

            if (SQLCODE == SQL_NOERROR) {
                medVolId = medVolIdVal;
                initTime = initTime.m_iscTime;
                accessTime = accessTime.m_iscTime;
                writeTime = writeTime.m_iscTime;
                owriteTime = owriteTime.m_iscTime;
                lastVerification= lastVerification.m_iscTime;

                mvVec.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 MedVol error sqlcode: " << SQLCODE );
                throw ivd_Error (
                            ie_RMDB_ERROR,
                            "Fatal MediumVol select by majColID error sqlcode:"
                            + cmn_Num2Str((Int32_t)SQLCODE),
                            true);
            };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_MEDIAVOL_MAJCOLID;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_MEDIAVOL_MAJCOLID" );
    SQL_CHECKREAD_M( sqlErrDesc );
    return mvVec;
}

Here is the call graph for this function:

vector< rm_MediumVol > rm_MediumVol::SelectByMedium ( Int32_t  a_mediumKey  ) 

Definition at line 3512 of file librmdb.exx.

References accessNr, accessTime, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, initTime, ivd_Error, ivd_UUID_STR_SIZE_d, lastVerification, log_DBG_m, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::CheckMediumFull(), rm_Operator::GetMediaInfo(), rm_Operator::SelectAllMediumVolByMedium(), rm_Operator::VolumeFull(), and rm_Operator::VolumeListStatusSet().

                                                                    {
    log_FUNC_m(SelectByMedium);

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

    EXEC SQL
        DECLARE SELECT_MEDIAVOL_BY_MEDIA CURSOR FOR
        SELECT * FROM MEDIAVOL
            WHERE
            MEDIAKEY = :a_mediumKey
        ORDER BY MEDVOLNR;
    log_DBG_m(dbg_DETAIL,"will select all volumes for medium:" << a_mediumKey);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MEDIAVOL_BY_MEDIA;

    vector<rm_MediumVol> mvVec;
    bool endOfCursor = false;
    do {
        char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];
        EXEC SQL
            FETCH SELECT_MEDIAVOL_BY_MEDIA
                INTO
                :mediumKey,
                :medVolNr,
                :medVolIdVal,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData;
            log_DBG_m(dbg_DETAIL,"Selected one volume num:" << medVolNr << " SQLCODE " << SQLCODE);

            if (SQLCODE == SQL_NOERROR) {
                medVolId = medVolIdVal;
                initTime = initTime.m_iscTime;
                accessTime = accessTime.m_iscTime;
                writeTime = writeTime.m_iscTime;
                owriteTime = owriteTime.m_iscTime;
                lastVerification= lastVerification.m_iscTime;
                log_DBG_m(dbg_DETAIL,"found medvol for medium with key :" << a_mediumKey);
                mvVec.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 MedVol error sqlcode: " << SQLCODE);
                throw ivd_Error (
                            ie_RMDB_ERROR,
                            "Fatal MediumVol select by Medium error sqlcode:"
                            + cmn_Num2Str((Int32_t)SQLCODE),
                            true);
            };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_MEDIAVOL_BY_MEDIA;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIAVOL" );
    SQL_CHECKREAD_M( sqlErrDesc );
    return mvVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MediumVol::SelectByMedVolId ( rm_String a_medVolId  ) 

Definition at line 3467 of file librmdb.exx.

References accessNr, accessTime, rm_String::cvalue_p, errorDesc(), initTime, ivd_UUID_STR_SIZE_d, lastVerification, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::ClearRecoveryFlag(), rm_Operator::SelectMediumVol(), rm_Operator::SetRecoveryFlag(), rm_Operator::VolumeEmpty(), and rm_Operator::VolumeFull().

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

    char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :mediumKey,
            :medVolNr,
            :medVolIdVal,
            :status,
            :volType,
            :volUsed,
            :volSize,
            :accessNr,
            :writeNr,
            :owriteNr,
            :initTime.m_iscTime,
            :accessTime.m_iscTime,
            :writeTime.m_iscTime,
            :owriteTime.m_iscTime,
            :lastVerification.m_iscTime,
            :totalData,
            :validData
         FROM MEDIAVOL WHERE
            MEDVOLID = :a_medVolId.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        medVolId = medVolIdVal;
        initTime = initTime.m_iscTime;
        accessTime = accessTime.m_iscTime;
        writeTime = writeTime.m_iscTime;
        owriteTime = owriteTime.m_iscTime;
        lastVerification = lastVerification.m_iscTime;
    };
    string sqlErrDesc = errorDesc(SQLCODE,"Select MediumVol record with medVolId:" , medVolId);
    SQL_CHECKREAD_M( sqlErrDesc );

}

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 3596 of file librmdb.exx.

References accessNr, accessTime, cmn_Num2Str(), rm_String::cvalue_p, dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, initTime, ivd_Error, ivd_UUID_STR_SIZE_d, lastVerification, log_DBG_m, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::IsSomeVolumeUsed(), and rm_Operator::SelectAllMediumVolByPart().

                                                                        {
    log_FUNC_m(SelectByPartition);

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

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

    log_DBG_m(dbg_DETAIL,"will select all volumes for Partition:" << a_partName);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MEDIAVOL_BY_PARTITION;

    vector<rm_MediumVol> mvVec;
    bool endOfCursor = false;
    do {
        char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];
        EXEC SQL
            FETCH SELECT_MEDIAVOL_BY_PARTITION
                INTO
                :mediumKey,
                :medVolNr,
                :medVolIdVal,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData;



            if (SQLCODE == SQL_NOERROR) {
                medVolId = medVolIdVal;
                initTime = initTime.m_iscTime;
                accessTime = accessTime.m_iscTime;
                writeTime = writeTime.m_iscTime;
                owriteTime = owriteTime.m_iscTime;
                lastVerification= lastVerification.m_iscTime;
                log_DBG_m(dbg_DETAIL,"Selected volume [MedVolNr, MediumKey, PartName]: ["
                                 << medVolNr << "," << mediumKey << "," << a_partName );

                mvVec.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 MedVol error sqlcode: " << SQLCODE );
                throw ivd_Error (
                            ie_RMDB_ERROR,
                            "Fatal MediumVol select by Partition error sqlcode:"
                            + cmn_Num2Str((Int32_t)SQLCODE),
                            true);
            };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_MEDIAVOL_BY_PARTITION;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_ALL_MEDIAVOL_BY_PARTITION" );
    SQL_CHECKREAD_M( sqlErrDesc );
    return mvVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

vector< rm_MediumVol > rm_MediumVol::SelectEmptyCollocation ( UInt32_t  a_poolKey  ) 

Definition at line 3768 of file librmdb.exx.

References accessNr, accessTime, cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, initTime, ivd_Error, ivd_UUID_STR_SIZE_d, lastVerification, log_DBG_m, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECKREAD_M, SQL_NOERROR, SQL_NOTFOUND, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

                                                                           {
    log_FUNC_m(SelectEmptyCollocation);

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

    EXEC SQL
        DECLARE SELECT_MEDIAVOL_COLLOCATION CURSOR FOR
        SELECT MEDIAVOL.*
            FROM MEDIAVOL, MEDIA, MEDIAPOOL
        WHERE
            MEDIAVOL.MEDIAKEY = MEDIA.MEDIAKEY AND
            MEDIA.MEDIAPOOLKEY = MEDIAPOOL.MEDIAPOOLKEY AND
            MEDIAPOOL.MEDIAPOOLKEY = :a_poolKey
        ORDER BY MEDIAVOL.VOLSIZE;

    log_DBG_m(dbg_DETAIL,"will select all volumes for Ppool:" << a_poolKey);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MEDIAVOL_COLLOCATION;

    vector<rm_MediumVol> mvVec;
    bool endOfCursor = false;
    do {
        char medVolIdVal[ivd_UUID_STR_SIZE_d + 1];
        EXEC SQL
            FETCH SELECT_MEDIAVOL_COLLOCATION
                INTO
                :mediumKey,
                :medVolNr,
                :medVolIdVal,
                :status,
                :volType,
                :volUsed,
                :volSize,
                :accessNr,
                :writeNr,
                :owriteNr,
                :initTime.m_iscTime,
                :accessTime.m_iscTime,
                :writeTime.m_iscTime,
                :owriteTime.m_iscTime,
                :lastVerification.m_iscTime,
                :totalData,
                :validData;

            if (SQLCODE == SQL_NOERROR) {
                medVolId = medVolIdVal;
                initTime = initTime.m_iscTime;
                accessTime = accessTime.m_iscTime;
                writeTime = writeTime.m_iscTime;
                owriteTime = owriteTime.m_iscTime;
                lastVerification= lastVerification.m_iscTime;
                log_DBG_m(dbg_DETAIL,"Selected volume [MedVolNr, MediumKey, PoolKey]: ["
                                 << medVolNr << "," << mediumKey << "," << a_poolKey );

                mvVec.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 MedVol error sqlcode: " << SQLCODE );
                throw ivd_Error (
                            ie_RMDB_ERROR,
                            "Fatal MediumVol select by Poolkey error sqlcode:"
                            + cmn_Num2Str((Int32_t)SQLCODE),
                            true);
            };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_MEDIAVOL_COLLOCATION;
    string sqlErrDesc = errorDesc(SQLCODE, "CLOSE SELECT_MEDIAVOL_COLLOCATION" );
    SQL_CHECKREAD_M( sqlErrDesc );
    return mvVec;
}

Here is the call graph for this function:

void rm_MediumVol::StartSelectAll (  ) 

Definition at line 3688 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::SelectAllMediumVol().

                                 {
    log_FUNC_m(StartSelectAll);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_MEDIAVOL;

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

Definition at line 3383 of file librmdb.exx.

References accessNr, accessTime, rm_String::cvalue_p, errorDesc(), initTime, lastVerification, log_FUNC_m, rm_TimeStamp::m_iscTime, mediumKey, medVolId, medVolNr, NAME, owriteNr, owriteTime, SQL_CHECK_M, status, totalData, validData, volSize, volType, volUsed, writeNr, and writeTime.

Referenced by rm_Operator::ClearRecoveryFlag(), rm_Operator::ReleaseResources(), rm_Operator::SetRecoveryFlag(), rm_Operator::Update(), rm_Operator::VolumeEmpty(), and rm_Operator::VolumeFull().

                          {
    log_FUNC_m(Update);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        MEDIAVOL SET
            MEDVOLID =      :medVolId.cvalue_p,
            STATUS =        :status,
            VOLTYPE =       :volType,
            VOLUSED =       :volUsed,
            VOLSIZE =       :volSize,
            ACCESSNR =      :accessNr,
            WRITENR =       :writeNr,
            OWRITENR =      :owriteNr,
            INITTIME =      :initTime.m_iscTime,
            ACCESSTIME =    :accessTime.m_iscTime,
            WRITETIME =     :writeTime.m_iscTime,
            OWRITETIME =    :owriteTime.m_iscTime,
            LASTVERIFICATION = :lastVerification.m_iscTime,
            TOTALDATA =     :totalData,
            VALIDDATA =     :validData
        WHERE MEDIAKEY = :mediumKey AND MEDVOLNR = :medVolNr;

    string sqlErrDesc = errorDesc(SQLCODE,"Update MediumVol record");
    SQL_CHECK_M( sqlErrDesc );
}// rm_insert_MediumVol

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 548 of file rmdb.h.

friend class rm_Operator [friend]

Definition at line 547 of file rmdb.h.


Member Data Documentation

Definition at line 600 of file rmdb.h.


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