Public Attributes | Private Member Functions | Private Attributes | Friends

rm_ColMediaVol Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

List of all members.

Public Attributes

 log_CLASSID_m

Private Member Functions

 rm_ColMediaVol ()
 rm_ColMediaVol (i_ColMediaVol_t &a_colMediaVol)
void Select (UInt64_t a_minColId, UInt32_t a_mediaKey, UInt32_t a_medVolNr)
void Insert ()
void Remove ()
void StartSelectAll ()
void EndSelectAll ()
vector< rm_ColMediaVolSelectByVolume (Int32_t a_mediumKey, Int32_t a_medVolNr)
rm_ColMediaVolNext ()
vector< rm_ColMediaVolSelectAll ()

Private Attributes

UInt64_t m_minColId
Int32_t m_mediaKey
Int32_t m_medVolNr

Friends

class rm_Operator

Detailed Description

Definition at line 964 of file rmdb.h.


Constructor & Destructor Documentation

rm_ColMediaVol::rm_ColMediaVol (  )  [inline, private]

Definition at line 983 of file rmdb.h.

{};

rm_ColMediaVol::rm_ColMediaVol ( i_ColMediaVol_t a_colMediaVol  )  [inline, private]

Definition at line 984 of file rmdb.h.

References i_ColMediaVol_t::mediaKey, i_ColMediaVol_t::medVolNr, and i_ColMediaVol_t::minColId.

                                                   {
        m_minColId = a_colMediaVol.minColId;
        m_mediaKey = a_colMediaVol.mediaKey;
        m_medVolNr = a_colMediaVol.medVolNr;
    };


Member Function Documentation

void rm_ColMediaVol::EndSelectAll (  )  [private]

Definition at line 6458 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_MINORCOL;

    g_colMediavolCursor_x.Unlock();
    string sqlErrDesc = errorDesc(SQLCODE,"EXEC SQL CLOSE SELECT_ALL_COLMEDIAVOL");
    SQL_CHECKREAD_M(sqlErrDesc);

}// rm_ColMediaVol:: EndSelectAll

Here is the call graph for this function:

void rm_ColMediaVol::Insert (  )  [private]

Definition at line 6261 of file librmdb.exx.

References errorDesc(), log_FUNC_A_m, m_mediaKey, m_medVolNr, m_minColId, NAME, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECK_M.

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

                            {
    log_FUNC_A_m(Insert, "ColMediaVol");

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO COLMEDIAVOL VALUES(
                   :minHi,
                   :minLo,
                   :m_mediaKey,
                   :m_medVolNr
         );
    string sqlErrDesc = errorDesc(SQLCODE, "Insert record into ColMediaVol", m_minColId);
    SQL_CHECK_M( sqlErrDesc );

}// rm_ColMediaVol::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_ColMediaVol & rm_ColMediaVol::Next (  )  [private]

Definition at line 6471 of file librmdb.exx.

References errorDesc(), log_FUNC_A_m, m_mediaKey, m_medVolNr, m_minColId, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, and cmn_Mutex::Unlock().

                                     {
    log_FUNC_A_m(Next, "ColMediaVol");

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);

    EXEC SQL
        FETCH SELECT_ALL_COLMEDIAVOL
                    INTO
                        :minHi,
                        :minLo,
                        :m_mediaKey,
                        :m_medVolNr

    if (SQLCODE == SQL_NOERROR) {
        m_minColId = RMDB_COL_ID(minHi, minLo);
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_COLMEDIAVOL
        g_colMediavolCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "reached end of SELECT_ALL_COLMEDIAVOL cursor");
        SQL_CHECKREAD_M(sqlErrDesc);
    };

    return *this;
}//rm_ColMediaVol::Next

Here is the call graph for this function:

void rm_ColMediaVol::Remove (  )  [private]

Definition at line 6285 of file librmdb.exx.

References errorDesc(), log_FUNC_A_m, m_mediaKey, m_medVolNr, m_minColId, NAME, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECK_M.

                            {
    log_FUNC_A_m(Remove, "ColMediaVol");

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM COLMEDIAVOL WHERE (minColIdHi = :minHi AND minColIdLo = :minLo) AND
                               (mediaKey = : m_mediaKey AND medVolNr = :m_medVolNr);

    string sqlErrDesc = errorDesc(SQLCODE,"ColMediaVol record removed.");
    SQL_CHECK_M( sqlErrDesc );

}// rm_ColMediaVol::Remove

Here is the call graph for this function:

void rm_ColMediaVol::Select ( UInt64_t  a_minColId,
UInt32_t  a_mediaKey,
UInt32_t  a_medVolNr 
) [private]

Definition at line 6226 of file librmdb.exx.

References errorDesc(), log_FUNC_m, m_mediaKey, m_medVolNr, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECKREAD_M.

Referenced by rm_Operator::CheckAndAdd().

                                                                                         {
    log_FUNC_m(Select);

    Int32_t minHi = RMDB_COL_ID_HI(a_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(a_minColId);

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


    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :minHi,
            :minLo,
            :m_mediaKey,
            :m_medVolNr
        FROM
            COLMEDIAVOL
        WHERE
            MINCOLIDHI = :minHi AND
            MINCOLIDLO = :minLo AND
            MEDIAKEY = :a_mediaKey AND
            MEDVOLNR = :a_medVolNr;

    m_minColId = RMDB_COL_ID(minHi, minLo);
    string sqlErrDesc = errorDesc(SQLCODE, "Select colMediaVol record");
    SQL_CHECKREAD_M( sqlErrDesc );

}// rm_ColMediaVol::Select()

Here is the call graph for this function:

Here is the caller graph for this function:

vector< rm_ColMediaVol > rm_ColMediaVol::SelectAll (  )  [private]

Definition at line 6305 of file librmdb.exx.

References cmn_Num2Str(), dbg_DETAIL, dbg_NORM, errorDesc(), ie_NO_RESOURCE_FOUND, ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_A_m, m_mediaKey, m_medVolNr, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, and SQL_NOTFOUND.

Referenced by rm_Operator::AllocateMigCollocation(), and rm_Operator::SelectAllColVolumes().

                                                 {
    log_FUNC_A_m(SelectAll, "ColMediaVol");

    cmn_MutexLock l(g_colMediavolCursor_x);

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);
    vector<rm_ColMediaVol> colMediaVolVec;

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_COLMEDIAVOL;

    if ( SQLCODE != SQL_NOERROR ) {
        throw ivd_Error(ie_RMDB_ERROR," Could not open cursor SELECT_ALL_COLMEDIAVOL");
    }


    bool endOfCursor = false;

    do {
        EXEC SQL
            FETCH SELECT_ALL_COLMEDIAVOL
                        INTO
                            :minHi,
                            :minLo,
                            :m_mediaKey,
                            :m_medVolNr;
        if (SQLCODE == SQL_NOERROR) {
            m_minColId = RMDB_COL_ID(minHi, minLo);
            log_DBG_m(dbg_DETAIL, "SELECT_ALL_COLMEDIAVOLL: " << m_minColId << ","
                                                             << m_mediaKey << ","
                                                             << m_medVolNr );
            //add new element into vector
            colMediaVolVec.push_back(*this);
       }
        else if (SQLCODE == SQL_NOTFOUND) {
            log_DBG_m(dbg_NORM,"reached end of cursor");
            endOfCursor = true;
        }
        else {
            log_DBG_m(dbg_NORM,"Fatal ColMediaVol Allocation error sqlcode:" << SQLCODE);
            throw ivd_Error (
                ie_NO_RESOURCE_FOUND,
                "Fatal ColMediaVol Allocation error sqlcode:" + cmn_Num2Str((Int32_t)SQLCODE),
                true);
        };

    } while (endOfCursor == false);
    EXEC SQL
        CLOSE SELECT_ALL_COLMEDIAVOL;
    string sqlErrDesc = errorDesc(SQLCODE,"CLOSE SELECT_ALL_COLMEDIAVOL");
    SQL_CHECKREAD_M(sqlErrDesc);

    return colMediaVolVec;
}

Here is the call graph for this function:

Here is the caller graph for this function:

vector< rm_ColMediaVol > rm_ColMediaVol::SelectByVolume ( Int32_t  a_mediumKey,
Int32_t  a_medVolNr 
) [private]

Definition at line 6369 of file librmdb.exx.

References cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_A_m, m_mediaKey, m_medVolNr, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, and SQL_NOTFOUND.

Referenced by rm_Operator::GetMediaInfo(), rm_Operator::RemoveColMediaVol(), and rm_Operator::RemoveMediumVol().

                                                                                             {
    log_FUNC_A_m(SelectByVolume, "ColMediaVol");

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

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);

    EXEC SQL
        DECLARE SELECT_COLMEDIAVOL_BY_VOLUME CURSOR FOR
        SELECT * FROM COLMEDIAVOL
            WHERE
            MEDIAKEY = :a_mediumKey AND
            MEDVOLNR = :a_medVolNr;

    log_DBG_m(dbg_DETAIL,"will select all collocations and volumes for medium:" << a_mediumKey);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_COLMEDIAVOL_BY_VOLUME;

    vector<rm_ColMediaVol> cmvVec;
    bool endOfCursor = false;
    do {
    EXEC SQL
        FETCH SELECT_COLMEDIAVOL_BY_VOLUME
        INTO
            :minHi,
            :minLo,
            :m_mediaKey,
            :m_medVolNr;

        if (SQLCODE == SQL_NOERROR) {
            m_minColId = RMDB_COL_ID(minHi, minLo);
            cmvVec.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 ColMediaVol select by Medium error sqlcode:"
                + cmn_Num2Str((Int32_t)SQLCODE),
                true);
        };

    } while (endOfCursor == false);

    EXEC SQL
        CLOSE SELECT_COLMEDIAVOL_BY_VOLUME;
    string sqlErrDesc = errorDesc(SQLCODE, "SELECT_COLMEDIAVOL_BY_VOLUME" );
    SQL_CHECKREAD_M( sqlErrDesc );

    return cmvVec;
}// rm_ColMediaVol::SelectByVolume

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_ColMediaVol::StartSelectAll (  )  [private]

Definition at line 6437 of file librmdb.exx.

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

                                    {
    log_FUNC_A_m(StartSelectAll, "ColMediaVol");

    g_colMediavolCursor_x.Lock();

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

    EXEC SQL
        OPEN TRANSACTION readTrans SELECT_ALL_COLMEDIAVOL;

    if ( SQLCODE != SQL_NOERROR) {
        string sqlErrDesc = errorDesc(SQLCODE, "Opening SELECT_ALL_COLMEDIAVOL Cursor failed");
        log_ERR_m(sqlErrDesc);
        g_colMediavolCursor_x.Unlock();
        throw ivd_DBException( SQLCODE ,sqlErrDesc, true);
    }
}// rm_ColMediaVol::StartSelectAll

Here is the call graph for this function:


Friends And Related Function Documentation

friend class rm_Operator [friend]

Definition at line 966 of file rmdb.h.


Member Data Documentation

Definition at line 967 of file rmdb.h.


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