Public Attributes | Private Member Functions | Private Attributes | Friends

rm_DiskSubsys Class Reference
[Resource Manager Database Library]

#include <rmdb.h>

Collaboration diagram for rm_DiskSubsys:
Collaboration graph
[legend]

List of all members.

Public Attributes

Int32_t diskSubsysKey
rm_String diskSubsysName
rm_String host
Int32_t diskSubsysType
Int32_t status

Private Member Functions

void Insert ()
void Update ()
void Remove (Int32_t a_diskSubsysKey)
void Select (Int32_t a_diskSubsysKey)
void SelectByName (rm_String a_name)
void StartSelectAll ()
void EndSelectAll ()
rm_DiskSubsysNext ()
 rm_DiskSubsys ()
 rm_DiskSubsys (Int32_t a_diskSubsysKey)
bool operator== (const rm_DiskSubsys &dss2) const

Private Attributes

 log_CLASSID_m

Friends

class rm_Operator

Detailed Description

Definition at line 338 of file rmdb.h.


Constructor & Destructor Documentation

rm_DiskSubsys::rm_DiskSubsys (  )  [private]

Definition at line 1954 of file librmdb.exx.

rm_DiskSubsys::rm_DiskSubsys ( Int32_t  a_diskSubsysKey  )  [private]

Definition at line 1959 of file librmdb.exx.

References Select().

Here is the call graph for this function:


Member Function Documentation

void rm_DiskSubsys::EndSelectAll (  )  [private]

Definition at line 2134 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_DSS;

    g_dssCursor_x.Unlock();

    string sqlErrDesc = errorDesc(SQLCODE,"CLOSE SELECT_ALL_DSS");
    SQL_CHECKREAD_M(sqlErrDesc);
}

Here is the call graph for this function:

void rm_DiskSubsys::Insert (  )  [private]

Definition at line 1966 of file librmdb.exx.

References rm_String::cvalue_p, dbg_NORM, diskSubsysKey, diskSubsysName, diskSubsysType, errorDesc(), host, log_DBG_m, log_FUNC_m, MAX, NAME, SQL_CHECK_M, SQL_NOERROR, SQL_UNIQUEVIOLATION, and status.

Referenced by rm_Operator::Add().

                           {

    log_FUNC_m(Insert);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    Int32_t k(0);
    if (diskSubsysKey == 0) {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            MAX(DISKSUBSYSKEY) INTO :k FROM DISKSUBSYS;

        diskSubsysKey = k + 1;
        log_DBG_m(dbg_NORM,"new key");
    }
    else {
        EXEC SQL
            SELECT TRANSACTION readWriteTrans
            DISKSUBSYSKEY INTO :k FROM DISKSUBSYS
            WHERE DISKSUBSYSKEY = :diskSubsysKey;

        if (SQLCODE == SQL_NOERROR) {
            log_DBG_m(dbg_NORM,"key exists");
            throw ivd_DBException( SQL_UNIQUEVIOLATION ,"DiskSubsys Key already exists");
        }
    }

    EXEC SQL
        INSERT TRANSACTION readWriteTrans
        INTO DiskSubsys VALUES(
                              :diskSubsysKey,
                              :diskSubsysName.cvalue_p,
                              :host.cvalue_p,
                              :diskSubsysType,
                              :status
                             );
    string sqlErrDesc = errorDesc(SQLCODE,"Insert record into DSS",diskSubsysKey);
    SQL_CHECK_M( sqlErrDesc );

}//  rm_DiskSubsys::Insert()

Here is the call graph for this function:

Here is the caller graph for this function:

rm_DiskSubsys & rm_DiskSubsys::Next (  )  [private]

Definition at line 2146 of file librmdb.exx.

References diskSubsysKey, diskSubsysName, diskSubsysType, errorDesc(), host, log_FUNC_m, SQL_CHECKREAD_M, SQL_NOERROR, status, and cmn_Mutex::Unlock().

                                   {
    log_FUNC_m(Next);

    char diskSubsysNameVal[rmdb_MAX_DSSNAME];
    char hostVal[rmdb_MAX_HOSTNAME];
    EXEC SQL
        FETCH SELECT_ALL_DSS
            INTO
                :diskSubsysKey,
                :diskSubsysNameVal,
                :hostVal,
                :diskSubsysType,
                :status;

    if (SQLCODE == SQL_NOERROR) {
        diskSubsysName = diskSubsysNameVal;
        host = hostVal;
    }
    else {
        int fetchCode = SQLCODE;
        EXEC SQL
            CLOSE SELECT_ALL_DSS;
        g_dssCursor_x.Unlock();
        SQLCODE = fetchCode;
        string sqlErrDesc = errorDesc(fetchCode,"CLOSE SELECT_ALL_DSS");
        SQL_CHECKREAD_M(sqlErrDesc);

    };
    return *this;
}

Here is the call graph for this function:

bool rm_DiskSubsys::operator== ( const rm_DiskSubsys dss2  )  const [inline, private]

Definition at line 363 of file rmdb.h.

References diskSubsysKey, diskSubsysName, diskSubsysType, and host.

                                                     {
        return (    ( diskSubsysKey == dss2.diskSubsysKey)      &&
                    ( diskSubsysType == dss2.diskSubsysType)    &&
                    ( host == dss2.host)                        &&
                    ( diskSubsysName == dss2.diskSubsysName)    );
    };

void rm_DiskSubsys::Remove ( Int32_t  a_diskSubsysKey  )  [private]

Definition at line 2010 of file librmdb.exx.

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

Referenced by rm_Operator::RemoveDSS().

                                                  {
    log_FUNC_m(Remove);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        DELETE TRANSACTION readWriteTrans
        FROM DISKSUBSYS
        WHERE DISKSUBSYSKEY = :a_diskSubsysKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Remove DSS record",a_diskSubsysKey);
    SQL_CHECK_M( sqlErrDesc );
}//  rm_DiskSubsys::Remove

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_DiskSubsys::Select ( Int32_t  a_diskSubsysKey  )  [private]

Definition at line 2050 of file librmdb.exx.

References diskSubsysKey, diskSubsysName, diskSubsysType, errorDesc(), host, log_FUNC_m, NAME, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_DiskSubsys().

                                                  {
    log_FUNC_m(Select);

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

    char diskSubsysNameVal[rmdb_MAX_DSSNAME];
    char hostVal[rmdb_MAX_HOSTNAME];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :diskSubsysKey,
            :diskSubsysNameVal,
            :hostVal,
            :diskSubsysType,
            :status
        FROM DISKSUBSYS WHERE DISKSUBSYSKEY = :a_diskSubsysKey;

    if (SQLCODE == SQL_NOERROR) {
        diskSubsysName = diskSubsysNameVal;
        host = hostVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE,"Select DSS record", diskSubsysKey);
    SQL_CHECKREAD_M( sqlErrDesc );

}//  rm_DiskSubsys::Select

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2083 of file librmdb.exx.

References rm_String::cvalue_p, diskSubsysKey, diskSubsysName, diskSubsysType, errorDesc(), host, log_FUNC_m, NAME, SQL_CHECKREAD_M, SQL_NOERROR, and status.

Referenced by rm_Operator::Add(), rm_Operator::RemoveDSS(), and rm_Operator::Update().

                                                 {
    log_FUNC_m(SelectByName);

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

    char diskSubsysNameVal[rmdb_MAX_DSSNAME];
    char hostVal[rmdb_MAX_HOSTNAME];

    EXEC SQL
        SELECT TRANSACTION readTrans
        * INTO
            :diskSubsysKey,
            :diskSubsysNameVal,
            :hostVal,
            :diskSubsysType,
            :status
        FROM DISKSUBSYS
        WHERE DISKSUBSYSNAME = :a_name.cvalue_p;

    if (SQLCODE == SQL_NOERROR) {
        diskSubsysName = diskSubsysNameVal;
        host = hostVal;
    };

    string sqlErrDesc = errorDesc(SQLCODE, "Selecting DiskSubsys record by Name");
    SQL_CHECKREAD_M( sqlErrDesc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

void rm_DiskSubsys::StartSelectAll (  )  [private]

Definition at line 2115 of file librmdb.exx.

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

                                  {
    log_FUNC_m(StartSelectAll);

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

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

Here is the call graph for this function:

void rm_DiskSubsys::Update (  )  [private]

Definition at line 2028 of file librmdb.exx.

References rm_String::cvalue_p, diskSubsysKey, diskSubsysName, diskSubsysType, errorDesc(), host, log_FUNC_m, NAME, SQL_CHECK_M, and status.

Referenced by rm_Operator::Update().

                           {
    log_FUNC_m(Update);

    EXEC SQL
        SET TRANSACTION NAME readWriteTrans;

    EXEC SQL
        UPDATE TRANSACTION readWriteTrans
        DISKSUBSYS SET
                DISKSUBSYSNAME = :diskSubsysName.cvalue_p,
                HOST =           :host.cvalue_p,
                DISKSUBSYSTYPE = :diskSubsysType,
                STATUS =         :status
        WHERE DISKSUBSYSKEY = :diskSubsysKey;

    string sqlErrDesc = errorDesc(SQLCODE,"Update DSS record", diskSubsysKey);
    SQL_CHECK_M( sqlErrDesc );
}//  rm_DiskSubsys::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 340 of file rmdb.h.


Member Data Documentation

Definition at line 368 of file rmdb.h.


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