Public Attributes | Private Member Functions | Private Attributes | Friends

rm_MinorCol Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

List of all members.

Public Attributes

 log_CLASSID_m

Private Member Functions

 rm_MinorCol ()
 rm_MinorCol (UInt64_t a_minColId)
void Insert ()
void Update ()
void Remove (UInt64_t a_minColId)
void Select (UInt64_t a_minColId)
vector< rm_MinorColSelectAll ()
vector< rm_MinorColSelectByMajCol (UInt64_t a_majColId)
void StartSelectAll ()
void EndSelectAll ()
rm_MinorColNext ()

Private Attributes

UInt64_t m_minColId
UInt64_t m_majColId
UInt32_t m_flags

Friends

class rm_Operator

Detailed Description

Definition at line 925 of file rmdb.h.


Constructor & Destructor Documentation

rm_MinorCol::rm_MinorCol (  )  [inline, private]

Definition at line 946 of file rmdb.h.

{};

rm_MinorCol::rm_MinorCol ( UInt64_t  a_minColId  )  [private]

Definition at line 5895 of file librmdb.exx.

References Select().

                                            {
    Select(a_minColId);
}

Here is the call graph for this function:


Member Function Documentation

void rm_MinorCol::EndSelectAll (  )  [private]

Definition at line 6175 of file librmdb.exx.

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

                              {
    log_FUNC_A_m(EndSelectAll, "MinorCollocation");

    EXEC SQL
        CLOSE SELECT_ALL_MINORCOL;

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

}// rm_MinorCol:: EndSelectAll

Here is the call graph for this function:

void rm_MinorCol::Insert (  )  [private]

Definition at line 5900 of file librmdb.exx.

References dbg_DETAIL, errorDesc(), log_DBG_m, log_FUNC_A_m, m_flags, m_majColId, m_minColId, NAME, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECK_M.

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

                         {
    log_FUNC_A_m(Insert, "MinorCollocation");

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);
    Int32_t majHi = RMDB_COL_ID_HI(m_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(m_majColId);

    log_DBG_m(dbg_DETAIL,"EXECUTING: " << endl
                        << "INSERT TRANSACTION readWriteTrans INTO MINORCOL VALUES("
                        << minHi << ", "
                        << minLo << ", "
                        << majHi << ", "
                        << majLo << ", "
                        << m_flags << "); ");
    EXEC SQL
        SET TRANSACTION NAME readWriteTrans

    EXEC SQL
        INSERT TRANSACTION readWriteTrans INTO
            MINORCOL VALUES(
                    :minHi,
                    :minLo,
                    :majHi,
                    :majLo,
                    :m_flags
                 );

    string sqlErrDesc = errorDesc(SQLCODE, "Insert record into MINORCOL", m_minColId);
    SQL_CHECK_M( sqlErrDesc );
}// rm_MinorCol::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_MinorCol & rm_MinorCol::Next (  )  [private]

Definition at line 6188 of file librmdb.exx.

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

Referenced by rm_Operator::SelectAllMinorCol().

                               {
    log_FUNC_A_m(Next, "MinorCollocation");

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);
    Int32_t majHi = RMDB_COL_ID_HI(m_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(m_majColId);

    EXEC SQL
        FETCH SELECT_ALL_MINORCOL
                    INTO
                        :minHi,
                        :minLo,
                        :majHi,
                        :majLo,
                        :m_flags;
    if (SQLCODE == SQL_NOERROR) {
        m_minColId = RMDB_COL_ID(minHi, minLo);
        m_majColId = RMDB_COL_ID(majHi, majLo);
    }
    else {
        int fetchCode = SQLCODE;
    EXEC SQL
        CLOSE SELECT_ALL_MINORCOL;
        g_minorColCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode, "reached end of SELECT_ALL_MINORCOL cursor");
        SQL_CHECKREAD_M(sqlErrDesc);
    };
    return *this;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MinorCol::Remove ( UInt64_t  a_minColId  )  [private]

Definition at line 5934 of file librmdb.exx.

References dbg_NORM, errorDesc(), log_DBG_m, log_FUNC_A_m, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECK_M.

Referenced by rm_Operator::RemoveMinorCol().

                                            {
    log_FUNC_A_m(Remove, "MinorCollocation");

    log_DBG_m(dbg_NORM, "MinColId accept: " << a_minColId);
    Int32_t minHi = RMDB_COL_ID_HI(a_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(a_minColId);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM MINORCOL WHERE minColIdHi = :minHi AND minColIdLo = :minLo;

    m_minColId = RMDB_COL_ID(minHi, minLo);
    log_DBG_m(dbg_NORM, "MinColId removed!:  " << m_minColId);
    string sqlErrDesc = errorDesc(SQLCODE,"Remove MinorCol record", m_minColId);
    SQL_CHECK_M( sqlErrDesc );

}// rm_MinorCol::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MinorCol::Select ( UInt64_t  a_minColId  )  [private]

Definition at line 5980 of file librmdb.exx.

References dbg_NORM, errorDesc(), log_DBG_m, log_FUNC_A_m, m_flags, m_majColId, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECKREAD_M.

Referenced by rm_Operator::GetMediaInfo(), rm_MinorCol(), rm_Operator::SelectMinorCol(), rm_Operator::Update(), and rm_Operator::UpdateCollocation().

                                            {
    log_FUNC_A_m(Select, "MinorCollocation");

    Int32_t minHi = RMDB_COL_ID_HI(a_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(a_minColId);
    Int32_t majHi = RMDB_COL_ID_HI(m_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(m_majColId);

    log_DBG_m(dbg_NORM, "MinColId:  " << a_minColId);

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

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
                :minHi,
                :minLo,
                :majHi,
                :majLo,
                :m_flags
        FROM MINORCOL WHERE minColIdHi = :minHi AND minColIdLo = :minLo;

    m_minColId = RMDB_COL_ID(minHi, minLo);
    m_majColId = RMDB_COL_ID(majHi, majLo);
    string sqlErrDesc = errorDesc(SQLCODE,"Select MinorCol record from MinorCol", a_minColId);
    SQL_CHECKREAD_M( sqlErrDesc );

}// rm_MinorCol::Select

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 6085 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_flags, m_majColId, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, SQL_CHECKREAD_M, SQL_NOERROR, and SQL_NOTFOUND.

                                           {
    log_FUNC_A_m(SelectAll, "MinorCollocation");

    cmn_MutexLock l(g_minorColCursor_x);

    Int32_t minHi = RMDB_COL_ID_HI(m_minColId);
    Int32_t minLo = RMDB_COL_ID_LO(m_minColId);
    Int32_t majHi = RMDB_COL_ID_HI(m_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(m_majColId);
    vector<rm_MinorCol> minorColVec;

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_ALL_MINORCOL;

    if ( SQLCODE != SQL_NOERROR ) {
        throw ivd_Error(ie_RMDB_ERROR," Could not open cursor SELECT_ALL_MINORCOL");
    }
    log_DBG_m(dbg_DETAIL, "open cursor SELECT_ALL_MINORCOL returned sqlcode:" << SQLCODE);

    bool endOfCursor = false;

    do {
        EXEC SQL
            FETCH SELECT_ALL_MINORCOL
                        INTO
                            :minHi,
                            :minLo,
                            :majHi,
                            :majLo,
                            :m_flags;

        if (SQLCODE == SQL_NOERROR) {
            m_minColId = RMDB_COL_ID(minHi, minLo);
            m_majColId = RMDB_COL_ID(majHi, majLo);
            log_DBG_m(dbg_DETAIL, "SELECT_ALL_MINORCOL: " << m_minColId << ","
                                                          << m_majColId << ","
                                                          << m_flags );
            //add new element into vector
            minorColVec.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 minorcol Allocation error sqlcode:" << SQLCODE);
           throw ivd_Error (
               ie_NO_RESOURCE_FOUND,
               "Fatal SELECT_ALL_MINORCOL Allocation error sqlcode:" + cmn_Num2Str((Int32_t)SQLCODE),
               true);
       };
    } while (endOfCursor == false);

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

    return minorColVec;
}

Here is the call graph for this function:

vector< rm_MinorCol > rm_MinorCol::SelectByMajCol ( UInt64_t  a_majColId  )  [private]

Definition at line 6013 of file librmdb.exx.

References cmn_Num2Str(), dbg_DETAIL, dbg_LOW, dbg_NORM, errorDesc(), ie_RMDB_ERROR, ivd_Error, log_DBG_m, log_FUNC_m, m_flags, m_majColId, 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::SelectAllMinColByMajCol().

                                                                   {
    log_FUNC_m(SelectByMajCol);

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

    Int32_t minHi(0);
    Int32_t minLo(0);
    Int32_t majHi = RMDB_COL_ID_HI(a_majColId);
    Int32_t majLo = RMDB_COL_ID_LO(a_majColId);

    EXEC SQL
        DECLARE SELECT_MINORCOL_BY_MAJCOLID CURSOR FOR
        SELECT * FROM MINORCOL
            WHERE
            majColIdHi = :majHi AND
            majColIdLo = :majLo
        ORDER BY minColIdLo ASC;

    log_DBG_m(dbg_DETAIL,"will select all minColId for majColId :" << a_majColId);

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

    EXEC SQL
        OPEN TRANSACTION readTrans
        SELECT_MINORCOL_BY_MAJCOLID;

    vector<rm_MinorCol> mVec;
    bool endOfCursor = false;
    do {
    EXEC SQL
        FETCH SELECT_MINORCOL_BY_MAJCOLID
        INTO
            :minHi,
            :minLo,
            :majHi,
            :majLo,
            :m_flags;

        if (SQLCODE == SQL_NOERROR) {
            m_minColId = RMDB_COL_ID(minHi, minLo);
            m_majColId = RMDB_COL_ID(majHi, majLo);
            mVec.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 MinCol error sqlcode: " << SQLCODE);
            throw ivd_Error (
                ie_RMDB_ERROR,
                "Fatal MinorCol select by majColId error sqlcode:"
                + cmn_Num2Str((Int32_t)SQLCODE),
                true);
        };
    } while (endOfCursor == false);

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

    return mVec;
} //SelectByMajCol(UInt64_t a_majColId)

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MinorCol::StartSelectAll (  )  [private]

Definition at line 6154 of file librmdb.exx.

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

Referenced by rm_Operator::SelectAllMinorCol().

                                 {
    log_FUNC_A_m(StartSelectAll, "MinorCollocation");

    g_minorColCursor_x.Lock();

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

    EXEC SQL
        OPEN TRANSACTION readTrans SELECT_ALL_MINORCOL;

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

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_MinorCol::Update (  )  [private]

Definition at line 5956 of file librmdb.exx.

References dbg_LOW, errorDesc(), log_DBG_m, log_FUNC_A_m, m_flags, m_minColId, NAME, RMDB_COL_ID, RMDB_COL_ID_HI, RMDB_COL_ID_LO, and SQL_CHECK_M.

Referenced by rm_Operator::Update().

                         {
    log_FUNC_A_m(Update, "MinorCollocation");

    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
        UPDATE TRANSACTION readWriteTrans
        MINORCOL SET
                    flags = :m_flags
        WHERE minColIdHi = :minHi AND minColIdLo = :minLo;

    m_minColId = RMDB_COL_ID(minHi, minLo);
    log_DBG_m(dbg_LOW,"Updating OK: " << m_minColId << "," << m_flags);
    string sqlErrDesc = errorDesc(SQLCODE,"Error while updating MinorCol record: ", m_minColId);
    SQL_CHECK_M( sqlErrDesc );

}// rm_MinorCol::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_Operator [friend]

Definition at line 927 of file rmdb.h.


Member Data Documentation

Definition at line 928 of file rmdb.h.


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