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

📄 occidata.h

📁 oci函数批量插入数据
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (c) 2000, 2002, Oracle Corporation.  All rights reserved.  */
   
/* 
   NAME 
     occiData.h - header file for OCCI data classes

   DESCRIPTION 
     Class definitions for Stream, Blob, Clob ,Bfile,
     Number, Date, IntervalYM, IntervalDS, Time,
     Timestamp

   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)
   vvinay      02/21/02 - operator= added for Bytes
   gayyappa    10/23/01 - fix bug 2073327 , use string instead of enum CharSet  
   vvinay      12/21/01 - signed char constructor and cast operator
                          (bug 2073334)
                          binary operator methods not friends any more
   gayyappa    15/10/01 - add parameter toCopy to Lob/Timestamp private 
                          constructors 
   rvallam     04/09/01 - change private constructor in Number to pass
                          parameter by reference and made it const
   chliang     03/05/01 - disable olint
   rvallam     01/27/02 - remove #include <ostream>
   gayyappa    01/17/01 - add methods/operators to Interval and
                          timestamp classes..
   gayyappa    12/15/00 - interface changes in set methods
   rvallam     11/29/00 - change method signature in Bytes
                          added 3 new methods in Number  
   rvallam     10/20/00  - change method signatures in Date
   rvallam     09/15/00 - make StmtImpl/ResultSetImpl friend to 
                          interval classes 
   gayyappa    08/21/00 - modified timestamp, interval headers.
                          add OCIEnv to constructor of Bytes.,
                          removed getOCIRaw from Bytes.
                          add const to setVector mthds of anydata.
                          add dvoid* data member to Timestamp/Interval.
   rvallam     08/10/00 - modified CORE class headers to add friends , 
                          added private constructor in Bytes
   slari       08/02/00 - comment out Stream
   rratnam     08/04/00 - updated the LOB stream interface
   rkasamse    08/07/00 - make getVector friend of Time
   slari       07/31/00 - add const to Bytes methods
   slari       07/25/00 - disable Bytes(Bytes *)
   slari       07/23/00 - add Bytes
   gayyappa    07/26/00 - update Timestamp, IntervalYM, IntervalDS.
   gayyappa    07/04/00 - for fixing a problem in occiNumber
   rratnam     06/13/00 - Updated LOB class headers
   kmohan      05/31/00 - Change Environment to Environment * in 
			  Date constructor
   kmohan      05/29/00 - No string
   rkasamse    04/25/00 - Added string class header
   etucker     04/19/00 - Added CORE class headers
   kmohan      04/11/00 - Creation

*/

#ifndef _olint   /* disable olint check */

#ifndef OCCIDATA_ORACLE
# define OCCIDATA_ORACLE

#ifndef OCCICOMMON_ORACLE
#include <occiCommon.h>
#endif

#ifndef OCCICONTROL_ORACLE
#include <occiControl.h>
#endif

namespace oracle {
namespace occi {
class Bytes
{
 
 public:
 
  Bytes(const Environment *env = NULL);      // default constructor
 
  Bytes(unsigned char *value, unsigned int count, 
            unsigned int offset = 0, const Environment *env = NULL); 

  Bytes(const Bytes &e); // copy constructor

 
                    // public methods
 
  void getBytes(unsigned char *dst, unsigned int count, 
                        unsigned int srcBegin = 0,
                        unsigned int dstBegin = 0) const; 
 
  unsigned int length() const;
 
  unsigned char byteAt(unsigned int index) const;

  bool isNull() const;
 
  void setNull();

  void operator=(const Bytes &other);
 
  ~Bytes();

private:
                                // private data members
  Bytes(OCIEnv *,OCIRaw *) ;
  Ptr<BytesImpl> ptr_;
  friend class AnyDataImpl;
  friend  void getVector(const AnyData &any, OCCI_STD_NAMESPACE::vector<Bytes> &vect) ;
  friend  void setVector(AnyData &any, 
  const OCCI_STD_NAMESPACE::vector<Bytes> &vect) ;

};
 
class Bfile
{
  public :

    Bfile();
    Bfile(const Connection *connectionp) ;
    Bfile(const Bfile &srcBfile) ;
    ~Bfile();
    unsigned int length() const ;
    OCCI_STD_NAMESPACE::string getDirAlias() const ;
    OCCI_STD_NAMESPACE::string getFileName() const ;
    void setName(const OCCI_STD_NAMESPACE::string &dirAlias, const OCCI_STD_NAMESPACE::string &fileName) ;
    bool fileExists() const ; 
    Bfile& operator =(const Bfile &srcBfile) ;
    bool operator ==(const Bfile &srcBfile) const ;
    bool operator !=(const Bfile &srcBfile) const ;
    void setNull() ;
    bool isNull() const ;
    bool isInitialized() const;
    void open() ;
    void close() ;
    bool isOpen() const ;
    unsigned int read(unsigned int  amt, unsigned char *buffer,
      unsigned int  bufsize, unsigned int offset = 1) const ;
    Stream* getStream(unsigned int offset = 1,
      unsigned int amount =0)  ;
    void closeStream(Stream *stream);

  private:

    //Data Members:

    // pointer to the FILE locator
    OCIBFileLocator *filep; 

    // pointer to the ConnectionImpl instance
    const ConnectionImpl *connp; 

    // pointer to the LobStreamImpl instance obtained from this FILE
    LobStreamImpl *streamp;

    void *bfileExt;

    //Enumerations:
    enum {MAXDIRNAMELEN = 32, MAXFILENAMELEN = 256};

    //Constructor: 
    Bfile(const Connection *connectionp, 
    OCIBFileLocator *locatorp, bool toCopy = true) ;
  
    //Methods:
    OCIBFileLocator* getLocator() const;
 
  // Friends
  friend class AnyDataImpl;
  friend class StatementImpl;
  friend class ResultSetImpl;
  friend class Blob;
  friend class Clob;

  friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Bfile>&) ;
  friend void getVector(Statement*, unsigned int, 
  OCCI_STD_NAMESPACE::vector<Bfile>&) ;
  friend void getVector(ResultSet*, unsigned int , 
  OCCI_STD_NAMESPACE::vector<Bfile>&) ;
  friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Bfile>&) ;
  friend void setVector(Statement*, unsigned int, 
  const OCCI_STD_NAMESPACE::vector<Bfile>&, const OCCI_STD_NAMESPACE::string&) ;
};

class Blob
{
  public:

    Blob();
    Blob(const Connection *connectionp) ;
    Blob(const Blob &srcBlob) ;
    ~Blob();
    unsigned int getChunkSize() const ;
    unsigned int length() const ;
    Blob& operator =(const Blob &srcBlob) ;
    bool operator ==(const Blob &srcBlob) const ;
    bool operator !=(const Blob &srcBlob) const ;
    void setNull() ;
    bool isNull() const ;
    void setEmpty() ;
    void setEmpty(const Connection *connectionp) ;
    bool isInitialized() const;
    void open(LobOpenMode mode=OCCI_LOB_READWRITE) ;
    void close() ;
    bool isOpen() const ;
    void copy(const Blob &srcBlob, unsigned int numBytes,
      unsigned int  dstOffset =1, unsigned int srcOffset =1) ;
    void copy(const Bfile &srcBfile, unsigned int numBytes,
      unsigned int  dstOffset =1, unsigned int srcOffset =1) ;
    void append(const Blob &srcBlob) ;
    unsigned int read(unsigned int  amt, unsigned char *buffer,
      unsigned int  bufsize, unsigned int offset = 1) const ;
    unsigned int write(unsigned int amt, unsigned char *buffer,
      unsigned int bufsize, unsigned int offset = 1) ;
    unsigned int writeChunk(unsigned int amt, unsigned char *buffer,
      unsigned int bufsize, unsigned int offset = 1) ;
    void trim(unsigned int newlen) ;
    Stream* getStream(unsigned int offset = 1,
      unsigned int amount =0)  ;
    void closeStream(Stream *stream);

  private:

    //Data Members:

    // pointer to the BLOB locator
    OCIBlobLocator *lobp; 

    // pointer to the ConnectionImpl instance
    const ConnectionImpl *connp; 

    // pointer to the LobStreamImpl instance obtained from this LOB
    LobStreamImpl *streamp; 

    //for future use !
    void *blobExt;

    //Constructor: 
    Blob(const Connection *connectionp, 
    OCIBlobLocator *locatorp, bool toCopy=true) ;

    //Methods:
    OCIBlobLocator* getLocator() const;

  // Friends
  friend class AnyDataImpl;
  friend class StatementImpl;
  friend class ResultSetImpl;

  friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Blob>&) ;
  friend void getVector(Statement*, unsigned int, 
  OCCI_STD_NAMESPACE::vector<Blob>&) ;
  friend void getVector(ResultSet*, unsigned int, 
  OCCI_STD_NAMESPACE::vector<Blob>&) ;
  friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Blob>&) ;
  friend void setVector(Statement*, unsigned int, 
  const OCCI_STD_NAMESPACE::vector<Blob>&, const OCCI_STD_NAMESPACE::string&) ;
};

class Clob
{
  public:

    Clob();
    Clob(const Connection *connectionp) ;
    Clob(const Clob &srcClob) ;
    ~Clob();
    unsigned int getChunkSize() const ;
    unsigned int length() const ;
    OCCI_STD_NAMESPACE::string getCharSetId() const;
    CharSetForm getCharSetForm() const;
    void setCharSetId( const OCCI_STD_NAMESPACE::string &charset) ;
    void setCharSetForm( CharSetForm csfrm) ;
    Clob& operator =(const Clob &srcClob) ;
    bool operator ==(const Clob &srcClob) const ;
    bool operator !=(const Clob &srcClob) const ;
    void setNull() ;
    bool isNull() const ;
    void setEmpty() ;
    void setEmpty(const Connection *connectionp) ;
    bool isInitialized() const;
    void open(LobOpenMode mode=OCCI_LOB_READWRITE) ;
    void close() ;
    bool isOpen() const ;
    void copy(const Clob &srcClob, unsigned int numBytes,
      unsigned int  dstOffset = 1, unsigned int srcOffset = 1) ;
    void copy(const Bfile &srcBfile, unsigned int numBytes,
      unsigned int  dstOffset = 1, unsigned int srcOffset = 1) ;
    void append(const Clob &srcClob) ;
    unsigned int read(unsigned int  amt, unsigned char *buffer,
      unsigned int  bufsize,  unsigned int offset = 1) const;
    unsigned int write(unsigned int amt, unsigned char *buffer,
      unsigned int bufsize,  unsigned int offset = 1 );
    unsigned int writeChunk(unsigned int amt, unsigned char *buffer,
      unsigned int bufsize, unsigned int offset = 1 );
    void trim(unsigned int newlen) ;
    Stream* getStream(unsigned int offset = 1,
      unsigned int amount =0 );
    void closeStream(Stream *stream);

  private:

    //Data Members:

    // pointer to the CLOB locator
    OCIClobLocator *lobp; 

    // pointer to the ConnectionImpl instance
    const ConnectionImpl *connp; 

    // pointer to the LobStreamImpl instance obtained from this LOB
    LobStreamImpl *streamp; 

    //charset id
    ub2 charsetId;

    //charset form
    CharSetForm charsetForm;

    //for future use !
    void *clobExt;

    //Constructor: 
    Clob(const Connection *connectionp, 
    OCIClobLocator *locatorp, bool toCopy =true ) ;

    //Methods:
    OCIClobLocator* getLocator() const;

  // Friends
  friend class AnyDataImpl;
  friend class StatementImpl;
  friend class ResultSetImpl;

  friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Clob>&) ;
  friend void getVector(Statement*, unsigned int, 
  OCCI_STD_NAMESPACE::vector<Clob>&) ;
  friend void getVector(ResultSet*, unsigned int, 
  OCCI_STD_NAMESPACE::vector<Clob>&) ;
  friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Clob>&) ;
  friend void setVector(Statement*, unsigned int, 
  const OCCI_STD_NAMESPACE::vector<Clob>&, const OCCI_STD_NAMESPACE::string&) ;
};

class Number
{
 
 public:

 // Constructors
  /* default constructor added  */
  Number();
  Number(const Number &srcNum);
  Number(long double val) ;
  Number(double val) ;
  Number(float val) ;
  Number(long val) ;
  Number(int val) ;
  Number(short val) ;
  Number(char val) ;
  Number(signed char val);
  Number(unsigned long val) ;
  Number(unsigned int val) ;
  Number(unsigned short val) ;
  Number(unsigned char val) ;

  ~Number();
  // Methods
  const Number abs() const ;
  // unary negate
  const Number operator-() ;
  // unary increment
  Number& operator++() ;
  const Number operator++(int) ;
  // unary decrement
  Number& operator--() ;
  const Number operator--(int) ;
  // assigment operator
  Number& operator=(const Number &a);
  // add and assign
  Number& operator+=(const Number &a) ;
  // subtract and assign
  Number& operator-=(const Number &a) ;
  // Mulitply an assign
  Number& operator*=(const Number &a) ;

⌨️ 快捷键说明

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