Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | Private Attributes

OCIPL::OciContext Struct Reference

#include <ocipl.h>

Inheritance diagram for OCIPL::OciContext:
Inheritance graph
[legend]
Collaboration diagram for OCIPL::OciContext:
Collaboration graph
[legend]

List of all members.

Public Types

typedef OciHandleWrapper
< OCISvcCtx > 
super
typedef OCISvcCtx HandleType

Public Member Functions

 OciContext (OciEnv &env, OCISvcCtx *ctx)
void commit (ub4 flags=OCI_DEFAULT)
void rollback (ub4 flags=OCI_DEFAULT)
void set_state (OCI_STATE state)
void set_state (OCI_STATE state, int stmt_type)
void reset_state ()
bool maybe_active_transaction () const
 operator HandleType * ()

Static Public Member Functions

static ub4 get_type_id ()
static ub4 get_attr_id ()

Public Attributes

OCI_STATE _state
int _stmt_type
int _trans_cnt

Protected Attributes

HandleType_handle

Private Attributes

OciEnv_env

Detailed Description

Definition at line 885 of file ocipl.h.


Member Typedef Documentation

typedef OCISvcCtx OCIPL::OciHandleWrapper< OCISvcCtx >::HandleType [inherited]

Definition at line 487 of file ocipl.h.

Definition at line 887 of file ocipl.h.


Constructor & Destructor Documentation

OCIPL::OciContext::OciContext ( OciEnv env,
OCISvcCtx *  ctx 
) [inline]

Definition at line 889 of file ocipl.h.

     :  super(ctx),
        _state(OS_NONE),
        _stmt_type(0),
        _trans_cnt(0),
        _env(env)
    {
    }

Member Function Documentation

void OCIPL::OciContext::commit ( ub4  flags = OCI_DEFAULT )

Definition at line 372 of file ocipl.cpp.

References _env, OCIPL::OciEnv::_errh, OCIPL::OciHandleWrapper< OCISvcCtx >::_handle, _trans_cnt, OCIPL::oci_check_error(), and OCIPL::OS_TRANSACTION.

{
    LocalOciState state(*this, OS_TRANSACTION);

    sword res = OCITransCommit(_handle, _env._errh, flags);
    oci_check_error(_env, res);

    _trans_cnt = 0;
}

Here is the call graph for this function:

static ub4 OCIPL::OciHandleID< OCISvcCtx >::get_attr_id (  ) [static, inherited]
static ub4 OCIPL::OciHandleID< OCISvcCtx >::get_type_id (  ) [static, inherited]
bool OCIPL::OciContext::maybe_active_transaction (  ) const [inline]

Definition at line 928 of file ocipl.h.

    {
        return _trans_cnt > 0;
    }
OCIPL::OciHandleWrapper< OCISvcCtx >::operator HandleType * (  ) [inline, inherited]

Definition at line 496 of file ocipl.h.

    {
        return _handle;
    }
void OCIPL::OciContext::reset_state (  ) [inline]

Definition at line 922 of file ocipl.h.

References OCIPL::OS_NONE.

    {
        _state = OS_NONE;
        _stmt_type = 0;
    }
void OCIPL::OciContext::rollback ( ub4  flags = OCI_DEFAULT )

Definition at line 383 of file ocipl.cpp.

References _env, OCIPL::OciEnv::_errh, OCIPL::OciHandleWrapper< OCISvcCtx >::_handle, _trans_cnt, OCIPL::oci_check_error(), and OCIPL::OS_TRANSACTION.

{
    LocalOciState state(*this, OS_TRANSACTION);

    sword res = OCITransRollback(_handle, _env._errh, flags);
    oci_check_error(_env, res);

    _trans_cnt = 0;
}

Here is the call graph for this function:

void OCIPL::OciContext::set_state ( OCI_STATE  state ) [inline]

Definition at line 904 of file ocipl.h.

    {
        //assert(_state==OS_NONE);  // problematisch bei gleichzeitigem Zugriff auf die Datenbankverbindung aus mehreren Threads
        _state = state;
    }
void OCIPL::OciContext::set_state ( OCI_STATE  state,
int  stmt_type 
) [inline]

Definition at line 910 of file ocipl.h.

References OCIPL::OS_EXECUTE.

    {
        //assert(_state==OS_NONE);  // problematisch bei gleichzeitigem Zugriff auf die Datenbankverbindung aus mehreren Threads
        _state = state;
        _stmt_type = stmt_type;

        if (state == OS_EXECUTE)
            if ((stmt_type>=OCI_STMT_UPDATE && stmt_type<=OCI_STMT_INSERT) ||
                stmt_type==OCI_STMT_BEGIN || stmt_type==OCI_STMT_DECLARE)
                ++_trans_cnt;
    }

Member Data Documentation

Definition at line 938 of file ocipl.h.

Referenced by commit(), and rollback().

HandleType* OCIPL::OciHandleWrapper< OCISvcCtx >::_handle [protected, inherited]

Definition at line 502 of file ocipl.h.

Referenced by commit(), and rollback().

Definition at line 933 of file ocipl.h.

Definition at line 934 of file ocipl.h.

Definition at line 935 of file ocipl.h.

Referenced by commit(), and rollback().


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