⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 occiobjects.h

📁 SQLAPI C/C++ 连接Oracle 数据库!
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (c) Oracle Corporation 2000, 2001. All Rights Reserved. */ /*    NAME      occiObjects.h - header file for OCCI object classes   DESCRIPTION      Class definitions for Ref, RefAny, AnyData   RELATED DOCUMENTS      <note any documents related to this facility>    EXPORT FUNCTION(S)      <external functions declared for use outside package - one-line descriptions>   INTERNAL FUNCTION(S)     <other external functions declared - one-line descriptions>   EXAMPLES   NOTES     <other useful comments, qualifications, etc.>   MODIFIED   (MM/DD/YY)   rvallam     04/30/01 - modified const methods in Ref (->, *, ptr)   rvallam     04/12/01 - passed dummy argument OCCIPOBJECT in getVector                          of AnyData for PObject *   rvallam     04/09/01 - fixed bug 1721365- call RefAny default constructor                          for a NULL Ref in operator RefAny   gayyappa    03/29/01 - remove methods for get/set int/float/double/unsigned                           int , wasLastAttrNull, setAttrNull , geSQLTypeName                          from AnyData                           as OTT does not use them.   gayyappa    03/15/01 - add OCCItype parameter to getVector for OCCIRef.   rratnam     03/15/01 - fixed set and getRef / get and setVector for NULL Refs,                          fixed NT compilation errors   rratnam     03/13/01 - changed AnyData constructor to take a freeImg flag,   rkasamse    03/15/01 - pass OCCI_SQLT_REF to getVector   chliang     03/05/01 - disable olint.   rvallam     03/01/01 - changed getSessionPtr() to getConnection()                          added const methods for dereferencing in Ref   gayyappa    02/23/01 - correct template code for setVector   gayyappa    12/13/00 - remove allocator from list member for PObject.                          bug#1529973                          nullify object pointer in clear method of Ref   rvallam     11/08/00 - make RefAny constructor public   gayyappa    08/21/00 - replace objPtr by objptr.                          move templated get/set vector code of anydata                           to header.   rkasamse    08/07/00 - make getVector friend of RefAny   rkasamse    07/11/00 - take void* instead of AnyDataCtx*   rkasamse    07/26/00 - make ResultSetImp friend of RefAny   rratnam     06/19/00 - added getConnection in PObject    rvallam     06/13/00 - added Ref<T> and occiRefImpl code   rvallam     06/05/00 - to add the Ref<T> code   kmohan      06/02/00 -   kmohan      05/31/00 - Datamember Connection * changed to ConnectionImpl * 			  in class RefAny   kmohan      04/11/00 - Ref, RefAny, AnyData class definitions                          added   rkasamse    04/03/00 - header (interface) files for OCCI Objects clases   rkasamse    04/03/00 - Creation*/#ifndef _olint   /* disable olint check */#ifndef OCCIOBJECTS_ORACLE# define OCCIOBJECTS_ORACLE#ifndef OCCICOMMON_ORACLE#include <occiCommon.h>#endifnamespace oracle {namespace occi {struct AnyDataCtx {   ConnectionImpl *occiSession;   OCIAnyData *anyData;   dvoid *objHeader;   ub4 errNum;};typedef struct AnyDataCtx AnyDataCtx;class PObject{  public:        enum LockOption {OCCI_LOCK_WAIT, OCCI_LOCK_NOWAIT};        enum UnpinOption {OCCI_PINCOUNT_DECR, OCCI_PINCOUNT_RESET};        static void destroy(void *);        PObject();        PObject(const void *ctx);        PObject(const PObject& obj);        virtual ~PObject();        PObject& operator=(const PObject& obj);        void *operator new(size_t size);        void *operator new(size_t size, const Connection *x,                const OCCI_STD_NAMESPACE::string& tablename, const char *typeName);        void operator delete(void *obj, size_t size);        RefAny getRef() const;        bool isLocked() const;        void unpin(UnpinOption mode=OCCI_PINCOUNT_DECR);        void pin();        void lock(PObject::LockOption lock_option);        void unmark();        void flush();        void markDelete();        void markModified();        bool isNull() const;        void setNull();        const Connection *getConnection() const;	virtual OCCI_STD_NAMESPACE::string getSQLTypeName() const = 0;	virtual void writeSQL(AnyData& stream) = 0;        virtual void readSQL(AnyData& stream) = 0;  private:        ConnectionImpl  *occiSession_;        dvoid *objHeader_;        ub2 customNewed_;        enum {CUSTOM_NEWED = 0x5cde};        ub2 flags_;        enum {NULL_INFO = 0x0001, GARBAGE_COLLECTED = 0x0002};        // for future use         void *pobjectExt;            friend class RefImpl;};class AnyData{    public:    AnyData(void *any) ;    AnyData(const Connection *sessp, OCIAnyData *any, bool freeImg = true) ;      AnyData(const AnyData &src);    AnyData& operator = (const AnyData &src);    OCIAnyData* getOCIAnyData() const;    const Connection* getConnection() const;    bool isNull() const ;    void setNull() ;    OCCI_STD_NAMESPACE::string getString() const ;    Blob getBlob() const ;    Clob getClob() const ;    Bfile getBfile() const ;    Number getNumber() const ;    Bytes getBytes() const ;    Date getDate() const ;    Timestamp getTimestamp() const ;    PObject *getObject() const ;    RefAny getRef() const ;    void setString(const OCCI_STD_NAMESPACE::string &str)  ;    void setBlob(const Blob &blob) ;    void setClob(const Clob &clob) ;    void setBfile(const Bfile &bfile) ;    void setNumber(const Number &n) ;    void setBytes(const Bytes &bytes) ;    void setDate(const Date &date) ;    void setTimestamp(const Timestamp &timestamp)  ;    void setObject(const PObject *objptr) ;    void setRef(const RefAny &ref) ;        private:                                     // private data members    Ptr<AnyDataImpl> anyDataImplPtr;                 };template <class T>class Ref{  public:  Ref();  Ref(const T *obj) ;  Ref(const RefAny &refAny) ;  Ref(const Ref<T> &src) ;  Ref(const Connection *sessp, OCIRef *tref, bool copy=TRUE)   ; ~Ref();  bool isNull() const ;  Ref<T>& operator=(const Ref<T> &src)   ;  Ref<T>& operator=(const T *obj) ;  T * operator->() ;  T * ptr() ;  T & operator *() ;  const T * operator->() const;  const T * ptr()  const;  const T & operator *() const ;  void markDelete() ;  void unmarkDelete() ;  void clear() ;  void setPrefetch(const OCCI_STD_NAMESPACE::string &typeName, unsigned int depth);  void setPrefetch(unsigned int depth) ;  void setLock(LockOptions );  operator RefAny() const;  OCIRef *getRef() const;  const Connection *getConnection() const;  bool operator == (const Ref<T> &ref) const;  bool operator != (const Ref<T> &ref) const;  bool operator == (const RefAny &refAnyR) const ;  bool operator != (const RefAny &refAnyR) const ; private:  T *objptr;  RefImpl  *rimplPtr;};class RefImpl{  public:  RefImpl();  RefImpl(PObject *obj) ;  RefImpl(const RefAny &refAny) ;  RefImpl(const RefImpl &src) ;  RefImpl(const Connection *sessp, OCIRef *tref,   bool copy=TRUE) ;  ~RefImpl();  bool isNull() const ;  void markDelete() ;  void unmarkDelete() ;  void clear() ;  void setPrefetch(const OCCI_STD_NAMESPACE::string &typeName, unsigned int depth) ;  void setPrefetch(unsigned int depth) ;  void setLock(LockOptions lckOption) ;  PObject *pin() ;  void unpin(PObject *obj) ;  void setRefFromObjPtr(const PObject *obj) ;  OCIRef* getRef() const;  void setRefImpl(RefImpl *rptr);  const Connection * getConnection() const;  bool operator == (const RefImpl &refI) const ;  bool operator == (const RefAny &refAnyR) const ;  PObject *assignRef(PObject *objPtr,                         PObject *srcObjPtr,                         RefImpl *implPtr) ;  PObject *assignObj(PObject *oldObjPtr,                         PObject *newObjPtr) ; private:  OCIRef *ref;  const ConnectionImpl *sessp;  OCIComplexObject *corhp;  OCCI_STD_NAMESPACE::list<void *> descriptorList;  LockOptions lockOption;};class RefAny{  public:  RefAny();  RefAny (const Connection *sessptr, const OCIRef *Ref);  ~RefAny() ;  RefAny(const RefAny& src) ;  RefAny& operator=(const RefAny& src) ;  void markDelete() ;  void unmarkDelete() ;  void clear() ;  bool isNull() const;  OCIRef * getRef() const;  const Connection * getConnection() const;  bool operator == (const RefAny &refAnyR) const;  bool operator != (const RefAny &refAnyR) const;  private:  OCIRef *ref;  const ConnectionImpl *sessp;  // for future use  void *refanyExt;  friend RefAny MetaData::getRef(MetaData::AttrId) const;  friend RefAny PObject::getRef() const;  friend class AnyDataImpl;  friend class ResultSetImpl;  friend class StatementImpl;  friend void getVector(const ResultSet  *rs,                        unsigned int colIndex,                        OCCI_STD_NAMESPACE::vector<RefAny> &vect) ;  friend void getVector(const Statement  *stmt,                        unsigned int colIndex,                        OCCI_STD_NAMESPACE::vector<RefAny> &vect) ;};/*---------------------------------------------------------------------------                           EXPORT FUNCTIONS  ---------------------------------------------------------------------------*//*---------------------------------------------------------------------------                          INTERNAL FUNCTIONS  ---------------------------------------------------------------------------*/template <class T>Ref<T>::Ref(){   objptr = (T*)0;   rimplPtr = new RefImpl();}template <class T> Ref<T>::Ref(const T *obj) {    objptr = (T *)obj;    rimplPtr = new RefImpl((PObject *)objptr);} template <class T> Ref<T>::Ref(const RefAny &refAny) {  objptr = (T *)0;  rimplPtr = new RefImpl(refAny);}template <class T> Ref<T>::Ref(const Ref<T>& src) {    rimplPtr = new RefImpl(*(src.rimplPtr));    objptr = (src.objptr != NULL) ? (T *)(rimplPtr->pin()) :                                    (T *)0;}  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -