| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/drivers/Oracle/OCI/include/occiData.h
Go to the documentation of this file.

    00001 /* Copyright (c) 2000, 2003, Oracle Corporation.  All rights reserved.  */
    00002
    00003 /*
    00004    NAME
    00005      occiData.h - header file for OCCI data classes
    00006
    00007    DESCRIPTION
    00008      Class definitions for Stream, Blob, Clob ,Bfile,
    00009      Number, Date, IntervalYM, IntervalDS, Time,
    00010      Timestamp
    00011
    00012    RELATED DOCUMENTS
    00013      <note any documents related to this facility>
    00014
    00015    EXPORT FUNCTION(S)
    00016    <external functions declared for use outside package - one-line descriptions>
    00017
    00018    INTERNAL FUNCTION(S)
    00019      <other external functions declared - one-line descriptions>
    00020
    00021    EXAMPLES
    00022
    00023    NOTES
    00024      <other useful comments, qualifications, etc.>
    00025
    00026    MODIFIED   (MM/DD/YY)
    00027    shiyer      10/31/03 - Timestamp constructors issue
    00028    rvallam     10/07/03 - bug 3089939 - add private method in Date to compute
    00029                           hour and min component in daysBetween to be passed
    00030                           to set method of IntervalDS.
    00031    cparampa    08/21/03 - added toCopy to IntervalDS and IntervalYM
    00032    cparampa    07/14/03 - make SubscriptionImpl friend of Bytes class.
    00033    rvallam     02/12/03 - modified BFloat/BDouble interface - BFloat/BDouble
    00034                           type is now a struct
    00035    cparampa    01/20/03 - made ProducerImpl friend of Bytes class
    00036    rvallam     11/19/02 - objects support for interval class
    00037    shiyer      11/15/02 - Add UTF16 support to IntervalYM & IntervalDS
    00038    cparampa    12/11/02 - removed references to class Payload
    00039    cparampa    10/12/02 - AQ additions
    00040    shiyer      10/12/02 - Added UTF16 version of get/set CharsetId in Clob
    00041    shiyer      09/06/02 - OCCI globalization support
    00042    aahluwal    06/04/02 - bug 2360115
    00043    vvinay      02/21/02 - operator= added for Bytes
    00044    gayyappa    10/23/01 - fix bug 2073327 , use string instead of enum CharSet
    00045    vvinay      12/21/01 - signed char constructor and cast operator
    00046                           (bug 2073334)
    00047                           binary operator methods not friends any more
    00048    gayyappa    15/10/01 - add parameter toCopy to Lob/Timestamp private
    00049                           constructors
    00050    rvallam     04/09/01 - change private constructor in Number to pass
    00051                           parameter by reference and made it const
    00052    chliang     03/05/01 - disable olint
    00053    rvallam     01/27/02 - remove #include <ostream>
    00054    gayyappa    01/17/01 - add methods/operators to Interval and
    00055                           timestamp classes..
    00056    gayyappa    12/15/00 - interface changes in set methods
    00057    rvallam     11/29/00 - change method signature in Bytes
    00058                           added 3 new methods in Number
    00059    rvallam     10/20/00  - change method signatures in Date
    00060    rvallam     09/15/00 - make StmtImpl/ResultSetImpl friend to
    00061                           interval classes
    00062    gayyappa    08/21/00 - modified timestamp, interval headers.
    00063                           add OCIEnv to constructor of Bytes.,
    00064                           removed getOCIRaw from Bytes.
    00065                           add const to setVector mthds of anydata.
    00066                           add dvoid* data member to Timestamp/Interval.
    00067    rvallam     08/10/00 - modified CORE class headers to add friends ,
    00068                           added private constructor in Bytes
    00069    slari       08/02/00 - comment out Stream
    00070    rratnam     08/04/00 - updated the LOB stream interface
    00071    rkasamse    08/07/00 - make getVector friend of Time
    00072    slari       07/31/00 - add const to Bytes methods
    00073    slari       07/25/00 - disable Bytes(Bytes *)
    00074    slari       07/23/00 - add Bytes
    00075    gayyappa    07/26/00 - update Timestamp, IntervalYM, IntervalDS.
    00076    gayyappa    07/04/00 - for fixing a problem in occiNumber
    00077    rratnam     06/13/00 - Updated LOB class headers
    00078    kmohan      05/31/00 - Change Environment to Environment * in
    00079                                    Date constructor
    00080    kmohan      05/29/00 - No string
    00081    rkasamse    04/25/00 - Added string class header
    00082    etucker     04/19/00 - Added CORE class headers
    00083    kmohan      04/11/00 - Creation
    00084
    00085 */
    00086
    00087 #ifndef _olint   /* disable olint check */
    00088
    00089 #ifndef OCCIDATA_ORACLE
    00090 # define OCCIDATA_ORACLE
    00091
    00092 #ifndef OCCICOMMON_ORACLE
    00093 #include <occiCommon.h>
    00094 #endif
    00095
    00096 #ifndef OCCICONTROL_ORACLE
    00097 #include <occiControl.h>
    00098 #endif
    00099
    00100 namespace oracle {
    00101 namespace occi {
    00102 class Bytes
    00103 {
    00104
    00105  public:
    00106
    00107   Bytes(const Environment *env = NULL);      // default constructor
    00108
    00109   Bytes(unsigned char *value, unsigned int count,
    00110             unsigned int offset = 0, const Environment *env = NULL);
    00111
    00112   Bytes(const Bytes &e); // copy constructor
    00113
    00114
    00115                     // public methods
    00116
    00117   void getBytes(unsigned char *dst, unsigned int count,
    00118                         unsigned int srcBegin = 0,
    00119                         unsigned int dstBegin = 0) const;
    00120
    00121   unsigned int length() const;
    00122
    00123   unsigned char byteAt(unsigned int index) const;
    00124
    00125   bool isNull() const;
    00126
    00127   void setNull();
    00128
    00129   void operator=(const Bytes &other);
    00130
    00131   ~Bytes();
    00132
    00133 private:
    00134                                 // private data members
    00135   Bytes(OCIEnv *,OCIRaw *) ;
    00136   Bytes(Ptr<BytesImpl> bytesPtr) ;
    00137   Ptr<BytesImpl> ptr_;
    00138   friend class AnyDataImpl;
    00139   friend class aq::MessageImpl;
    00140   friend class aq::ProducerImpl;
    00141   friend class aq::SubscriptionImpl;
    00142   friend  void getVector(const AnyData &any,
    00143                          OCCI_STD_NAMESPACE::vector<Bytes> &vect) ;
    00144   friend  void setVector(AnyData &any,
    00145   const OCCI_STD_NAMESPACE::vector<Bytes> &vect) ;
    00146
    00147 };
    00148
    00149 class Bfile
    00150 {
    00151   public :
    00152
    00153     Bfile();
    00154     Bfile(const Connection *connectionp) ;
    00155     Bfile(const Bfile &srcBfile) ;
    00156     ~Bfile();
    00157     unsigned int length() const ;
    00158     OCCI_STD_NAMESPACE::string getDirAlias() const ;
    00159     UString getUStringDirAlias() const ;
    00160     OCCI_STD_NAMESPACE::string getFileName() const ;
    00161     UString getUStringFileName() const ;
    00162     void setName(const OCCI_STD_NAMESPACE::string &dirAlias,
    00163                  const OCCI_STD_NAMESPACE::string &fileName) ;
    00164     void setName(const UString &dirAlias, const UString &fileName) ;
    00165     bool fileExists() const ;
    00166     Bfile& operator =(const Bfile &srcBfile) ;
    00167     bool operator ==(const Bfile &srcBfile) const ;
    00168     bool operator !=(const Bfile &srcBfile) const ;
    00169     void setNull() ;
    00170     bool isNull() const ;
    00171     bool isInitialized() const;
    00172     void open() ;
    00173     void close() ;
    00174     bool isOpen() const ;
    00175     unsigned int read(unsigned int  amt, unsigned char *buffer,
    00176       unsigned int  bufsize, unsigned int offset = 1) const ;
    00177     Stream* getStream(unsigned int offset = 1,
    00178       unsigned int amount =0)  ;
    00179     void closeStream(Stream *stream);
    00180
    00181   private:
    00182
    00183     //Data Members:
    00184
    00185     // pointer to the FILE locator
    00186     OCIBFileLocator *filep;
    00187
    00188     // pointer to the ConnectionImpl instance
    00189     const ConnectionImpl *connp;
    00190
    00191     // pointer to the LobStreamImpl instance obtained from this FILE
    00192     LobStreamImpl *streamp;
    00193
    00194     void *bfileExt;
    00195
    00196     //Enumerations:
    00197     enum {MAXDIRNAMELEN = 32, MAXFILENAMELEN = 256};
    00198
    00199     //Constructor:
    00200     Bfile(const Connection *connectionp,
    00201     OCIBFileLocator *locatorp, bool toCopy = true) ;
    00202
    00203     //Methods:
    00204     OCIBFileLocator* getLocator() const;
    00205     void do_getDirAlias( void * dirAlias, ub2 * dirAliasLen) const ;
    00206     void do_getFileName( void * fileName, ub2 * fileNameLen) const ;
    00207     void do_setName( void * alias, ub2 aliasLen,
    00208                      void *fileName, ub2 fileNameLen);
    00209   // Friends
    00210   friend class AnyDataImpl;
    00211   friend class StatementImpl;
    00212   friend class ResultSetImpl;
    00213   friend class Blob;
    00214   friend class Clob;
    00215   friend class aq::MessageImpl;
    00216
    00217   friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Bfile>&) ;
    00218   friend void getVector(Statement*, unsigned int,
    00219   OCCI_STD_NAMESPACE::vector<Bfile>&) ;
    00220   friend void getVector(ResultSet*, unsigned int ,
    00221   OCCI_STD_NAMESPACE::vector<Bfile>&) ;
    00222   friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Bfile>&) ;
    00223   friend void do_setVectorOfBfile(Statement*, unsigned int,
    00224   const OCCI_STD_NAMESPACE::vector<Bfile>&, void *, unsigned int, void *, unsigned int ) ;
    00225 };
    00226
    00227 class Blob
    00228 {
    00229   public:
    00230
    00231     Blob();
    00232     Blob(const Connection *connectionp) ;
    00233     Blob(const Blob &srcBlob) ;
    00234     ~Blob();
    00235     unsigned int getChunkSize() const ;
    00236     unsigned int length() const ;
    00237     Blob& operator =(const Blob &srcBlob) ;
    00238     bool operator ==(const Blob &srcBlob) const ;
    00239     bool operator !=(const Blob &srcBlob) const ;
    00240     void setNull() ;
    00241     bool isNull() const ;
    00242     void setEmpty() ;
    00243     void setEmpty(const Connection *connectionp) ;
    00244     bool isInitialized() const;
    00245     void open(LobOpenMode mode=OCCI_LOB_READWRITE) ;
    00246     void close() ;
    00247     bool isOpen() const ;
    00248     void copy(const Blob &srcBlob, unsigned int numBytes,
    00249       unsigned int  dstOffset =1, unsigned int srcOffset =1) ;
    00250     void copy(const Bfile &srcBfile, unsigned int numBytes,
    00251       unsigned int  dstOffset =1, unsigned int srcOffset =1) ;
    00252     void append(const Blob &srcBlob) ;
    00253     unsigned int read(unsigned int  amt, unsigned char *buffer,
    00254       unsigned int  bufsize, unsigned int offset = 1) const ;
    00255     unsigned int write(unsigned int amt, unsigned char *buffer,
    00256       unsigned int bufsize, unsigned int offset = 1) ;
    00257     unsigned int writeChunk(unsigned int amt, unsigned char *buffer,
    00258       unsigned int bufsize, unsigned int offset = 1) ;
    00259     void trim(unsigned int newlen) ;
    00260     Stream* getStream(unsigned int offset = 1,
    00261       unsigned int amount =0)  ;
    00262     void closeStream(Stream *stream);
    00263
    00264   private:
    00265
    00266     //Data Members:
    00267
    00268     // pointer to the BLOB locator
    00269     OCIBlobLocator *lobp;
    00270
    00271     // pointer to the ConnectionImpl instance
    00272     const ConnectionImpl *connp;
    00273
    00274     // pointer to the LobStreamImpl instance obtained from this LOB
    00275     LobStreamImpl *streamp;
    00276
    00277     //for future use !
    00278     void *blobExt;
    00279
    00280     //Constructor:
    00281     Blob(const Connection *connectionp,
    00282     OCIBlobLocator *locatorp, bool toCopy=true) ;
    00283
    00284     //Methods:
    00285     OCIBlobLocator* getLocator() const;
    00286
    00287   // Friends
    00288   friend class AnyDataImpl;
    00289   friend class StatementImpl;
    00290   friend class ResultSetImpl;
    00291
    00292   friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Blob>&) ;
    00293   friend void getVector(Statement*, unsigned int,
    00294   OCCI_STD_NAMESPACE::vector<Blob>&) ;
    00295   friend void getVector(ResultSet*, unsigned int,
    00296   OCCI_STD_NAMESPACE::vector<Blob>&) ;
    00297   friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Blob>&) ;
    00298   friend void do_setVectorOfBlob(Statement*, unsigned int,
    00299   const OCCI_STD_NAMESPACE::vector<Blob>&, void *, unsigned int, void *, unsigned int ) ;
    00300 };
    00301
    00302 class Clob
    00303 {
    00304   public:
    00305
    00306     Clob();
    00307     Clob(const Connection *connectionp) ;
    00308     Clob(const Clob &srcClob) ;
    00309     ~Clob();
    00310     unsigned int getChunkSize() const ;
    00311     unsigned int length() const ;
    00312     OCCI_STD_NAMESPACE::string getCharSetId() const;
    00313     CharSetForm getCharSetForm() const;
    00314     void setCharSetId( const OCCI_STD_NAMESPACE::string &charset) ;
    00315     void setCharSetForm( CharSetForm csfrm) ;
    00316     Clob& operator =(const Clob &srcClob) ;
    00317     bool operator ==(const Clob &srcClob) const ;
    00318     bool operator !=(const Clob &srcClob) const ;
    00319     void setNull() ;
    00320     bool isNull() const ;
    00321     void setEmpty() ;
    00322     void setEmpty(const Connection *connectionp) ;
    00323     bool isInitialized() const;
    00324     void open(LobOpenMode mode=OCCI_LOB_READWRITE) ;
    00325     void close() ;
    00326     bool isOpen() const ;
    00327     void copy(const Clob &srcClob, unsigned int numBytes,
    00328               unsigned int  dstOffset = 1, unsigned int srcOffset = 1) ;
    00329     void copy(const Bfile &srcBfile, unsigned int numBytes,
    00330               unsigned int  dstOffset = 1, unsigned int srcOffset = 1) ;
    00331     void append(const Clob &srcClob) ;
    00332     unsigned int read(unsigned int  amt, unsigned char *buffer,
    00333                       unsigned int  bufsize,  unsigned int offset = 1) const;
    00334     unsigned int read(unsigned int  amt, utext *buffer,
    00335                       unsigned int  bufsize,  unsigned int offset = 1) const;
    00336     unsigned int write(unsigned int amt, unsigned char *buffer,
    00337                        unsigned int bufsize,  unsigned int offset = 1 );
    00338     unsigned int write(unsigned int amt, utext *buffer,
    00339                        unsigned int bufsize,  unsigned int offset = 1 );
    00340     unsigned int writeChunk(unsigned int amt, unsigned char *buffer,
    00341                             unsigned int bufsize, unsigned int offset = 1 );
    00342     unsigned int writeChunk(unsigned int amt, utext *buffer,
    00343                             unsigned int bufsize, unsigned int offset = 1 );
    00344     void trim(unsigned int newlen) ;
    00345     Stream* getStream(unsigned int offset = 1,
    00346       unsigned int amount =0 );
    00347     void closeStream(Stream *stream);
    00348
    00349     UString getCharSetIdUString() const;
    00350     void setCharSetIdUString( const UString &charset) ;
    00351
    00352   private:
    00353
    00354     //Data Members:
    00355
    00356     // pointer to the CLOB locator
    00357     OCIClobLocator *lobp;
    00358
    00359     // pointer to the ConnectionImpl instance
    00360     const ConnectionImpl *connp;
    00361
    00362     // pointer to the LobStreamImpl instance obtained from this LOB
    00363     LobStreamImpl *streamp;
    00364
    00365     //charset id
    00366     ub2 charsetId;
    00367
    00368     //charset form
    00369     CharSetForm charsetForm;
    00370
    00371     //for future use !
    00372     void *clobExt;
    00373
    00374     //Constructor:
    00375     Clob(const Connection *connectionp,
    00376     OCIClobLocator *locatorp, bool toCopy =true ) ;
    00377
    00378     //Methods:
    00379     OCIClobLocator* getLocator() const;
    00380     unsigned int do_read( unsigned int amt, void *buffer,
    00381     unsigned int bufsize, unsigned int offset) const;
    00382     unsigned int do_write( unsigned int amt, void *buffer,
    00383     unsigned int bufsize, unsigned int offset) ;
    00384     unsigned int do_writeChunk( unsigned int amt, void *buffer,
    00385     unsigned int bufsize, unsigned int offset) ;
    00386
    00387   // Friends
    00388   friend class AnyDataImpl;
    00389   friend class StatementImpl;
    00390   friend class ResultSetImpl;
    00391
    00392   friend void getVector(const AnyData&, OCCI_STD_NAMESPACE::vector<Clob>&) ;
    00393   friend void getVector(Statement*, unsigned int,
    00394   OCCI_STD_NAMESPACE::vector<Clob>&) ;
    00395   friend void getVector(ResultSet*, unsigned int,
    00396   OCCI_STD_NAMESPACE::vector<Clob>&) ;
    00397   friend void setVector(AnyData&, const OCCI_STD_NAMESPACE::vector<Clob>&) ;
    00398   friend void do_setVectorOfClob(Statement*, unsigned int,
    00399   const OCCI_STD_NAMESPACE::vector<Clob>&, void *, unsigned int, void *, unsigned int ) ;
    00400 };
    00401
    00402 class Number
    00403 {
    00404
    00405  public:
    00406
    00407  // Constructors
    00408   /* default constructor added  */
    00409   Number();
    00410   Number(const Number &srcNum);
    00411   Number(long double val) ;
    00412   Number(double val) ;
    00413   Number(float val) ;
    00414   Number(long val) ;
    00415   Number(int val) ;
    00416   Number(short val) ;
    00417   Number(char val) ;
    00418   Number(signed char val);
    00419   Number(unsigned long val) ;
    00420   Number(unsigned int val) ;
    00421   Number(unsigned short val) ;
    00422   Number(unsigned char val) ;
    00423
    00424   ~Number();
    00425   // Methods
    00426   const Number abs() const ;
    00427   // unary negate
    00428   const Number operator-() ;
    00429   // unary increment
    00430   Number& operator++() ;
    00431   const Number operator++(int) ;
    00432   // unary decrement
    00433   Number& operator--() ;
    00434   const Number operator--(int) ;
    00435   // assigment operator
    00436   Number& operator=(const Number &a);
    00437   // add and assign
    00438   Number& operator+=(const Number &a) ;
    00439   // subtract and assign
    00440   Number& operator-=(const Number &a) ;
    00441   // Mulitply an assign
    00442   Number& operator*=(const Number &a) ;
    00443    // divide and assign
    00444   Number& operator/=(const Number &a) ;
    00445   // Modulo and assign
    00446   Number& operator%=(const Number &a) ;
    00447   // casting operators
    00448   operator long() const;
    00449   operator int() const;
    00450   operator short() const;
    00451   operator char() const;
    00452   operator signed char() const;
    00453   operator unsigned long() const;
    00454   operator unsigned int() const;
    00455   operator unsigned short() const;
    00456   operator unsigned char() const;
    00457   operator long double() const;
    00458   operator double() const;
    00459   operator float() const;
    00460   // Decimal shift
    00461   const Number shift(int val) const ;
    00462   // Integer Power
    00463   const Number intPower(int val) const ;
    00464   const Number ceil() const ;
    00465   const Number floor() const ;
    00466   const Number squareroot() const ;
    00467   const int sign() const ;
    00468   // conversion routines
    00469   //  Format Number and return as a OCCI_STD_NAMESPACE::string
    00470   OCCI_STD_NAMESPACE::string toText(const Environment *envp,
    00471                 const OCCI_STD_NAMESPACE::string &fmt,const OCCI_STD_NAMESPACE::string &nlsParam="") const
    00472                 ;
    00473   UString toText(const Environment *envp,
    00474                 const UString &fmt,const UString &nlsParam) const
    00475                 ;
    00476   // Create an Number from formatted text
    00477   void fromText(const Environment *envp,const OCCI_STD_NAMESPACE::string &number,
    00478                 const OCCI_STD_NAMESPACE::string &fmt, const OCCI_STD_NAMESPACE::string &nlsParam = "")
    00479                ;
    00480   void fromText(const Environment *envp,
    00481   const UString &number,
    00482   const UString &fmt, const UString &nlsParam);
    00483   void fromBytes(const Bytes &s) ;
    00484   Bytes toBytes() const;
    00485   // truncate digits
    00486   const Number trunc(int decplace) const ;
    00487    // round to the decplace place.
    00488   const Number round(int decplace) const ;
    00489   // returns an Number with digits decimal digits
    00490   const Number prec(int digits) const ;
    00491   const Number sin() const ;
    00492   const Number cos() const ;
    00493   const Number tan() const ;
    00494   const Number hypSin() const ;
    00495   const Number hypCos() const ;
    00496   const Number hypTan() const ;
    00497   const Number arcSin() const ;
    00498   const Number arcCos() const ;
    00499   const Number arcTan() const ;
    00500   const Number arcTan2(const Number &val) const;
    00501   const Number power(const Number &val) const;
    00502   const Number exp() const ;
    00503   const Number ln() const ;
    00504   const Number log(const Number &val) const;
    00505   bool isNull() const;
    00506   void setNull();
    00507  private:
    00508   /* Private constructor for constructing number from methods inside  */
    00509   Number(const OCINumber &result);
    00510   OCINumber getOCINumber() const;
    00511
    00512   OCINumber data;
    00513   /* a flag to indicate if the  Number  is null */
    00514   bool numberIsNull;
    00515   void *numberExt;
    00516
    00517   // a >= b
    00518   friend bool operator>=(const Number &a, const Number &b);
    00519   // a < = b
    00520   friend bool operator<=(const Number &a, const Number &b);
    00521   // a > b
    00522   friend bool operator>(const Number &a, const Number &b);
    00523   // a < b
    00524   friend bool operator<(const Number &a, const Number &b);
    00525
    00526   friend class IntervalDS;
    00527   friend class IntervalYM;
    00528   friend const IntervalYM operator*(const IntervalYM &a,
    00529   const Number& factor) ;
    00530   friend const IntervalDS operator*(const IntervalDS &a,
    00531   const Number& factor) ;
    00532   friend const IntervalYM operator/(const IntervalYM &a,
    00533   const Number &factor) ;
    00534   friend const IntervalDS operator/(const IntervalDS &a,
    00535   const Number &factor) ;
    00536   friend class ResultSetImpl;
    00537   friend class StatementImpl;
    00538   friend class AnyDataImpl;
    00539   friend void getVector(const AnyData &any,
    00540   OCCI_STD_NAMESPACE::vector<Number> &vect);
    00541   friend void setVector(AnyData &any,
    00542   const OCCI_STD_NAMESPACE::vector<Number> &vect) ;
    00543   friend Number MetaData::getNumber(MetaData::AttrId attrid)          const ;
    00544   friend void getVector(Statement  *stmt, unsigned int paramIndex,
    00545   OCCI_STD_NAMESPACE::vector<Number> &vect) ;
    00546   friend void do_setVectorOfNumber(Statement *stmt, unsigned int paramIndex,
    00547   const OCCI_STD_NAMESPACE::vector<Number> &vect, void *schemaName, unsigned int schemaNameLen,
    00548   void *typeName, unsigned int typeNameLen);
    00549   friend void getVector(ResultSet  *rs, unsigned int colIndex,
    00550   OCCI_STD_NAMESPACE::vector<Number> &vect);
    00551
    00552 };
    00553
    00554 class Date
    00555 {
    00556  public:
    00557
    00558   // Constructors
    00559   Date();
    00560   Date(const Date &a);
    00561   Date(const Environment *envp,int year = 1,unsigned int month = 1,
    00562            unsigned int day = 1,unsigned  int hour = 0,
    00563            unsigned int minute = 0, unsigned int seconds = 0);
    00564   ~Date();
    00565   // Methods
    00566
    00567   void setDate(int year = 1,unsigned int month = 1,unsigned int day = 1,
    00568                unsigned int hour = 0,unsigned int minute = 0,
    00569                unsigned int seconds = 0);
    00570   void getDate(int &year,unsigned int &month,unsigned int &day,
    00571            unsigned int &hour ,unsigned int &min ,unsigned int &sec) const;
    00572   Bytes toBytes() const ;
    00573   void fromBytes(const Bytes &byteStream,
    00574   const Environment *envp = NULL);
    00575   OCCI_STD_NAMESPACE::string toText(
    00576                  const OCCI_STD_NAMESPACE::string &fmt = "",
    00577                  const OCCI_STD_NAMESPACE::string &nlsParam = "") const;
    00578   UString toText(
    00579                  const UString &fmt ,
    00580                  const UString &nlsParam ) const;
    00581   void fromText(const OCCI_STD_NAMESPACE::string &datestr,
    00582                 const OCCI_STD_NAMESPACE::string &fmt = "",
    00583                 const OCCI_STD_NAMESPACE::string &nlsParam = "",
    00584                 const Environment *envp = NULL);
    00585   void fromText(const UString &datestr,
    00586                 const UString &fmt , const UString &nlsParam ,
    00587                 const Environment *envp = NULL);
    00588   Date toZone(const OCCI_STD_NAMESPACE::string &zone1, const OCCI_STD_NAMESPACE::string &zone2) const;
    00589   Date& operator=(const Date &d);
    00590   Date addMonths(int i) const;
    00591   Date addDays(int i) const ;
    00592   Date lastDay() const ;
    00593   IntervalDS daysBetween(const Date &d) const;
    00594   Date nextDay(const OCCI_STD_NAMESPACE::string &dow) const;
    00595   Date nextDay(const UString &dow) const;
    00596   bool isNull() const;
    00597   void setNull();
    00598   static Date getSystemDate(const Environment *envp) ;
    00599
    00600  private:
    00601   OCIDate date;
    00602   OCIEnv *envhp;
    00603   bool dateIsNull;
    00604   void *dateExt;
    00605
    00606   /* private constructor */
    00607   Date(OCIEnv *envp,OCIDate dateval);
    00608   OCIDate getOCIDate() const;
    00609   void do_toText( void * fmt, ub1 fmtLen, void * nlsParam,
    00610                   ub4 nlsParamLen, void * buf, ub4 * bufLen,
    00611                   bool isUTF16) const;
    00612   void do_fromText( void * datestr, ub4 datestrLen,
    00613                   void * fmt, ub1 fmtLen,
    00614                   void * nlsParam, ub4 nlsParamLen,
    00615                   const Environment * envp,
    00616                   bool isUTF16);
    00617   Date do_nextDay( void * dow, size_t dowLen, bool isUTF16) const;
    00618   void constructHourAndMinute(sb4 &seconds, sb4 &hours, sb4 &minutes) const;
    00619   friend bool operator==(const Date &a,const Date &b);
    00620   friend bool operator>(const Date &a,const Date &b);
    00621   friend bool operator<(const Date &a,const Date &b);
    00622   friend bool operator!=(const Date &a,const Date &b);
    00623   friend bool operator>=(const Date &a,const Date &b);
    00624   friend bool operator<=(const Date &a,const Date &b);
    00625   friend class ResultSetImpl;
    00626   friend class StatementImpl;
    00627   friend class AnyDataImpl;
    00628   friend class aq::MessageImpl;
    00629   friend void getVector(const AnyData &any,
    00630                         OCCI_STD_NAMESPACE::vector<Date> &vect) ;
    00631   friend void setVector(AnyData &any,
    00632                         const OCCI_STD_NAMESPACE::vector<Date> &vect);
    00633   friend void getVector(Statement  *stmt, unsigned int paramIndex,
    00634    OCCI_STD_NAMESPACE::vector<Date> &vect)  ;
    00635   friend void do_setVectorOfDate(Statement *stmt, unsigned int paramIndex,
    00636    const OCCI_STD_NAMESPACE::vector<Date> &vect, void *schemaName, unsigned int schemaNameLen,
    00637    void *typeName, unsigned int typeNameLen) ;
    00638   friend void getVector(ResultSet  *rs, unsigned int colIndex,
    00639   OCCI_STD_NAMESPACE::vector<Date> &vect) ;
    00640
    00641 }; //class Date
    00642
    00643 class Timestamp
    00644 {
    00645   public:
    00646   Timestamp() ;
    00647
    00648   Timestamp( const Environment *env, int year=1,
    00649              unsigned int month=1, unsigned int day=1, unsigned int hour=0,
    00650              unsigned int min=0 ,unsigned int sec=0, unsigned int fs=0,
    00651              int tzhour=0, int tzmin=0) ;
    00652   Timestamp( const Environment *env, int year,
    00653              unsigned int month, unsigned int day, unsigned int hour,
    00654              unsigned int min ,unsigned int sec, unsigned int fs,
    00655              const OCCI_STD_NAMESPACE::string &timezone);
    00656   Timestamp( const Environment *env, int year,
    00657              unsigned int month, unsigned int day, unsigned int hour,
    00658              unsigned int min ,unsigned int sec, unsigned int fs,
    00659              const UString &timezone);
    00660   Timestamp( const Timestamp &src) ;
    00661   ~Timestamp();
    00662
    00663   void getTimeZoneOffset( int &hour, int &minute) const ;
    00664   void getTime( unsigned int &hour, unsigned int &minute,
    00665   unsigned int &second, unsigned int &fs) const ;
    00666   void getDate( int &year, unsigned int &month, unsigned int &day )const ;
    00667   OCCI_STD_NAMESPACE::string toText(const OCCI_STD_NAMESPACE::string &fmt,
    00668                      unsigned int fsprec,
    00669                      const OCCI_STD_NAMESPACE::string &nlsParam ="") const   ;
    00670   UString toText(const UString &fmt,
    00671                  unsigned int fsprec, const UString &nlsParam ) const   ;
    00672   void setTimeZoneOffset( int hour,  int minute)  ;
    00673   void setTime( unsigned int hour, unsigned int minute,
    00674   unsigned int second, unsigned int fs)  ;
    00675   void setDate( int year, unsigned int month, unsigned int day ) ;
    00676   void setNull() ;
    00677   void fromText( const OCCI_STD_NAMESPACE::string &timestmpStr,
    00678                  const OCCI_STD_NAMESPACE::string &fmt ,
    00679                  const OCCI_STD_NAMESPACE::string &nlsParam= "",
    00680                  const Environment *env =NULL);
    00681   void fromText( const UString &timestmpStr,
    00682                  const UString &fmt , const UString &nlsParam,
    00683                  const Environment *env =NULL);
    00684   bool isNull() const;
    00685   Timestamp & operator =( const Timestamp &src) ;
    00686   const IntervalYM subYM(const Timestamp& val) const ;
    00687   const IntervalDS subDS(const Timestamp& val) const ;
    00688   const Timestamp intervalAdd(const IntervalDS& val) const ;
    00689   const Timestamp intervalSub(const IntervalDS& val) const ;
    00690   const Timestamp intervalAdd(const IntervalYM& val) const ;
    00691   const Timestamp intervalSub(const IntervalYM& val) const ;
    00692
    00693   friend bool operator==(const Timestamp &a,const Timestamp &b);
    00694   friend bool operator>(const Timestamp &a,const Timestamp &b);
    00695   friend bool operator<(const Timestamp &a,const Timestamp &b);
    00696   friend bool operator !=(const Timestamp &a,const Timestamp &b);
    00697   friend bool operator >=(const Timestamp &a,const Timestamp &b);
    00698   friend bool operator <=(const Timestamp &a,const Timestamp &b);
    00699
    00700   friend class ResultSetImpl;
    00701   friend class StatementImpl;
    00702   friend class AnyDataImpl;
    00703
    00704   private:
    00705    OCIDateTime *ocidatetime;
    00706    OCIEnv *ocienv;
    00707    void *timestampExt;
    00708
    00709    OCIDateTime *getOCIDateTime() const;
    00710    Timestamp( OCIEnv *env, OCIDateTime *dt, bool toCopy = true) ;
    00711    void allocateDataMembers( OCIEnv *env) ;
    00712    void do_TimestampConstruct( const Environment *env, int year,
    00713    unsigned int month, unsigned int day, unsigned int hour, unsigned int min,
    00714    unsigned int sec, unsigned int fs, void *tzinter);
    00715
    00716    friend  void getVector(const AnyData &any,
    00717    OCCI_STD_NAMESPACE::vector<Timestamp> &vect);
    00718    friend  void setVector(AnyData &any,
    00719    const OCCI_STD_NAMESPACE::vector<Timestamp> &vect) ;
    00720    friend Timestamp MetaData::getTimestamp(
    00721    MetaData::AttrId attrid) const ;
    00722    friend void getVector(ResultSet  *rs, unsigned int,
    00723    OCCI_STD_NAMESPACE::vector<Timestamp> &vect) ;
    00724    friend void getVector(Statement  *rs, unsigned int,
    00725    OCCI_STD_NAMESPACE::vector<Timestamp> &vect) ;
    00726    friend void do_setVectorOfTimestamp(Statement *stmt, unsigned int paramIndex,
    00727    const OCCI_STD_NAMESPACE::vector<Timestamp> &vect, void *schemaName, unsigned int schemaNameLen,
    00728    void *typeName, unsigned int typeNameLen) ;
    00729 }; // class Timestamp
    00730
    00731 class IntervalDS
    00732 {
    00733
    00734   public:
    00735   IntervalDS() ;
    00736   IntervalDS( const Environment *env,int day=0,
    00737   int hour=0, int minute=0, int second=0,
    00738   int fs=0) ;
    00739   IntervalDS( const IntervalDS &src) ;
    00740
    00741   ~IntervalDS();
    00742
    00743   int getDay () const ;
    00744   int getHour () const ;
    00745   int getMinute () const ;
    00746   int getSecond() const ;
    00747   int getFracSec () const ;
    00748   void set( int day, int hour, int minute, int second, int fracsec) ;
    00749   void setNull() ;
    00750   void fromText( const OCCI_STD_NAMESPACE::string &inpstr, const OCCI_STD_NAMESPACE::string &nlsParam ="",
    00751   const Environment *env=NULL)  ;
    00752   OCCI_STD_NAMESPACE::string toText( unsigned int lfprec, unsigned int fsprec,
    00753   const OCCI_STD_NAMESPACE::string &nlsParam="") const ;
    00754   bool isNull() const;
    00755   IntervalDS& operator =( const IntervalDS &src) ;
    00756   IntervalDS& operator +=( const IntervalDS &a);
    00757   IntervalDS& operator -=( const IntervalDS &a);
    00758   IntervalDS& operator *=( const Number &factor);
    00759   IntervalDS& operator /=( const Number &factor);
    00760
    00761   friend bool operator>(const IntervalDS &a,
    00762   const IntervalDS &b) ;
    00763   friend bool operator<(const IntervalDS &a,
    00764   const IntervalDS &b) ;
    00765   friend bool operator >=( const IntervalDS &a,
    00766   const IntervalDS &b);
    00767   friend bool operator <=( const IntervalDS &a,
    00768   const IntervalDS &b);
    00769
    00770   //UTF16 support
    00771   void fromUText( const UString &inpstr, const Environment *env=NULL );
    00772   UString toUText( unsigned int lfprec, unsigned int fsprec) const;
    00773
    00774   private:
    00775    OCIInterval *ociinter;
    00776    OCIEnv *ocienv;
    00777    void *intervalDSExt;
    00778
    00779    IntervalDS( OCIEnv *env, OCIInterval *inter, bool toCopy = true) ;
    00780    OCIInterval * getOCIInterval() const;
    00781
    00782    void allocateDataMembers( OCIEnv *env) ;
    00783    friend const IntervalDS Timestamp::subDS(
    00784    const Timestamp& val) const ;
    00785    friend const Timestamp Timestamp::intervalAdd(
    00786    const IntervalDS& val) const ;
    00787    friend const Timestamp Timestamp::intervalSub(
    00788    const IntervalDS& val) const ;
    00789    friend class Date;
    00790    friend void getVector(ResultSet  *rs, unsigned int,
    00791    OCCI_STD_NAMESPACE::vector<IntervalDS> &vect) ;
    00792    friend void getVector(Statement  *rs, unsigned int,
    00793    OCCI_STD_NAMESPACE::vector<IntervalDS> &vect) ;
    00794    friend void do_setVectorOfIntervalDS(Statement *stmt, unsigned int paramIndex,
    00795    const OCCI_STD_NAMESPACE::vector<IntervalDS> &vect, void *schemaName, unsigned int schemaNameLen,
    00796    void *typeName, unsigned int typeNameLen) ;
    00797    friend class StatementImpl;
    00798    friend class ResultSetImpl;
    00799    friend class AnyDataImpl;
    00800    friend  void getVector(const AnyData &any,
    00801    OCCI_STD_NAMESPACE::vector<IntervalDS> &vect);
    00802    friend  void setVector(AnyData &any,
    00803    const OCCI_STD_NAMESPACE::vector<IntervalDS> &vect) ;
    00804
    00805
    00806 };  //class IntervalDS
    00807
    00808 class IntervalYM
    00809 {
    00810
    00811   public:
    00812   IntervalYM() ;
    00813   IntervalYM( const Environment *env,int year=0, int month=0) ;
    00814   IntervalYM( const IntervalYM &src) ;
    00815   ~IntervalYM();
    00816
    00817   int getYear() const ;
    00818   int getMonth() const ;
    00819
    00820   void set( int year, int month) ;
    00821   void setNull() ;
    00822   void fromText( const OCCI_STD_NAMESPACE::string &inpstr, const OCCI_STD_NAMESPACE::string &nlsParam="",
    00823   const Environment *env=NULL) ;
    00824   OCCI_STD_NAMESPACE::string toText( unsigned int lfprec, const OCCI_STD_NAMESPACE::string &nlsParam="") const;
    00825   bool isNull() const;
    00826   IntervalYM & operator =( const IntervalYM &src) ;
    00827   IntervalYM& operator +=( const IntervalYM &a);
    00828   IntervalYM& operator -=( const IntervalYM &a);
    00829   IntervalYM& operator *=( const Number &factor);
    00830   IntervalYM& operator /=( const Number &factor);
    00831
    00832   friend bool operator>(const IntervalYM &a, const IntervalYM &b) ;
    00833   friend bool operator<( const IntervalYM &a, const IntervalYM &b) ;
    00834   friend bool operator >=(const IntervalYM &a, const IntervalYM &b);
    00835   friend bool operator <=(const IntervalYM &a, const IntervalYM &b);
    00836
    00837   //UTF16 support
    00838   void fromUText( const UString &inpstr, const Environment *env=NULL );
    00839   UString toUText( unsigned int lfprec ) const;
    00840
    00841   private:
    00842    OCIInterval *ociinter;
    00843    OCIEnv *ocienv;
    00844    void *intervalYMExt;
    00845
    00846    IntervalYM( OCIEnv *env, OCIInterval *inter, bool toCopy = true) ;
    00847    OCIInterval *getOCIInterval() const;
    00848    void allocateDataMembers( OCIEnv *env) ;
    00849    friend const IntervalYM Timestamp :: subYM(
    00850    const Timestamp& val) const ;
    00851    friend const Timestamp Timestamp::intervalAdd(
    00852    const IntervalYM &val) const ;
    00853    friend const Timestamp Timestamp::intervalSub(
    00854    const IntervalYM &val) const ;
    00855
    00856    friend void getVector(ResultSet  *rs, unsigned int,
    00857    OCCI_STD_NAMESPACE::vector<IntervalYM> &vect) ;
    00858    friend void getVector(Statement  *rs, unsigned int,
    00859    OCCI_STD_NAMESPACE::vector<IntervalYM> &vect) ;
    00860    friend void do_setVectorOfIntervalYM(Statement *stmt, unsigned int paramIndex,
    00861    const OCCI_STD_NAMESPACE::vector<IntervalYM> &vect, void *schemaName, unsigned int schemaNameLen,
    00862    void *typeName, unsigned int typeNameLen) ;
    00863
    00864    friend class StatementImpl;
    00865    friend class ResultSetImpl;
    00866    friend class AnyDataImpl;
    00867    friend  void getVector(const AnyData &any,
    00868    OCCI_STD_NAMESPACE::vector<IntervalYM> &vect);
    00869    friend  void setVector(AnyData &any,
    00870    const OCCI_STD_NAMESPACE::vector<IntervalYM> &vect) ;
    00871
    00872 }; //class IntervalYM
    00873
    00874
    00875 Number operator+(const Number &a, const Number &b) ;
    00876 Number operator/(const Number &dividend, const Number &divisor) ;
    00877 Number operator*(const Number &a, const Number &b) ;
    00878 Number operator%(const Number &a, const Number &b) ;
    00879 Number operator-(const Number &subtrahend, const Number &subtractor) ;
    00880 bool operator==(const Number &a, const Number &b);
    00881 bool operator!=(const Number &a, const Number &b);
    00882
    00883 const IntervalYM operator+(const IntervalYM &a, const IntervalYM &b) ;
    00884 const IntervalYM operator-(const IntervalYM &a, const IntervalYM &b) ;
    00885 const IntervalYM operator*(const IntervalYM &a, const Number& factor);
    00886 const IntervalYM operator/(const IntervalYM &a, const Number &factor);
    00887 bool operator==(const IntervalYM &a, const IntervalYM &b) ;
    00888 bool operator!=(const IntervalYM &a, const IntervalYM &b) ;
    00889
    00890 const IntervalDS operator+(const IntervalDS &a, const IntervalDS &b) ;
    00891 const IntervalDS operator-(const IntervalDS &a, const IntervalDS &b) ;
    00892 const IntervalDS operator*(const IntervalDS &a, const Number& factor);
    00893 const IntervalDS operator/(const IntervalDS &a, const Number &factor);
    00894 bool operator==(const IntervalDS &a, const IntervalDS &b) ;
    00895 bool operator!=(const IntervalDS &a, const IntervalDS &b) ;
    00896
    00897
    00898 typedef struct BFloat
    00899 {
    00900  float value;
    00901  bool  isNull;
    00902
    00903  BFloat()
    00904  {
    00905    isNull = false;
    00906    value = 0.;
    00907  }
    00908 } BFloat;
    00909
    00910 typedef struct BDouble
    00911 {
    00912  double value;
    00913  bool   isNull;
    00914
    00915  BDouble()
    00916  {
    00917    isNull = false;
    00918    value = 0.;
    00919  }
    00920 } BDouble;
    00921
    00922 /*---------------------------------------------------------------------------
    00923                            EXPORT FUNCTIONS
    00924   ---------------------------------------------------------------------------*/
    00925
    00926
    00927 /*---------------------------------------------------------------------------
    00928                           INTERNAL FUNCTIONS
    00929   ---------------------------------------------------------------------------*/
    00930
    00931
    00932 } /* end of namespace occi */
    00933 } /* end of namespace oracle */
    00934 #endif                                              /* OCCIDATA_ORACLE */
    00935
    00936 #endif                                              /* _olint */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines