home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
Software
/
TemaCD
/
tcvpa
/
data1.cab
/
MyFileGroup
/
INCLUDE
/
TxServ.hpp
< prev
next >
Wrap
C/C++ Source or Header
|
1999-06-03
|
6KB
|
130 lines
#ifndef _INC_TXSERV_HPP
#define _INC_TXSERV_HPP
enum TCPsTxStatus {
TxStat_Active,
TxStat_Committing,
TxStat_Committed,
TxStat_RollingBack,
TxStat_RolledBack,
};
#define TC_PS_TX_EXCLUSIVE 0x00000001
#define TC_PS_TX_LOG 0x00000002
enum TCPsTxTerm {
TxTerm_Destroy,
TxTerm_LetItBe,
TxTerm_Restart,
};
#define TC_PSWorkCxt tcPsGetWorkContext()
class PsInstMgr;
class TC_CPsTxContext;
class TC_CPsTxRsc;
// **********************************************************************
class TC_PS_EXPORT TC_CPsTxRsc
{
friend class TC_CPsTxContext;
private: TC_CPsDataService * m_DataService ;
private: TC_CPsTxContext * m_TxCxt ;
private: PsInstMgr * m_InstMgr ;
private: long m_hConnect ;
private: TC_CPsTxRsc (TC_CPsTxContext * tx_cxt, TC_CPsDataService * ds, long hConnect) ;
private: PsDrvBind * DrvBind ()
{
return m_DataService->GetDataDriver()->GetDrvBind();
} // end of func
// **********************************************************************
public: static long m_TransientGen ;
public: ~TC_CPsTxRsc () ;
public: TCPsRetCode Commit () ;
public: TCPsRetCode Rollback () ;
public: void Reset () ;
public: TCPsRetCode CreateObject (TC_CPsObject ** obj, TC_CPsInstID &inst_id) TC_PS_THROW_FUNC ;
public: TCPsRetCode CreateObject (TC_CPsRef & objRef, TC_CPsInstID &inst_id) TC_PS_THROW_FUNC ;
public: TCPsRetCode RestoreObject (TC_CPsObject **obj, TC_CPsInstID &inst_id, TCPsDepthMode depth) TC_PS_THROW_FUNC ;
public: TCPsRetCode RestoreObject (TC_CPsRef & objRef, TC_CPsInstID &inst_id, TCPsDepthMode depth) TC_PS_THROW_FUNC ;
public: TCPsRetCode ReleaseObject (TC_CPsObject * obj) TC_PS_THROW_FUNC ;
public: TCPsRetCode RestoreAssoc (TC_CPsObject *obj, const char * attr_name, TCPsDepthMode depth) TC_PS_THROW_FUNC ;
public: TCPsRetCode ReleaseAssoc (TC_CPsObject *obj, const char * attr_name) ;
public: TCPsRetCode AssociateObject (TC_CPsObject * owner, TC_CPsObject * assoc_obj, const char * attr_name) ;
public: TCPsRetCode DisassociateObject (TC_CPsObject * owner, TC_CPsObject * assoc_obj, const char * attr_name) ;
public: TCPsRetCode StoreObject (TC_CPsObject *obj, TCPsDepthMode depth) ;
public: TCPsRetCode StoreAssoc (TC_CPsObject *obj, const char * attr_name, TCPsDepthMode depth) ;
public: TCPsRetCode RemoveObject (TC_CPsObject *obj) ;
public: TCPsRetCode RemoveAssoc (TC_CPsObject *obj, const char * attr_name) ;
public: TC_CPsObject * GetObject (TC_CPsInstID &inst_id) ;
public: TCPsRetCode FetchObject (TC_CPsObject **obj, TCPsHClass hClass) ;
public: TCPsRetCode FetchIntoResult (TC_CPsAtomicResult * result, BOOL * stop) ;
public: TCPsRetCode BeginQuery (TC_CPsQuery * query) ;
public: BOOL LockObject (TC_CPsObject * obj, TCPsLockMode lock_mode, long timeout = -1) ;
public: BOOL UnlockObject (TC_CPsObject * obj) ;
private: TCPsRetCode _ReleaseObj (TC_CPsObject * obj) ;
private: TC_CPsObject * _CreateObj (TC_CPsInstID &inst_id, BOOL registration=TRUE) ;
private: TCPsRetCode _RestoreExistedObj (TC_CPsObject * obj, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _RestoreNewObj (TC_CPsObject **ppobj, TC_CPsInstID &inst_id, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _RestoreDescImplements (TC_CPsObject * obj, TCPsHClass hSetClass) ;
private: TCPsRetCode _RestoreRelations (TC_CPsObject * obj, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _RestoreRelObject (TC_CPsObject * obj, TC_CPsAttribInfo atInfo, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _RestoreRelCollect (TC_CPsObject * obj, TC_CPsAttribInfo atInfo, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: void _ClearFailedCltn (TC_CPsAttribInfo atInfo, TC_CPsCollection * cltnAdapter, void * cltn) ;
private: TCPsRetCode _StoreObj (TC_CPsObject * obj, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _StoreRelations (TC_CPsObject * obj, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _StoreRelCollect (TC_CPsObject * obj, TC_CPsAttribInfo atInfo, TCPsDepthMode depth, PsObjGraph * objGraph) ;
private: TCPsRetCode _StoreObjGraph (PsObjGraph * objGraph) ;
private: TCPsRetCode _DrvStoreObj (TC_CPsObject * obj, int store_opt) ;
private: TCPsRetCode _RemoveObj (TC_CPsObject *obj) ;
private: TCPsRetCode _DrvRemoveObj (TC_CPsInstID * inst_id) ;
public: void Trace (char * title="OBJECT INSTANCES") ;
}; // end of class TC_CPsTxRsc
// **********************************************************************
// **********************************************************************
class TC_PS_EXPORT TC_CPsTxContext
{
friend class TC_CPsWorkContext;
private: static TC_TKeyList <TC_CPsTxContext> m_Chain ;
private: TC_TKeyNode <TC_CPsTxContext> m_Node ;
private: static long m_TxCounter ;
private: TCPsTxStatus m_Status ;
private: long m_Flags ;
private: long m_ThrID ;
private: TC_CPsTxRsc * m_TxRsc ;
private: TC_CPsTxContext (TC_CPsDataService * ds, long hConnect, long tx_flag) ;
private: ~TC_CPsTxContext () ;
public: long GetTxID () ;
public: long GetTxFlags () ;
public: TCPsTxStatus GetTxStatus () ;
public: TC_CPsTxRsc * GetTxRsc () ;
public: BOOL IsSuspended () ;
public: TCPsRetCode Commit () ;
public: TCPsRetCode Rollback () ;
public: void Restart () ;
public: static int GetTxCount () ;
}; // end of class TC_CPsTxContext
// **********************************************************************
// **********************************************************************
class TC_PS_EXPORT TC_CPsWorkContext
{
private: static TC_CLock m_Lock ;
public: TC_CPsWorkContext () ;
public: TC_CPsTxContext * Begin (const char * ds_name, long tx_flag) ;
public: TC_CPsTxContext * Current () ;
public: TC_CPsTxContext * Suspend () ;
public: TCPsRetCode Resume (TC_CPsTxContext * tx_cxt) ;
public: TCPsRetCode Commit (TCPsTxTerm tx_term) ;
public: TCPsRetCode Rollback (TCPsTxTerm tx_term) ;
public: TCPsRetCode Destroy (TC_CPsTxContext * tx_cxt=0) ;
public: TCPsRetCode Restart (TC_CPsTxContext * tx_cxt) ;
}; // end of class TC_CPsWorkContext
// **********************************************************************
TC_PS_EXPORT TC_CPsWorkContext * tcPsGetWorkContext () ;
#endif // _INC_TXSERV_HPP