SQLDBC.h

Go to the documentation of this file.
00001 
00035 #ifndef SQLDBC_H
00036 #define SQLDBC_H
00037 
00044 #ifdef  SQLDBC_FEATURE_TRACEOPTION_OFF
00045 #undef  SQLDBC_FEATURE_TRACEOPTION
00046 #else
00047 #define SQLDBC_FEATURE_TRACEOPTION
00048 #endif
00049 
00050 #include "SQLDBC_Types.h" /* no check */
00051 
00052 class IFR_Environment;
00053 class IFR_Connection;
00054 class IFR_ConnectProperties;
00055 class IFR_ConnectionItem;
00056 class IFR_ErrorHndl;
00057 class IFR_Statement;
00058 class IFR_PreparedStmt;
00059 class IFR_SQLWarning;
00060 class IFR_ResultSet;
00061 class IFR_RowSet;
00062 class IFR_ParameterMetaData;
00063 class IFR_ResultSetMetaData;
00064 class IFR_LOB;
00065 class SAPDBMem_IRawAllocator;
00066 
00070 static const char* SQLDBCHeaderVersion = "SQLDBC.H  7.5.0    BUILD 044-000-DEB-002";
00071 /*
00072    type maps used by the script genSQLDBC_C.pl for gerating a SQLDBC C-wrapper.
00073    #typemap  SQLDBC_StringEncodingType_Encoding SQLDBC_StringEncoding
00074    #typemap  ParameterMode SQLDBC_ParameterMetaData::ParameterMode
00075    #typemap  ParameterNullBehavior SQLDBC_ParameterMetaData::ParameterNullBehavior
00076    #typemap  ColumnNullBehavior SQLDBC_ResultSetMetaData::ColumnNullBehavior
00077    #typemap  SQLDBC_Statement_ResultSetType SQLDBC_Statement::ResultSetType
00078    #typemap  SQLDBC_Statement_ConcurrencyType SQLDBC_Statement::ConcurrencyType
00079 */
00080 
00081 class SQLDBC_IRuntime;
00082 
00083 #ifdef WIN32
00084 #define SQLDBC_DLLEXPORT __declspec(dllexport)
00085 #else
00086 #define SQLDBC_DLLEXPORT
00087 #endif
00088 
00089 namespace SQLDBC {
00090 class SQLDBC_Statement;
00091 class SQLDBC_ConnectProperties;
00092 
00096 class SQLDBC_ErrorHndl
00097 {
00098 public:
00104   SQLDBC_DLLEXPORT
00105   SQLDBC_ErrorHndl();
00106 
00110   SQLDBC_DLLEXPORT
00111   const SQLDBC_Int4 getErrorCode() const;
00112 
00116   SQLDBC_DLLEXPORT
00117   const char* getSQLState() const;
00118 
00123   SQLDBC_DLLEXPORT
00124   const char *getErrorText() const;
00125 
00133   SQLDBC_DLLEXPORT
00134   operator SQLDBC_Bool () const;
00135 
00136 private:
00137   friend class SQLDBC_ConnectionItem;
00138   friend struct SQLDBC_ConnectionItemStorage;
00139   friend class SQLDBC_Connection;
00140 
00146   SQLDBC_ErrorHndl(IFR_ErrorHndl* error);
00147 
00152   void setMemoryAllocationFailed();
00153 
00154 
00158   IFR_ErrorHndl *m_error;
00159 };
00160 
00169 class SQLDBC_SQLWarning
00170 {
00171 public:
00176   SQLDBC_DLLEXPORT
00177   SQLDBC_SQLWarning* getNextWarning() const;
00178 
00182   SQLDBC_DLLEXPORT
00183   SQLDBC_SQLWarningCode getWarningCode() const;
00184 
00185 private:
00186   friend class SQLDBC_ConnectionItem;
00187   friend struct SQLDBC_ConnectionItemStorage;
00193   SQLDBC_SQLWarning(IFR_SQLWarning* warning);
00194   IFR_SQLWarning    *m_warning;
00195 };
00196 
00197 struct SQLDBC_ConnectionItemStorage;
00198 
00209 class SQLDBC_ConnectionItem
00210 {
00211 public:
00212 
00222     SQLDBC_DLLEXPORT
00223     SQLDBC_ErrorHndl &error();
00224 
00228     SQLDBC_DLLEXPORT
00229     void clearError();
00230 
00239     SQLDBC_DLLEXPORT
00240     SQLDBC_SQLWarning* warning();
00241 
00245     SQLDBC_DLLEXPORT
00246     void clearWarnings();
00247 
00248 private:
00249     friend class SQLDBC_Environment;
00250     friend class SQLDBC_Connection;
00251     friend class SQLDBC_Statement;
00252     friend class SQLDBC_PreparedStatement;
00253     friend class SQLDBC_ResultSet;
00254     friend class SQLDBC_RowSet;
00255     friend class SQLDBC_UpdatableRowSet;
00256 
00257     SQLDBC_ConnectionItem(IFR_ConnectionItem *item);
00258 
00259     ~SQLDBC_ConnectionItem();
00260 
00261     SQLDBC_ConnectionItemStorage *m_citem;
00262 };
00263 
00269 class SQLDBC_LOB
00270 {
00271 public:
00283     SQLDBC_DLLEXPORT SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length  *paramLengthIndicator);
00284 
00288     SQLDBC_DLLEXPORT SQLDBC_Retcode close();
00289 
00290 
00327     SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void                 *paramAddr,
00328                                             SQLDBC_Length        *LengthIndicator,
00329                                             const SQLDBC_Length   Size,
00330                                             const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00331 
00371     /* #methodmap SQLDBC_LOB_getDataByPos getData */
00372     SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void                 *paramAddr,
00373                                             SQLDBC_Length        *LengthIndicator,
00374                                             const SQLDBC_Length   Size,
00375                                             const SQLDBC_Length   position,
00376                                             const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00377 
00385     SQLDBC_DLLEXPORT SQLDBC_Length getLength();
00386 
00392     SQLDBC_DLLEXPORT SQLDBC_Length getPosition();
00393 
00394 
00404     SQLDBC_DLLEXPORT SQLDBC_Length getPreferredDataSize();
00405 
00406 private:
00407     IFR_LOB                  *m_lobdata;
00408     IFR_ConnectionItem       *m_citem;
00409 };
00410 
00415 class SQLDBC_ParameterMetaData
00416 {
00417 public:
00418 
00419 #ifndef __cplusplus
00420 typedef
00421 #endif
00422   enum ParameterNullBehavior {
00426     parameterNoNulls = 0,
00427 
00431     parameterNullable = 1,
00432 
00436     parameterNullableUnknown = 2
00437   }
00438 #ifndef __cplusplus
00439 ParameterNullBehavior
00440 #endif
00441 ;
00442 
00443 #ifndef __cplusplus
00444 typedef
00445 #endif
00446   enum ParameterMode {
00447 
00451     parameterModeUnknown = 0,
00452 
00456     parameterModeIn = 1,
00457 
00461     parameterModeInOut = 2,
00462 
00466     parameterModeOut = 4
00467   }
00468 #ifndef __cplusplus
00469 ParameterMode
00470 #endif
00471 ;
00472 
00479   SQLDBC_DLLEXPORT
00480   SQLDBC_Int2 getParameterCount();
00481 
00499   SQLDBC_DLLEXPORT
00500   SQLDBC_Retcode getParameterName(SQLDBC_Int2    param,
00501                                   char *buffer,
00502                                   const SQLDBC_StringEncoding encoding,
00503                                   const SQLDBC_Length  bufferSize,
00504                                   SQLDBC_Length *bufferLength) const;
00505 
00512   SQLDBC_DLLEXPORT
00513   SQLDBC_SQLType getParameterType(SQLDBC_Int2 param);
00514 
00525   SQLDBC_DLLEXPORT
00526   ParameterMode getParameterMode(SQLDBC_Int2 param);
00527 
00538   SQLDBC_DLLEXPORT
00539   SQLDBC_Int4 getParameterLength(SQLDBC_Int2 param);
00540 
00555   SQLDBC_DLLEXPORT
00556   SQLDBC_Int4 getPrecision(SQLDBC_Int2 param);
00557 
00570   SQLDBC_DLLEXPORT
00571   SQLDBC_Int4 getScale(SQLDBC_Int2 param);
00572 
00583   SQLDBC_DLLEXPORT
00584   SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 param);
00585 
00597   SQLDBC_DLLEXPORT
00598   ParameterNullBehavior isNullable(SQLDBC_Int2 param);
00599 
00600 private:
00601   friend class SQLDBC_PreparedStatement;
00602   friend struct SQLDBC_PreparedStatementStorage;
00603   SQLDBC_ParameterMetaData(IFR_ParameterMetaData *metadata);
00604   IFR_ParameterMetaData *m_metadata;
00605 };
00606 
00611 class SQLDBC_ResultSetMetaData
00612 {
00613 public:
00614 #ifndef __cplusplus
00615 typedef
00616 #endif
00617   enum ColumnNullBehavior {
00621     columnNoNulls = 0,
00622 
00626     columnNullable = 1,
00627 
00631     columnNullableUnknown = 2
00632   }
00633 #ifndef __cplusplus
00634 ColumnNullBehavior
00635 #endif
00636 ;
00642   SQLDBC_DLLEXPORT
00643   SQLDBC_Int2 getColumnCount();
00644 
00664   SQLDBC_DLLEXPORT
00665   SQLDBC_Retcode getColumnName(SQLDBC_Int2 column,
00666                                  char *buffer,
00667                                  const SQLDBC_StringEncoding encoding,
00668                                  const SQLDBC_Length  bufferSize,
00669                                  SQLDBC_Length *bufferLength) const;
00670 
00671 
00680   SQLDBC_DLLEXPORT
00681   SQLDBC_SQLType getColumnType(SQLDBC_Int2 column);
00682 
00691   SQLDBC_DLLEXPORT
00692   SQLDBC_Int4 getColumnLength(SQLDBC_Int2 column);
00693 
00707   SQLDBC_DLLEXPORT
00708   SQLDBC_Int4 getPrecision(SQLDBC_Int2 column);
00709 
00722   SQLDBC_DLLEXPORT
00723   SQLDBC_Int4 getScale(SQLDBC_Int2 column);
00724 
00734   SQLDBC_DLLEXPORT
00735   SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 column);
00736 
00747   SQLDBC_DLLEXPORT
00748   ColumnNullBehavior isNullable(SQLDBC_Int2 column);
00749 
00759   SQLDBC_DLLEXPORT
00760   SQLDBC_Bool isWritable(SQLDBC_Int2 column);
00761 
00762 private:
00763   friend class SQLDBC_PreparedStatement;
00764   friend class SQLDBC_ResultSet;
00765   friend struct SQLDBC_ResultSetStorage;
00766   friend struct SQLDBC_PreparedStatementStorage;
00767   SQLDBC_ResultSetMetaData(IFR_ResultSetMetaData *metadata);
00768   IFR_ResultSetMetaData *m_metadata;
00769 };
00770 
00782 class SQLDBC_RowSet
00783   : public SQLDBC_ConnectionItem
00784 {
00785 public:
00786 
00796   SQLDBC_DLLEXPORT
00797   SQLDBC_Retcode setPos(SQLDBC_UInt4 pos);
00798 
00805   SQLDBC_DLLEXPORT
00806   SQLDBC_Retcode fetch();
00807 
00814   SQLDBC_DLLEXPORT
00815   const SQLDBC_Int4 getRowsAffected() const;
00816 
00828   SQLDBC_DLLEXPORT
00829   const SQLDBC_Int4 *getRowStatus() const;
00830 
00882   SQLDBC_DLLEXPORT
00883   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
00884                            const SQLDBC_HostType Type,
00885                            void                 *paramAddr,
00886                            SQLDBC_Length        *LengthIndicator,
00887                            const SQLDBC_Length   Size,
00888                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00889 
00944   /* #methodmap SQLDBC_RowSet_getObjectByPos getObject */
00945   SQLDBC_DLLEXPORT
00946   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
00947                            const SQLDBC_HostType Type,
00948                            void                 *paramAddr,
00949                            SQLDBC_Length        *LengthIndicator,
00950                            const SQLDBC_Length   Size,
00951                            SQLDBC_Length         StartPos,
00952                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00953 
00954 protected:
00955   friend class SQLDBC_ResultSet;
00956   friend struct SQLDBC_ResultSetStorage;
00957   SQLDBC_RowSet(IFR_ResultSet *resultset);
00958 };
00959 
00971 class SQLDBC_UpdatableRowSet
00972   : public SQLDBC_RowSet
00973 {
00974 public:
00975 
00983   SQLDBC_DLLEXPORT
00984   SQLDBC_Retcode insertAllRows();
00985 
00991   SQLDBC_DLLEXPORT
00992   SQLDBC_Retcode insertOneRow();
00993 
01002   SQLDBC_DLLEXPORT
01003   SQLDBC_Retcode updateRow(int position);
01004 
01012   SQLDBC_DLLEXPORT
01013   SQLDBC_Retcode deleteRow(int position);
01014 
01015 private:
01016   friend struct SQLDBC_ResultSetStorage;
01017   SQLDBC_UpdatableRowSet(IFR_ResultSet *resultset);
01018 };
01019 
01020 struct SQLDBC_ResultSetStorage;
01021 
01105 class SQLDBC_ResultSet
01106   : public SQLDBC_ConnectionItem
01107 {
01108 public:
01109 
01118   SQLDBC_DLLEXPORT
01119   SQLDBC_ResultSetMetaData* getResultSetMetaData();
01120 
01125   SQLDBC_DLLEXPORT
01126   const SQLDBC_Int4 getResultCount () const;
01127 
01167   SQLDBC_DLLEXPORT
01168   SQLDBC_Retcode bindColumn (const SQLDBC_UInt4    Index,
01169                              const SQLDBC_HostType Type,
01170                              void                 *paramAddr,
01171                              SQLDBC_Length        *LengthIndicator,
01172                              const SQLDBC_Length   Size,
01173                              const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01174 
01216   /* #methodmap SQLDBC_ResultSet_bindColumnByPos bindColumn */
01217   SQLDBC_DLLEXPORT
01218   SQLDBC_Retcode bindColumn (const SQLDBC_UInt4    Index,
01219                              const SQLDBC_HostType Type,
01220                              void                 *paramAddr,
01221                              SQLDBC_Length        *LengthIndicator,
01222                              SQLDBC_Length        *PositionIndicator,
01223                              const SQLDBC_Length   Size,
01224                              const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01225 
01232   SQLDBC_DLLEXPORT
01233   SQLDBC_Retcode clearColumns();
01234 
01244    SQLDBC_DLLEXPORT
01245    void setFetchSize(SQLDBC_Int2 fetchsize);
01246 
01252   SQLDBC_DLLEXPORT
01253   void setRowSetSize (SQLDBC_UInt4 rowsetsize);
01254 
01260   SQLDBC_DLLEXPORT
01261   const SQLDBC_UInt4 getRowSetSize () const;
01262 
01269   SQLDBC_DLLEXPORT
01270   SQLDBC_RowSet *getRowSet ();
01271 
01278   SQLDBC_DLLEXPORT
01279   SQLDBC_UpdatableRowSet *getUpdatableRowSet ();
01280 
01286   SQLDBC_DLLEXPORT
01287   SQLDBC_Statement *getStatement();
01288 
01293   SQLDBC_DLLEXPORT
01294   SQLDBC_Bool isUpdatable();
01295 
01306   SQLDBC_DLLEXPORT
01307   SQLDBC_Retcode first();
01308 
01324   SQLDBC_DLLEXPORT
01325   SQLDBC_Retcode next();
01326 
01336   SQLDBC_DLLEXPORT
01337   SQLDBC_Retcode previous();
01338 
01348   SQLDBC_DLLEXPORT
01349   SQLDBC_Retcode last();
01350 
01379   SQLDBC_DLLEXPORT
01380   SQLDBC_Retcode absolute (int row);
01381 
01403   SQLDBC_DLLEXPORT
01404   SQLDBC_Retcode relative(int relativePos);
01405 
01409   SQLDBC_DLLEXPORT
01410   void close();
01411 
01418   SQLDBC_DLLEXPORT
01419   const SQLDBC_UInt4 getRowNumber() const;
01420 
01472   SQLDBC_DLLEXPORT
01473   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
01474                            const SQLDBC_HostType Type,
01475                            void                 *paramAddr,
01476                            SQLDBC_Length        *LengthIndicator,
01477                            const SQLDBC_Length   Size,
01478                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01479 
01480 
01535   /* #methodmap SQLDBC_ResultSet_getObjectByPos getObject */
01536   SQLDBC_DLLEXPORT
01537   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
01538                            const SQLDBC_HostType Type,
01539                            void                 *paramAddr,
01540                            SQLDBC_Length        *LengthIndicator,
01541                            const SQLDBC_Length   Size,
01542                            SQLDBC_Length         StartPos,
01543                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01544 
01545 private:
01546   friend class SQLDBC_Statement;
01547   friend struct SQLDBC_StatementStorage;
01548 
01552   SQLDBC_ResultSet(SQLDBC_Statement* statement,
01553                    IFR_ResultSet *resultset);
01557   ~SQLDBC_ResultSet();
01558 
01559   SQLDBC_ResultSetStorage *m_cresult;
01560 };
01561 
01562 struct SQLDBC_StatementStorage;
01563 
01638 class SQLDBC_Statement
01639   : public SQLDBC_ConnectionItem
01640 {
01641 public:
01658   SQLDBC_DLLEXPORT
01659   SQLDBC_Retcode execute(const char *sql,
01660                          const SQLDBC_Length sqlLength,
01661                          const SQLDBC_StringEncoding encoding);
01662 
01678   /* #methodmap SQLDBC_Statement_executeNTS execute */
01679   SQLDBC_DLLEXPORT
01680   SQLDBC_Retcode execute(const char *sql,
01681                          const SQLDBC_StringEncoding encoding);
01682 
01695   /* #methodmap SQLDBC_Statement_executeASCII execute */
01696   SQLDBC_DLLEXPORT
01697   SQLDBC_Retcode execute(const char *sql);
01698 
01712   SQLDBC_DLLEXPORT
01713   void setResultSetFetchSize(SQLDBC_Int2 rows);
01714 
01727   SQLDBC_DLLEXPORT
01728   void setMaxRows(SQLDBC_UInt4 rows);
01729 
01738   SQLDBC_DLLEXPORT
01739   const SQLDBC_UInt4 getMaxRows() const;
01740 
01748   SQLDBC_DLLEXPORT
01749   SQLDBC_ResultSet *getResultSet();
01750 
01764   SQLDBC_DLLEXPORT
01765   void setCursorName(const char    *buffer,
01766                      SQLDBC_Length  bufferLength,
01767                      const SQLDBC_StringEncoding encoding);
01768 
01785   SQLDBC_DLLEXPORT
01786     SQLDBC_Retcode setCommandInfo(const char *buffer,
01787                                SQLDBC_Length bufferLength,
01788                                SQLDBC_Int4 lineNumber);
01811   SQLDBC_DLLEXPORT
01812   SQLDBC_Retcode getCursorName(char         *buffer,
01813                                const SQLDBC_StringEncoding encoding,
01814                                const SQLDBC_Length bufferSize,
01815                                SQLDBC_Length *bufferLength) const;
01816 
01832   SQLDBC_DLLEXPORT
01833   SQLDBC_Retcode getTableName(char          *buffer,
01834                               const SQLDBC_StringEncoding encoding,
01835                               const SQLDBC_Length  bufferSize,
01836                               SQLDBC_Length *bufferLength) const;
01837 
01851   SQLDBC_DLLEXPORT
01852   SQLDBC_Bool isQuery() const;
01853 
01863   SQLDBC_DLLEXPORT
01864   const SQLDBC_Int4 getRowsAffected() const;
01865 
01866   enum ResultSetType {
01867     FORWARD_ONLY = 1, 
01868     SCROLL_SENSITIVE = 2, 
01869     SCROLL_INSENSITIVE = 3 
01870   };
01871 
01891   SQLDBC_DLLEXPORT
01892   void setResultSetType (ResultSetType type );
01893 
01906   SQLDBC_DLLEXPORT
01907   const ResultSetType getResultSetType() const;
01908 
01909   enum ConcurrencyType {
01910     CONCUR_UPDATABLE = 10, 
01911     CONCUR_READ_ONLY = 11  
01912   };
01913 
01927   SQLDBC_DLLEXPORT
01928   void setResultSetConcurrencyType (ConcurrencyType type);
01929 
01930   enum HoldabilityType {
01931     CURSOR_HOLD_OVER_COMMIT = 20, 
01932     CURSOR_CLOSE_ON_COMMIT = 21   
01933   };
01934 
01944   SQLDBC_DLLEXPORT
01945   const ConcurrencyType getResultSetConcurrencyType() const;
01946 
01955     SQLDBC_DLLEXPORT
01956     const SQLDBC_Int4 *getRowStatus() const;
01957 
01963     SQLDBC_DLLEXPORT
01964     const SQLDBC_UInt4 getBatchSize() const;
01965 
01976     SQLDBC_DLLEXPORT
01977     const SQLDBC_Retcode addBatch(const char *sql,
01978                                   SQLDBC_Length sqlLength,
01979                                   SQLDBC_StringEncoding encoding);
01980 
01987     /* #methodmap SQLDBC_Statement_addBatchNTS addBatch */
01988     SQLDBC_DLLEXPORT
01989     const SQLDBC_Retcode addBatch(const char *sql,
01990                                   SQLDBC_StringEncoding encoding);
01991 
01998     /* #methodmap SQLDBC_Statement_addBatchASCII addBatch */
01999     SQLDBC_DLLEXPORT
02000     const SQLDBC_Retcode addBatch(const char *sql);
02001 
02008     SQLDBC_DLLEXPORT
02009     const SQLDBC_Retcode executeBatch();
02010 
02014     SQLDBC_DLLEXPORT
02015     void clearBatch();
02016 
02030     SQLDBC_DLLEXPORT
02031    SQLDBC_Retcode getLastInsertedKey(SQLDBC_Int4      tag,
02032                                      SQLDBC_HostType type,
02033                                      void            *paramAddr,
02034                                      SQLDBC_Length   *lengthIndicator,
02035                                      SQLDBC_Length    size,
02036                                      SQLDBC_Bool      terminate=SQLDBC_TRUE);
02037 
02038 
02039 protected:
02043     void clearResultSet();
02044 
02045 
02046 private:
02047   friend class SQLDBC_Connection;
02048   friend class SQLDBC_PreparedStatement;
02054     SQLDBC_Statement(IFR_Statement *stmt);
02059     SQLDBC_Statement(IFR_PreparedStmt *stmt);
02060   ~SQLDBC_Statement();
02061   SQLDBC_StatementStorage *m_cstmt;
02062 };
02063 
02064 struct SQLDBC_PreparedStatementStorage;
02065 
02132 class SQLDBC_PreparedStatement
02133     : public SQLDBC_Statement
02134 {
02135 public:
02144   SQLDBC_DLLEXPORT
02145   SQLDBC_Retcode prepare(const char *sql,
02146                          const SQLDBC_Length sqlLength,
02147                          const SQLDBC_StringEncoding encoding);
02148 
02160     /* #methodmap SQLDBC_PreparedStatement_prepareNTS prepare */
02161   SQLDBC_DLLEXPORT
02162   SQLDBC_Retcode prepare(const char *sql,
02163                          const SQLDBC_StringEncoding encoding);
02164 
02173   /* #methodmap SQLDBC_PreparedStatement_prepareASCII prepare */
02174   SQLDBC_DLLEXPORT
02175   SQLDBC_Retcode prepare(const char *sql);
02176 
02189   /* #methodmap SQLDBC_PreparedStatement_executeASCII execute */
02190 SQLDBC_DLLEXPORT
02191   SQLDBC_Retcode execute();
02192 
02202   SQLDBC_DLLEXPORT
02203   SQLDBC_ParameterMetaData* getParameterMetaData();
02204 
02226   SQLDBC_DLLEXPORT
02227   SQLDBC_ResultSetMetaData* getResultSetMetaData();
02228 
02235   SQLDBC_DLLEXPORT
02236   SQLDBC_Retcode setBatchSize(SQLDBC_UInt4 rowarraysize);
02237 
02249   SQLDBC_DLLEXPORT
02250   SQLDBC_UInt4 getPreferredBatchSize();
02251 
02252 
02262   SQLDBC_DLLEXPORT
02263   SQLDBC_Retcode clearParameters();
02264 
02265 
02304   SQLDBC_DLLEXPORT
02305   SQLDBC_Retcode bindParameter (const SQLDBC_UInt2     Index,
02306                                 const SQLDBC_HostType  Type,
02307                                 void                  *paramAddr,
02308                                 SQLDBC_Length         *LengthIndicator,
02309                                 const SQLDBC_Length    Size,
02310                                 const SQLDBC_Bool      Terminate=SQLDBC_TRUE);
02311 
02354   SQLDBC_DLLEXPORT
02355   SQLDBC_Retcode bindParameterAddr(const SQLDBC_UInt2    Index,
02356                                    const SQLDBC_HostType Type,
02357                                    void                 *paramAddr,
02358                                    SQLDBC_Length        *LengthIndicator,
02359                                    const SQLDBC_Length   Size,
02360                                    const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02361 
02378   SQLDBC_DLLEXPORT
02379   SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
02380 
02401   SQLDBC_DLLEXPORT
02402   SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
02403 
02424    SQLDBC_DLLEXPORT
02425    SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
02426 
02427 
02440   SQLDBC_DLLEXPORT
02441   SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length  *paramLengthIndicator);
02442 
02490   SQLDBC_DLLEXPORT
02491   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02492                            const SQLDBC_HostType Type,
02493                            void                 *paramAddr,
02494                            SQLDBC_Length        *LengthIndicator,
02495                            const SQLDBC_Length   Size,
02496                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02497 
02498 
02549    /* #methodmap SQLDBC_PreparedStatement_getObjectByPos getObject */
02550  SQLDBC_DLLEXPORT
02551   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02552                            const SQLDBC_HostType Type,
02553                            void                 *paramAddr,
02554                            SQLDBC_Length        *LengthIndicator,
02555                            const SQLDBC_Length   Size,
02556                            SQLDBC_Length         StartPos,
02557                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02558 
02559 
02560 private:
02561   friend class SQLDBC_Connection;
02570   SQLDBC_PreparedStatement(IFR_PreparedStmt *stmt);
02571   ~SQLDBC_PreparedStatement();
02572   SQLDBC_PreparedStatementStorage *m_pcstmt;
02573 };
02574 
02728 class SQLDBC_ConnectProperties
02729 {
02730 public:
02735   SQLDBC_DLLEXPORT
02736   SQLDBC_ConnectProperties();
02737 
02742   SQLDBC_DLLEXPORT
02743   SQLDBC_ConnectProperties(const SQLDBC_ConnectProperties& copy);
02744 
02751   SQLDBC_ConnectProperties(SAPDBMem_IRawAllocator& allocator);
02752 
02756   SQLDBC_DLLEXPORT
02757   ~SQLDBC_ConnectProperties();
02758 
02759 
02765   SQLDBC_DLLEXPORT
02766   void setProperty(const char *key, const char *value);
02767 
02774   SQLDBC_DLLEXPORT
02775   const char *getProperty(const char *key, const char *defaultvalue=0) const;
02776 
02777 private:
02778   friend class SQLDBC_Connection;
02779   friend class SQLDBC_Environment;
02780   IFR_ConnectProperties *m_prop;
02781 };
02782 
02783 
02794 class SQLDBC_Connection
02795   : public SQLDBC_ConnectionItem
02796 {
02797 public:
02821   SQLDBC_DLLEXPORT
02822   SQLDBC_Retcode connect(const char *connectURL,
02823                          SQLDBC_Length connectURLLength,
02824                          const char *connectCommand,
02825                          SQLDBC_Length connectCommandLength,
02826                          SQLDBC_StringEncoding connectCommandEncoding,
02827                          SQLDBC_ConnectProperties& connectProperties);
02828 
02850   SQLDBC_DLLEXPORT
02851   SQLDBC_Retcode connect(const char *servernode,
02852                          SQLDBC_Length servernodeLength,
02853                          const char *serverdb,
02854                          SQLDBC_Length serverdbLength,
02855                          const char *username,
02856                          SQLDBC_Length usernameLength,
02857                          const char *password,
02858                          SQLDBC_Length passwordLength,
02859                          const SQLDBC_StringEncoding userpwdEncoding);
02860 
02881   SQLDBC_DLLEXPORT
02882   SQLDBC_Retcode connect(const char *servernode,
02883                          const char *serverdb,
02884                          const char *username,
02885                          const char *password,
02886                          const SQLDBC_StringEncoding userpwdEncoding);
02887 
02902   SQLDBC_DLLEXPORT
02903   SQLDBC_Retcode connect(const char *servernode,
02904                          const char *serverdb,
02905                          const char *username,
02906                          const char *password);
02907 
02939   SQLDBC_DLLEXPORT
02940   SQLDBC_Retcode connect(const char* servernode,
02941                          SQLDBC_Length servernodeLength,
02942                          const char* serverdb,
02943                          SQLDBC_Length serverdbLength,
02944                          const char* username,
02945                          SQLDBC_Length usernameLength,
02946                          const char* password,
02947                          SQLDBC_Length passwordLength,
02948                          const SQLDBC_StringEncoding userpwdEncoding,
02949                          const SQLDBC_ConnectProperties& properties);
02950 
02972    /* #methodmap SQLDBC_Connection_connectNTS connect */
02973   SQLDBC_DLLEXPORT
02974   SQLDBC_Retcode connect(const char* servernode,
02975                          const char* serverdb,
02976                          const char* username,
02977                          const char* password,
02978                          const SQLDBC_StringEncoding userpwdEncoding,
02979                          const SQLDBC_ConnectProperties& properties);
02980 
02996   /* #methodmap SQLDBC_Connection_connectASCII connect */
02997   SQLDBC_DLLEXPORT
02998   SQLDBC_Retcode connect(const char* servernode,
02999                          const char* serverdb,
03000                          const char* username,
03001                          const char* password,
03002                          const SQLDBC_ConnectProperties& properties);
03003 
03004 
03016   SQLDBC_DLLEXPORT
03017   SQLDBC_Retcode connect();
03018 
03031   /* #methodmap SQLDBC_Connection_connectPROP connect */
03032   SQLDBC_DLLEXPORT
03033   SQLDBC_Retcode connect(const SQLDBC_ConnectProperties& properties);
03034 
03035 
03048   SQLDBC_DLLEXPORT
03049   SQLDBC_Statement *createStatement();
03050 
03059   SQLDBC_DLLEXPORT
03060   SQLDBC_PreparedStatement *createPreparedStatement();
03061 
03071   SQLDBC_DLLEXPORT
03072   SQLDBC_Retcode commit();
03073 
03078   SQLDBC_DLLEXPORT
03079   SQLDBC_Retcode rollback();
03080 
03085   SQLDBC_DLLEXPORT
03086   void releaseStatement(SQLDBC_Statement *stmt);
03087 
03092   /* #methodmap SQLDBC_Connection_releasePreparedStatement releaseStatement */
03093   SQLDBC_DLLEXPORT
03094   void releaseStatement(SQLDBC_PreparedStatement *stmt);
03095 
03110   SQLDBC_DLLEXPORT
03111   SQLDBC_Retcode cancel();
03112 
03126   SQLDBC_DLLEXPORT
03127   SQLDBC_Retcode close();
03128 
03129 
03143   SQLDBC_DLLEXPORT
03144   SQLDBC_Retcode commitWorkRelease();
03145 
03146 
03162   SQLDBC_DLLEXPORT
03163   SQLDBC_Retcode disconnect();
03164 
03165 
03171   SQLDBC_DLLEXPORT
03172   void setAutoCommit(SQLDBC_Bool autocommit);
03173 
03180   SQLDBC_DLLEXPORT
03181   SQLDBC_Bool getAutoCommit() const;
03182 
03192   SQLDBC_DLLEXPORT
03193   void setSQLMode(SQLDBC_SQLMode sqlmode);
03194 
03205   SQLDBC_DLLEXPORT
03206   SQLDBC_Retcode setTransactionIsolation(SQLDBC_Int4 isolationlevel);
03207 
03214   SQLDBC_DLLEXPORT
03215   SQLDBC_Int4 getTransactionIsolation() const;
03216 
03224   SQLDBC_DLLEXPORT
03225   SQLDBC_Bool isConnected() const;
03226 
03239   SQLDBC_DLLEXPORT
03240   SQLDBC_Int4 getKernelVersion() const;
03241 
03247   SQLDBC_DLLEXPORT
03248   SQLDBC_Bool isUnicodeDatabase() const;
03249 
03254   SQLDBC_DLLEXPORT
03255   SQLDBC_DateTimeFormat::Format getDateTimeFormat() const;
03256 
03257 private:
03258   friend class SQLDBC_Environment;
03265   SQLDBC_Connection(IFR_Connection *conn);
03266 };
03267 
03272 class SQLDBC_Environment
03273 {
03274 public:
03282   SQLDBC_DLLEXPORT
03283   SQLDBC_Environment(SQLDBC_IRuntime* runtime);
03284 
03288   SQLDBC_DLLEXPORT
03289   ~SQLDBC_Environment();
03290 
03296   SQLDBC_DLLEXPORT
03297   SQLDBC_Connection *createConnection() const;
03298 
03304   SQLDBC_DLLEXPORT
03305   SQLDBC_Connection *createConnection(SAPDBMem_IRawAllocator& allocator) const;
03306 
03312   SQLDBC_DLLEXPORT
03313   void releaseConnection(SQLDBC_Connection *connection) const;
03314 
03328   SQLDBC_DLLEXPORT
03329   const char *getLibraryVersion();
03330 
03340   SQLDBC_DLLEXPORT
03341   inline const char *getSDKVersion()
03342   const
03343   {
03344     return SQLDBCHeaderVersion;
03345   };
03346 
03350     SQLDBC_DLLEXPORT SAPDBMem_IRawAllocator&  getAllocator();
03351 
03352 #ifdef SQLDBC_FEATURE_TRACEOPTION
03353 
03422     SQLDBC_DLLEXPORT
03423     void setTraceOptions(const SQLDBC_ConnectProperties& traceoptions);
03424 
03431     SQLDBC_DLLEXPORT
03432     void getTraceOptions(SQLDBC_ConnectProperties& traceoptions);
03433 #endif
03434 private:
03435     IFR_Environment *m_env;
03436 };
03437 
03447 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03448 
03458 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetSingleThreadClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03459 } /* namespace SQLDBC */
03460 
03461 
03462 #endif