Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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 030-000-DEB-003";
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 
01889   SQLDBC_DLLEXPORT
01890   void setResultSetType (ResultSetType type );
01891 
01901   SQLDBC_DLLEXPORT
01902   const ResultSetType getResultSetType() const;
01903 
01904   enum ConcurrencyType {
01905     CONCUR_UPDATABLE = 10, 
01906     CONCUR_READ_ONLY = 11  
01907   };
01908 
01921   SQLDBC_DLLEXPORT
01922   void setResultSetConcurrencyType (ConcurrencyType type);
01923 
01924   enum HoldabilityType {
01925     CURSOR_HOLD_OVER_COMMIT = 20, 
01926     CURSOR_CLOSE_ON_COMMIT = 21   
01927   };
01928 
01938   SQLDBC_DLLEXPORT
01939   const ConcurrencyType getResultSetConcurrencyType() const;
01940 
01949     SQLDBC_DLLEXPORT
01950     const SQLDBC_Int4 *getRowStatus() const;
01951 
01957     SQLDBC_DLLEXPORT
01958     const SQLDBC_UInt4 getBatchSize() const;
01959 
01970     SQLDBC_DLLEXPORT
01971     const SQLDBC_Retcode addBatch(const char *sql,
01972                                   SQLDBC_Length sqlLength,
01973                                   SQLDBC_StringEncoding encoding);
01974 
01981     /* #methodmap SQLDBC_Statement_addBatchNTS addBatch */
01982     SQLDBC_DLLEXPORT
01983     const SQLDBC_Retcode addBatch(const char *sql,
01984                                   SQLDBC_StringEncoding encoding);
01985 
01992     /* #methodmap SQLDBC_Statement_addBatchASCII addBatch */
01993     SQLDBC_DLLEXPORT
01994     const SQLDBC_Retcode addBatch(const char *sql);
01995 
02002     SQLDBC_DLLEXPORT
02003     const SQLDBC_Retcode executeBatch();
02004 
02008     SQLDBC_DLLEXPORT
02009     void clearBatch();
02010 
02024     SQLDBC_DLLEXPORT
02025    SQLDBC_Retcode getLastInsertedKey(SQLDBC_Int4      tag,
02026                                      SQLDBC_HostType type,
02027                                      void            *paramAddr,
02028                                      SQLDBC_Length   *lengthIndicator,
02029                                      SQLDBC_Length    size,
02030                                      SQLDBC_Bool      terminate=SQLDBC_TRUE);
02031 
02032 
02033 protected:
02037     void clearResultSet();
02038 
02039 
02040 private:
02041   friend class SQLDBC_Connection;
02042   friend class SQLDBC_PreparedStatement;
02048     SQLDBC_Statement(IFR_Statement *stmt);
02053     SQLDBC_Statement(IFR_PreparedStmt *stmt);
02054   ~SQLDBC_Statement();
02055   SQLDBC_StatementStorage *m_cstmt;
02056 };
02057 
02058 struct SQLDBC_PreparedStatementStorage;
02059 
02126 class SQLDBC_PreparedStatement
02127     : public SQLDBC_Statement
02128 {
02129 public:
02138   SQLDBC_DLLEXPORT
02139   SQLDBC_Retcode prepare(const char *sql,
02140                          const SQLDBC_Length sqlLength,
02141                          const SQLDBC_StringEncoding encoding);
02142 
02154     /* #methodmap SQLDBC_PreparedStatement_prepareNTS prepare */
02155   SQLDBC_DLLEXPORT
02156   SQLDBC_Retcode prepare(const char *sql,
02157                          const SQLDBC_StringEncoding encoding);
02158 
02167   /* #methodmap SQLDBC_PreparedStatement_prepareASCII prepare */
02168   SQLDBC_DLLEXPORT
02169   SQLDBC_Retcode prepare(const char *sql);
02170 
02183   /* #methodmap SQLDBC_PreparedStatement_executeASCII execute */
02184 SQLDBC_DLLEXPORT
02185   SQLDBC_Retcode execute();
02186 
02196   SQLDBC_DLLEXPORT
02197   SQLDBC_ParameterMetaData* getParameterMetaData();
02198 
02220   SQLDBC_DLLEXPORT
02221   SQLDBC_ResultSetMetaData* getResultSetMetaData();
02222 
02229   SQLDBC_DLLEXPORT
02230   SQLDBC_Retcode setBatchSize(SQLDBC_UInt4 rowarraysize);
02231 
02243   SQLDBC_DLLEXPORT
02244   SQLDBC_UInt4 getPreferredBatchSize();
02245 
02246 
02256   SQLDBC_DLLEXPORT
02257   SQLDBC_Retcode clearParameters();
02258 
02259 
02298   SQLDBC_DLLEXPORT
02299   SQLDBC_Retcode bindParameter (const SQLDBC_UInt2     Index,
02300                                 const SQLDBC_HostType  Type,
02301                                 void                  *paramAddr,
02302                                 SQLDBC_Length         *LengthIndicator,
02303                                 const SQLDBC_Length    Size,
02304                                 const SQLDBC_Bool      Terminate=SQLDBC_TRUE);
02305 
02348   SQLDBC_DLLEXPORT
02349   SQLDBC_Retcode bindParameterAddr(const SQLDBC_UInt2    Index,
02350                                    const SQLDBC_HostType Type,
02351                                    void                 *paramAddr,
02352                                    SQLDBC_Length        *LengthIndicator,
02353                                    const SQLDBC_Length   Size,
02354                                    const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02355 
02372   SQLDBC_DLLEXPORT
02373   SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
02374 
02395   SQLDBC_DLLEXPORT
02396   SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
02397 
02418    SQLDBC_DLLEXPORT
02419    SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
02420 
02421 
02434   SQLDBC_DLLEXPORT
02435   SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length  *paramLengthIndicator);
02436 
02484   SQLDBC_DLLEXPORT
02485   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02486                            const SQLDBC_HostType Type,
02487                            void                 *paramAddr,
02488                            SQLDBC_Length        *LengthIndicator,
02489                            const SQLDBC_Length   Size,
02490                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02491 
02492 
02543    /* #methodmap SQLDBC_PreparedStatement_getObjectByPos getObject */
02544  SQLDBC_DLLEXPORT
02545   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02546                            const SQLDBC_HostType Type,
02547                            void                 *paramAddr,
02548                            SQLDBC_Length        *LengthIndicator,
02549                            const SQLDBC_Length   Size,
02550                            SQLDBC_Length         StartPos,
02551                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02552 
02553 
02554 private:
02555   friend class SQLDBC_Connection;
02564   SQLDBC_PreparedStatement(IFR_PreparedStmt *stmt);
02565   ~SQLDBC_PreparedStatement();
02566   SQLDBC_PreparedStatementStorage *m_pcstmt;
02567 };
02568 
02722 class SQLDBC_ConnectProperties
02723 {
02724 public:
02729   SQLDBC_DLLEXPORT
02730   SQLDBC_ConnectProperties();
02731 
02736   SQLDBC_DLLEXPORT
02737   SQLDBC_ConnectProperties(const SQLDBC_ConnectProperties& copy);
02738 
02745   SQLDBC_ConnectProperties(SAPDBMem_IRawAllocator& allocator);
02746 
02750   SQLDBC_DLLEXPORT
02751   ~SQLDBC_ConnectProperties();
02752 
02753 
02759   SQLDBC_DLLEXPORT
02760   void setProperty(const char *key, const char *value);
02761 
02768   SQLDBC_DLLEXPORT
02769   const char *getProperty(const char *key, const char *defaultvalue=0) const;
02770 
02771 private:
02772   friend class SQLDBC_Connection;
02773   friend class SQLDBC_Environment;
02774   IFR_ConnectProperties *m_prop;
02775 };
02776 
02777 
02788 class SQLDBC_Connection
02789   : public SQLDBC_ConnectionItem
02790 {
02791 public:
02815   SQLDBC_DLLEXPORT
02816   SQLDBC_Retcode connect(const char *connectURL,
02817                          SQLDBC_Length connectURLLength,
02818                          const char *connectCommand,
02819                          SQLDBC_Length connectCommandLength,
02820                          SQLDBC_StringEncoding connectCommandEncoding,
02821                          SQLDBC_ConnectProperties& connectProperties);
02822 
02844   SQLDBC_DLLEXPORT
02845   SQLDBC_Retcode connect(const char *servernode,
02846                          SQLDBC_Length servernodeLength,
02847                          const char *serverdb,
02848                          SQLDBC_Length serverdbLength,
02849                          const char *username,
02850                          SQLDBC_Length usernameLength,
02851                          const char *password,
02852                          SQLDBC_Length passwordLength,
02853                          const SQLDBC_StringEncoding userpwdEncoding);
02854 
02875   SQLDBC_DLLEXPORT
02876   SQLDBC_Retcode connect(const char *servernode,
02877                          const char *serverdb,
02878                          const char *username,
02879                          const char *password,
02880                          const SQLDBC_StringEncoding userpwdEncoding);
02881 
02896   SQLDBC_DLLEXPORT
02897   SQLDBC_Retcode connect(const char *servernode,
02898                          const char *serverdb,
02899                          const char *username,
02900                          const char *password);
02901 
02933   SQLDBC_DLLEXPORT
02934   SQLDBC_Retcode connect(const char* servernode,
02935                          SQLDBC_Length servernodeLength,
02936                          const char* serverdb,
02937                          SQLDBC_Length serverdbLength,
02938                          const char* username,
02939                          SQLDBC_Length usernameLength,
02940                          const char* password,
02941                          SQLDBC_Length passwordLength,
02942                          const SQLDBC_StringEncoding userpwdEncoding,
02943                          const SQLDBC_ConnectProperties& properties);
02944 
02966    /* #methodmap SQLDBC_Connection_connectNTS connect */
02967   SQLDBC_DLLEXPORT
02968   SQLDBC_Retcode connect(const char* servernode,
02969                          const char* serverdb,
02970                          const char* username,
02971                          const char* password,
02972                          const SQLDBC_StringEncoding userpwdEncoding,
02973                          const SQLDBC_ConnectProperties& properties);
02974 
02990   /* #methodmap SQLDBC_Connection_connectASCII connect */
02991   SQLDBC_DLLEXPORT
02992   SQLDBC_Retcode connect(const char* servernode,
02993                          const char* serverdb,
02994                          const char* username,
02995                          const char* password,
02996                          const SQLDBC_ConnectProperties& properties);
02997 
02998 
03010   SQLDBC_DLLEXPORT
03011   SQLDBC_Retcode connect();
03012 
03025   /* #methodmap SQLDBC_Connection_connectPROP connect */
03026   SQLDBC_DLLEXPORT
03027   SQLDBC_Retcode connect(const SQLDBC_ConnectProperties& properties);
03028 
03029 
03042   SQLDBC_DLLEXPORT
03043   SQLDBC_Statement *createStatement();
03044 
03053   SQLDBC_DLLEXPORT
03054   SQLDBC_PreparedStatement *createPreparedStatement();
03055 
03065   SQLDBC_DLLEXPORT
03066   SQLDBC_Retcode commit();
03067 
03072   SQLDBC_DLLEXPORT
03073   SQLDBC_Retcode rollback();
03074 
03079   SQLDBC_DLLEXPORT
03080   void releaseStatement(SQLDBC_Statement *stmt);
03081 
03086   /* #methodmap SQLDBC_Connection_releasePreparedStatement releaseStatement */
03087   SQLDBC_DLLEXPORT
03088   void releaseStatement(SQLDBC_PreparedStatement *stmt);
03089 
03104   SQLDBC_DLLEXPORT
03105   SQLDBC_Retcode cancel();
03106 
03120   SQLDBC_DLLEXPORT
03121   SQLDBC_Retcode close();
03122 
03123 
03137   SQLDBC_DLLEXPORT
03138   SQLDBC_Retcode commitWorkRelease();
03139 
03140 
03156   SQLDBC_DLLEXPORT
03157   SQLDBC_Retcode disconnect();
03158 
03159 
03165   SQLDBC_DLLEXPORT
03166   void setAutoCommit(SQLDBC_Bool autocommit);
03167 
03174   SQLDBC_DLLEXPORT
03175   SQLDBC_Bool getAutoCommit() const;
03176 
03186   SQLDBC_DLLEXPORT
03187   void setSQLMode(SQLDBC_SQLMode sqlmode);
03188 
03199   SQLDBC_DLLEXPORT
03200   SQLDBC_Retcode setTransactionIsolation(SQLDBC_Int4 isolationlevel);
03201 
03208   SQLDBC_DLLEXPORT
03209   SQLDBC_Int4 getTransactionIsolation() const;
03210 
03218   SQLDBC_DLLEXPORT
03219   SQLDBC_Bool isConnected() const;
03220 
03233   SQLDBC_DLLEXPORT
03234   SQLDBC_Int4 getKernelVersion() const;
03235 
03241   SQLDBC_DLLEXPORT
03242   SQLDBC_Bool isUnicodeDatabase() const;
03243 
03248   SQLDBC_DLLEXPORT
03249   SQLDBC_DateTimeFormat::Format getDateTimeFormat() const;
03250 
03251 private:
03252   friend class SQLDBC_Environment;
03259   SQLDBC_Connection(IFR_Connection *conn);
03260 };
03261 
03266 class SQLDBC_Environment
03267 {
03268 public:
03276   SQLDBC_DLLEXPORT
03277   SQLDBC_Environment(SQLDBC_IRuntime* runtime);
03278 
03282   SQLDBC_DLLEXPORT
03283   ~SQLDBC_Environment();
03284 
03290   SQLDBC_DLLEXPORT
03291   SQLDBC_Connection *createConnection() const;
03292 
03298   SQLDBC_DLLEXPORT
03299   SQLDBC_Connection *createConnection(SAPDBMem_IRawAllocator& allocator) const;
03300 
03306   SQLDBC_DLLEXPORT
03307   void releaseConnection(SQLDBC_Connection *connection) const;
03308 
03322   SQLDBC_DLLEXPORT
03323   const char *getLibraryVersion();
03324 
03334   SQLDBC_DLLEXPORT
03335   inline const char *getSDKVersion()
03336   const
03337   {
03338     return SQLDBCHeaderVersion;
03339   };
03340 
03344     SQLDBC_DLLEXPORT SAPDBMem_IRawAllocator&  getAllocator();
03345 
03346 #ifdef SQLDBC_FEATURE_TRACEOPTION
03347 
03416     SQLDBC_DLLEXPORT
03417     void setTraceOptions(const SQLDBC_ConnectProperties& traceoptions);
03418 
03425     SQLDBC_DLLEXPORT
03426     void getTraceOptions(SQLDBC_ConnectProperties& traceoptions);
03427 #endif
03428 private:
03429     IFR_Environment *m_env;
03430 };
03431 
03441 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03442 
03452 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetSingleThreadClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03453 } /* namespace SQLDBC */
03454 
03455 
03456 #endif