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 
00034 #ifndef SQLDBC_H
00035 #define SQLDBC_H
00036 
00043 #ifdef  SQLDBC_FEATURE_TRACEOPTION_OFF
00044 #undef  SQLDBC_FEATURE_TRACEOPTION
00045 #else
00046 #define SQLDBC_FEATURE_TRACEOPTION
00047 #endif
00048 
00049 #include "SQLDBC_Types.h" /* no check */
00050 
00051 class IFR_Environment;
00052 class IFR_Connection;
00053 class IFR_ConnectProperties;
00054 class IFR_ConnectionItem;
00055 class IFR_ErrorHndl;
00056 class IFR_Statement;
00057 class IFR_PreparedStmt;
00058 class IFR_SQLWarning;
00059 class IFR_ResultSet;
00060 class IFR_RowSet;
00061 class IFR_ParameterMetaData;
00062 class IFR_ResultSetMetaData;
00063 class IFR_LOB;
00064 class SAPDBMem_IRawAllocator;
00065 
00069 static const char* SQLDBCHeaderVersion = "SQLDBC.H  7.5.0    BUILD 024-000-000-000";
00070 /*
00071    type maps used by the script genSQLDBC_C.pl for gerating a SQLDBC C-wrapper.
00072    #typemap  SQLDBC_StringEncodingType_Encoding SQLDBC_StringEncoding
00073    #typemap  ParameterMode SQLDBC_ParameterMetaData::ParameterMode
00074    #typemap  ParameterNullBehavior SQLDBC_ParameterMetaData::ParameterNullBehavior
00075    #typemap  ColumnNullBehavior SQLDBC_ResultSetMetaData::ColumnNullBehavior
00076    #typemap  SQLDBC_Statement_ResultSetType SQLDBC_Statement::ResultSetType
00077    #typemap  SQLDBC_Statement_ConcurrencyType SQLDBC_Statement::ConcurrencyType
00078 */
00079 
00080 class SQLDBC_IRuntime;
00081 
00082 #ifdef WIN32
00083 #define SQLDBC_DLLEXPORT __declspec(dllexport)
00084 #else
00085 #define SQLDBC_DLLEXPORT
00086 #endif
00087 
00088 namespace SQLDBC {
00089 class SQLDBC_Statement;
00090 class SQLDBC_ConnectProperties;
00091 
00095 class SQLDBC_ErrorHndl
00096 {
00097 public:
00103   SQLDBC_DLLEXPORT
00104   SQLDBC_ErrorHndl();
00105 
00109   SQLDBC_DLLEXPORT
00110   const SQLDBC_Int4 getErrorCode() const;
00111 
00115   SQLDBC_DLLEXPORT
00116   const char* getSQLState() const;
00117 
00122   SQLDBC_DLLEXPORT
00123   const char *getErrorText() const;
00124 
00132   SQLDBC_DLLEXPORT
00133   operator SQLDBC_Bool () const;
00134 
00135 private:
00136   friend class SQLDBC_ConnectionItem;
00137   friend struct SQLDBC_ConnectionItemStorage;
00138   friend class SQLDBC_Connection;
00139 
00145   SQLDBC_ErrorHndl(IFR_ErrorHndl* error);
00146 
00151   void setMemoryAllocationFailed();
00152 
00153 
00157   IFR_ErrorHndl *m_error;
00158 };
00159 
00168 class SQLDBC_SQLWarning
00169 {
00170 public:
00175   SQLDBC_DLLEXPORT
00176   SQLDBC_SQLWarning* getNextWarning() const;
00177 
00181   SQLDBC_DLLEXPORT
00182   SQLDBC_SQLWarningCode getWarningCode() const;
00183 
00184 private:
00185   friend class SQLDBC_ConnectionItem;
00186   friend struct SQLDBC_ConnectionItemStorage;
00192   SQLDBC_SQLWarning(IFR_SQLWarning* warning);
00193   IFR_SQLWarning    *m_warning;
00194 };
00195 
00196 struct SQLDBC_ConnectionItemStorage;
00197 
00208 class SQLDBC_ConnectionItem
00209 {
00210 public:
00211 
00221     SQLDBC_DLLEXPORT
00222     SQLDBC_ErrorHndl &error();
00223 
00227     SQLDBC_DLLEXPORT
00228     void clearError();
00229 
00238     SQLDBC_DLLEXPORT
00239     SQLDBC_SQLWarning* warning();
00240 
00244     SQLDBC_DLLEXPORT
00245     void clearWarnings();
00246 
00247 private:
00248     friend class SQLDBC_Environment;
00249     friend class SQLDBC_Connection;
00250     friend class SQLDBC_Statement;
00251     friend class SQLDBC_PreparedStatement;
00252     friend class SQLDBC_ResultSet;
00253     friend class SQLDBC_RowSet;
00254     friend class SQLDBC_UpdatableRowSet;
00255 
00256     SQLDBC_ConnectionItem(IFR_ConnectionItem *item);
00257 
00258     ~SQLDBC_ConnectionItem();
00259 
00260     SQLDBC_ConnectionItemStorage *m_citem;
00261 };
00262 
00268 class SQLDBC_LOB
00269 {
00270 public:
00282     SQLDBC_DLLEXPORT SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length  *paramLengthIndicator);
00283 
00287     SQLDBC_DLLEXPORT SQLDBC_Retcode close();
00288 
00289 
00326     SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void                 *paramAddr,
00327                                             SQLDBC_Length        *LengthIndicator,
00328                                             const SQLDBC_Length   Size,
00329                                             const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00330 
00370     /* #methodmap SQLDBC_LOB_getDataByPos getData */
00371     SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void                 *paramAddr,
00372                                             SQLDBC_Length        *LengthIndicator,
00373                                             const SQLDBC_Length   Size,
00374                                             const SQLDBC_Length   position,
00375                                             const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00376 
00384     SQLDBC_DLLEXPORT SQLDBC_Length getLength();
00385 
00391     SQLDBC_DLLEXPORT SQLDBC_Length getPosition();
00392 
00393 
00403     SQLDBC_DLLEXPORT SQLDBC_Length getPreferredDataSize();
00404 
00405 private:
00406     IFR_LOB                  *m_lobdata;
00407     IFR_ConnectionItem       *m_citem;
00408 };
00409 
00414 class SQLDBC_ParameterMetaData
00415 {
00416 public:
00417 
00418 #ifndef __cplusplus
00419 typedef
00420 #endif
00421   enum ParameterNullBehavior {
00425     parameterNoNulls = 0,
00426 
00430     parameterNullable = 1,
00431 
00435     parameterNullableUnknown = 2
00436   }
00437 #ifndef __cplusplus
00438 ParameterNullBehavior
00439 #endif
00440 ;
00441 
00442 #ifndef __cplusplus
00443 typedef
00444 #endif
00445   enum ParameterMode {
00446 
00450     parameterModeUnknown = 0,
00451 
00455     parameterModeIn = 1,
00456 
00460     parameterModeInOut = 2,
00461 
00465     parameterModeOut = 4
00466   }
00467 #ifndef __cplusplus
00468 ParameterMode
00469 #endif
00470 ;
00471 
00478   SQLDBC_DLLEXPORT
00479   SQLDBC_Int2 getParameterCount();
00480 
00498   SQLDBC_DLLEXPORT
00499   SQLDBC_Retcode getParameterName(SQLDBC_Int2    param,
00500                                   char *buffer,
00501                                   const SQLDBC_StringEncoding encoding,
00502                                   const SQLDBC_Length  bufferSize,
00503                                   SQLDBC_Length *bufferLength) const;
00504 
00511   SQLDBC_DLLEXPORT
00512   SQLDBC_SQLType getParameterType(SQLDBC_Int2 param);
00513 
00524   SQLDBC_DLLEXPORT
00525   ParameterMode getParameterMode(SQLDBC_Int2 param);
00526 
00537   SQLDBC_DLLEXPORT
00538   SQLDBC_Int4 getParameterLength(SQLDBC_Int2 param);
00539 
00554   SQLDBC_DLLEXPORT
00555   SQLDBC_Int4 getPrecision(SQLDBC_Int2 param);
00556 
00569   SQLDBC_DLLEXPORT
00570   SQLDBC_Int4 getScale(SQLDBC_Int2 param);
00571 
00582   SQLDBC_DLLEXPORT
00583   SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 param);
00584 
00596   SQLDBC_DLLEXPORT
00597   ParameterNullBehavior isNullable(SQLDBC_Int2 param);
00598 
00599 private:
00600   friend class SQLDBC_PreparedStatement;
00601   friend struct SQLDBC_PreparedStatementStorage;
00602   SQLDBC_ParameterMetaData(IFR_ParameterMetaData *metadata);
00603   IFR_ParameterMetaData *m_metadata;
00604 };
00605 
00610 class SQLDBC_ResultSetMetaData
00611 {
00612 public:
00613 #ifndef __cplusplus
00614 typedef
00615 #endif
00616   enum ColumnNullBehavior {
00620     columnNoNulls = 0,
00621 
00625     columnNullable = 1,
00626 
00630     columnNullableUnknown = 2
00631   }
00632 #ifndef __cplusplus
00633 ColumnNullBehavior
00634 #endif
00635 ;
00641   SQLDBC_DLLEXPORT
00642   SQLDBC_Int2 getColumnCount();
00643 
00663   SQLDBC_DLLEXPORT
00664   SQLDBC_Retcode getColumnName(SQLDBC_Int2 column,
00665                                  char *buffer,
00666                                  const SQLDBC_StringEncoding encoding,
00667                                  const SQLDBC_Length  bufferSize,
00668                                  SQLDBC_Length *bufferLength) const;
00669 
00670 
00679   SQLDBC_DLLEXPORT
00680   SQLDBC_SQLType getColumnType(SQLDBC_Int2 column);
00681 
00690   SQLDBC_DLLEXPORT
00691   SQLDBC_Int4 getColumnLength(SQLDBC_Int2 column);
00692 
00706   SQLDBC_DLLEXPORT
00707   SQLDBC_Int4 getPrecision(SQLDBC_Int2 column);
00708 
00721   SQLDBC_DLLEXPORT
00722   SQLDBC_Int4 getScale(SQLDBC_Int2 column);
00723 
00733   SQLDBC_DLLEXPORT
00734   SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 column);
00735 
00746   SQLDBC_DLLEXPORT
00747   ColumnNullBehavior isNullable(SQLDBC_Int2 column);
00748 
00758   SQLDBC_DLLEXPORT
00759   SQLDBC_Bool isWritable(SQLDBC_Int2 column);
00760 
00761 private:
00762   friend class SQLDBC_PreparedStatement;
00763   friend class SQLDBC_ResultSet;
00764   friend struct SQLDBC_ResultSetStorage;
00765   friend struct SQLDBC_PreparedStatementStorage;
00766   SQLDBC_ResultSetMetaData(IFR_ResultSetMetaData *metadata);
00767   IFR_ResultSetMetaData *m_metadata;
00768 };
00769 
00781 class SQLDBC_RowSet
00782   : public SQLDBC_ConnectionItem
00783 {
00784 public:
00785 
00795   SQLDBC_DLLEXPORT
00796   SQLDBC_Retcode setPos(SQLDBC_UInt4 pos);
00797 
00804   SQLDBC_DLLEXPORT
00805   SQLDBC_Retcode fetch();
00806 
00813   SQLDBC_DLLEXPORT
00814   const SQLDBC_Int4 getRowsAffected() const;
00815 
00827   SQLDBC_DLLEXPORT
00828   const SQLDBC_Int4 *getRowStatus() const;
00829 
00881   SQLDBC_DLLEXPORT
00882   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
00883                            const SQLDBC_HostType Type,
00884                            void                 *paramAddr,
00885                            SQLDBC_Length        *LengthIndicator,
00886                            const SQLDBC_Length   Size,
00887                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00888 
00943   /* #methodmap SQLDBC_RowSet_getObjectByPos getObject */
00944   SQLDBC_DLLEXPORT
00945   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
00946                            const SQLDBC_HostType Type,
00947                            void                 *paramAddr,
00948                            SQLDBC_Length        *LengthIndicator,
00949                            const SQLDBC_Length   Size,
00950                            SQLDBC_Length         StartPos,
00951                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
00952 
00953 protected:
00954   friend class SQLDBC_ResultSet;
00955   friend struct SQLDBC_ResultSetStorage;
00956   SQLDBC_RowSet(IFR_ResultSet *resultset);
00957 };
00958 
00970 class SQLDBC_UpdatableRowSet
00971   : public SQLDBC_RowSet
00972 {
00973 public:
00974 
00982   SQLDBC_DLLEXPORT
00983   SQLDBC_Retcode insertAllRows();
00984 
00990   SQLDBC_DLLEXPORT
00991   SQLDBC_Retcode insertOneRow();
00992 
01001   SQLDBC_DLLEXPORT
01002   SQLDBC_Retcode updateRow(int position);
01003 
01011   SQLDBC_DLLEXPORT
01012   SQLDBC_Retcode deleteRow(int position);
01013 
01014 private:
01015   friend struct SQLDBC_ResultSetStorage;
01016   SQLDBC_UpdatableRowSet(IFR_ResultSet *resultset);
01017 };
01018 
01019 struct SQLDBC_ResultSetStorage;
01020 
01104 class SQLDBC_ResultSet
01105   : public SQLDBC_ConnectionItem
01106 {
01107 public:
01108 
01117   SQLDBC_DLLEXPORT
01118   SQLDBC_ResultSetMetaData* getResultSetMetaData();
01119 
01124   SQLDBC_DLLEXPORT
01125   const SQLDBC_Int4 getResultCount () const;
01126 
01166   SQLDBC_DLLEXPORT
01167   SQLDBC_Retcode bindColumn (const SQLDBC_UInt4    Index,
01168                              const SQLDBC_HostType Type,
01169                              void                 *paramAddr,
01170                              SQLDBC_Length        *LengthIndicator,
01171                              const SQLDBC_Length   Size,
01172                              const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01173 
01215   /* #methodmap SQLDBC_ResultSet_bindColumnByPos bindColumn */
01216   SQLDBC_DLLEXPORT
01217   SQLDBC_Retcode bindColumn (const SQLDBC_UInt4    Index,
01218                              const SQLDBC_HostType Type,
01219                              void                 *paramAddr,
01220                              SQLDBC_Length        *LengthIndicator,
01221                              SQLDBC_Length        *PositionIndicator,
01222                              const SQLDBC_Length   Size,
01223                              const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01224 
01231   SQLDBC_DLLEXPORT
01232   SQLDBC_Retcode clearColumns();
01233 
01243    SQLDBC_DLLEXPORT
01244    void setFetchSize(SQLDBC_Int2 fetchsize);
01245 
01251   SQLDBC_DLLEXPORT
01252   void setRowSetSize (SQLDBC_UInt4 rowsetsize);
01253 
01259   SQLDBC_DLLEXPORT
01260   const SQLDBC_UInt4 getRowSetSize () const;
01261 
01268   SQLDBC_DLLEXPORT
01269   SQLDBC_RowSet *getRowSet ();
01270 
01277   SQLDBC_DLLEXPORT
01278   SQLDBC_UpdatableRowSet *getUpdatableRowSet ();
01279 
01285   SQLDBC_DLLEXPORT
01286   SQLDBC_Statement *getStatement();
01287 
01292   SQLDBC_DLLEXPORT
01293   SQLDBC_Bool isUpdatable();
01294 
01305   SQLDBC_DLLEXPORT
01306   SQLDBC_Retcode first();
01307 
01323   SQLDBC_DLLEXPORT
01324   SQLDBC_Retcode next();
01325 
01335   SQLDBC_DLLEXPORT
01336   SQLDBC_Retcode previous();
01337 
01347   SQLDBC_DLLEXPORT
01348   SQLDBC_Retcode last();
01349 
01378   SQLDBC_DLLEXPORT
01379   SQLDBC_Retcode absolute (int row);
01380 
01402   SQLDBC_DLLEXPORT
01403   SQLDBC_Retcode relative(int relativePos);
01404 
01408   SQLDBC_DLLEXPORT
01409   void close();
01410 
01417   SQLDBC_DLLEXPORT
01418   const SQLDBC_UInt4 getRowNumber() const;
01419 
01471   SQLDBC_DLLEXPORT
01472   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
01473                            const SQLDBC_HostType Type,
01474                            void                 *paramAddr,
01475                            SQLDBC_Length        *LengthIndicator,
01476                            const SQLDBC_Length   Size,
01477                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01478 
01479 
01534   /* #methodmap SQLDBC_ResultSet_getObjectByPos getObject */
01535   SQLDBC_DLLEXPORT
01536   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
01537                            const SQLDBC_HostType Type,
01538                            void                 *paramAddr,
01539                            SQLDBC_Length        *LengthIndicator,
01540                            const SQLDBC_Length   Size,
01541                            SQLDBC_Length         StartPos,
01542                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
01543 
01544 private:
01545   friend class SQLDBC_Statement;
01546   friend struct SQLDBC_StatementStorage;
01547 
01551   SQLDBC_ResultSet(SQLDBC_Statement* statement,
01552                    IFR_ResultSet *resultset);
01556   ~SQLDBC_ResultSet();
01557 
01558   SQLDBC_ResultSetStorage *m_cresult;
01559 };
01560 
01561 struct SQLDBC_StatementStorage;
01562 
01637 class SQLDBC_Statement
01638   : public SQLDBC_ConnectionItem
01639 {
01640 public:
01657   SQLDBC_DLLEXPORT
01658   SQLDBC_Retcode execute(const char *sql,
01659                          const SQLDBC_Length sqlLength,
01660                          const SQLDBC_StringEncoding encoding);
01661 
01677   /* #methodmap SQLDBC_Statement_executeNTS execute */
01678   SQLDBC_DLLEXPORT
01679   SQLDBC_Retcode execute(const char *sql,
01680                          const SQLDBC_StringEncoding encoding);
01681 
01694   /* #methodmap SQLDBC_Statement_executeASCII execute */
01695   SQLDBC_DLLEXPORT
01696   SQLDBC_Retcode execute(const char *sql);
01697 
01711   SQLDBC_DLLEXPORT
01712   void setResultSetFetchSize(SQLDBC_Int2 rows);
01713 
01726   SQLDBC_DLLEXPORT
01727   void setMaxRows(SQLDBC_UInt4 rows);
01728 
01737   SQLDBC_DLLEXPORT
01738   const SQLDBC_UInt4 getMaxRows() const;
01739 
01747   SQLDBC_DLLEXPORT
01748   SQLDBC_ResultSet *getResultSet();
01749 
01763   SQLDBC_DLLEXPORT
01764   void setCursorName(const char    *buffer,
01765                      SQLDBC_Length  bufferLength,
01766                      const SQLDBC_StringEncoding encoding);
01767 
01784   SQLDBC_DLLEXPORT
01785     SQLDBC_Retcode setCommandInfo(const char *buffer,
01786                                SQLDBC_Length bufferLength,
01787                                SQLDBC_Int4 lineNumber);
01810   SQLDBC_DLLEXPORT
01811   SQLDBC_Retcode getCursorName(char         *buffer,
01812                                const SQLDBC_StringEncoding encoding,
01813                                const SQLDBC_Length bufferSize,
01814                                SQLDBC_Length *bufferLength) const;
01815 
01831   SQLDBC_DLLEXPORT
01832   SQLDBC_Retcode getTableName(char          *buffer,
01833                               const SQLDBC_StringEncoding encoding,
01834                               const SQLDBC_Length  bufferSize,
01835                               SQLDBC_Length *bufferLength) const;
01836 
01850   SQLDBC_DLLEXPORT
01851   SQLDBC_Bool isQuery() const;
01852 
01862   SQLDBC_DLLEXPORT
01863   const SQLDBC_Int4 getRowsAffected() const;
01864 
01865   enum ResultSetType {
01866     FORWARD_ONLY = 1, 
01867     SCROLL_SENSITIVE = 2, 
01868     SCROLL_INSENSITIVE = 3 
01869   };
01870 
01888   SQLDBC_DLLEXPORT
01889   void setResultSetType (ResultSetType type );
01890 
01900   SQLDBC_DLLEXPORT
01901   const ResultSetType getResultSetType() const;
01902 
01903   enum ConcurrencyType {
01904     CONCUR_UPDATABLE = 10, 
01905     CONCUR_READ_ONLY = 11  
01906   };
01907 
01920   SQLDBC_DLLEXPORT
01921   void setResultSetConcurrencyType (ConcurrencyType type);
01922 
01923   enum HoldabilityType {
01924     CURSOR_HOLD_OVER_COMMIT = 20, 
01925     CURSOR_CLOSE_ON_COMMIT = 21   
01926   };
01927 
01937   SQLDBC_DLLEXPORT
01938   const ConcurrencyType getResultSetConcurrencyType() const;
01939 
01948     SQLDBC_DLLEXPORT
01949     const SQLDBC_Int4 *getRowStatus() const;
01950 
01956     SQLDBC_DLLEXPORT
01957     const SQLDBC_UInt4 getBatchSize() const;
01958 
01969     SQLDBC_DLLEXPORT
01970     const SQLDBC_Retcode addBatch(const char *sql,
01971                                   SQLDBC_Length sqlLength,
01972                                   SQLDBC_StringEncoding encoding);
01973 
01980     /* #methodmap SQLDBC_Statement_addBatchNTS addBatch */
01981     SQLDBC_DLLEXPORT
01982     const SQLDBC_Retcode addBatch(const char *sql,
01983                                   SQLDBC_StringEncoding encoding);
01984 
01991     /* #methodmap SQLDBC_Statement_addBatchASCII addBatch */
01992     SQLDBC_DLLEXPORT
01993     const SQLDBC_Retcode addBatch(const char *sql);
01994 
02001     SQLDBC_DLLEXPORT
02002     const SQLDBC_Retcode executeBatch();
02003 
02007     SQLDBC_DLLEXPORT
02008     void clearBatch();
02009 
02023     SQLDBC_DLLEXPORT
02024    SQLDBC_Retcode getLastInsertedKey(SQLDBC_Int4      tag,
02025                                      SQLDBC_HostType type,
02026                                      void            *paramAddr,
02027                                      SQLDBC_Length   *lengthIndicator,
02028                                      SQLDBC_Length    size,
02029                                      SQLDBC_Bool      terminate=SQLDBC_TRUE);
02030 
02031 
02032 protected:
02036     void clearResultSet();
02037 
02038 
02039 private:
02040   friend class SQLDBC_Connection;
02041   friend class SQLDBC_PreparedStatement;
02047     SQLDBC_Statement(IFR_Statement *stmt);
02052     SQLDBC_Statement(IFR_PreparedStmt *stmt);
02053   ~SQLDBC_Statement();
02054   SQLDBC_StatementStorage *m_cstmt;
02055 };
02056 
02057 struct SQLDBC_PreparedStatementStorage;
02058 
02125 class SQLDBC_PreparedStatement
02126     : public SQLDBC_Statement
02127 {
02128 public:
02137   SQLDBC_DLLEXPORT
02138   SQLDBC_Retcode prepare(const char *sql,
02139                          const SQLDBC_Length sqlLength,
02140                          const SQLDBC_StringEncoding encoding);
02141 
02153     /* #methodmap SQLDBC_PreparedStatement_prepareNTS prepare */
02154   SQLDBC_DLLEXPORT
02155   SQLDBC_Retcode prepare(const char *sql,
02156                          const SQLDBC_StringEncoding encoding);
02157 
02166   /* #methodmap SQLDBC_PreparedStatement_prepareASCII prepare */
02167   SQLDBC_DLLEXPORT
02168   SQLDBC_Retcode prepare(const char *sql);
02169 
02182   /* #methodmap SQLDBC_PreparedStatement_executeASCII execute */
02183 SQLDBC_DLLEXPORT
02184   SQLDBC_Retcode execute();
02185 
02195   SQLDBC_DLLEXPORT
02196   SQLDBC_ParameterMetaData* getParameterMetaData();
02197 
02219   SQLDBC_DLLEXPORT
02220   SQLDBC_ResultSetMetaData* getResultSetMetaData();
02221 
02228   SQLDBC_DLLEXPORT
02229   SQLDBC_Retcode setBatchSize(SQLDBC_UInt4 rowarraysize);
02230 
02242   SQLDBC_DLLEXPORT
02243   SQLDBC_UInt4 getPreferredBatchSize();
02244 
02245 
02255   SQLDBC_DLLEXPORT
02256   SQLDBC_Retcode clearParameters();
02257 
02258 
02297   SQLDBC_DLLEXPORT
02298   SQLDBC_Retcode bindParameter (const SQLDBC_UInt2     Index,
02299                                 const SQLDBC_HostType  Type,
02300                                 void                  *paramAddr,
02301                                 SQLDBC_Length         *LengthIndicator,
02302                                 const SQLDBC_Length    Size,
02303                                 const SQLDBC_Bool      Terminate=SQLDBC_TRUE);
02304 
02347   SQLDBC_DLLEXPORT
02348   SQLDBC_Retcode bindParameterAddr(const SQLDBC_UInt2    Index,
02349                                    const SQLDBC_HostType Type,
02350                                    void                 *paramAddr,
02351                                    SQLDBC_Length        *LengthIndicator,
02352                                    const SQLDBC_Length   Size,
02353                                    const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02354 
02371   SQLDBC_DLLEXPORT
02372   SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
02373 
02394   SQLDBC_DLLEXPORT
02395   SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
02396 
02417    SQLDBC_DLLEXPORT
02418    SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
02419 
02420 
02433   SQLDBC_DLLEXPORT
02434   SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length  *paramLengthIndicator);
02435 
02483   SQLDBC_DLLEXPORT
02484   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02485                            const SQLDBC_HostType Type,
02486                            void                 *paramAddr,
02487                            SQLDBC_Length        *LengthIndicator,
02488                            const SQLDBC_Length   Size,
02489                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02490 
02491 
02542    /* #methodmap SQLDBC_PreparedStatement_getObjectByPos getObject */
02543  SQLDBC_DLLEXPORT
02544   SQLDBC_Retcode getObject(const SQLDBC_Int4     Index,
02545                            const SQLDBC_HostType Type,
02546                            void                 *paramAddr,
02547                            SQLDBC_Length        *LengthIndicator,
02548                            const SQLDBC_Length   Size,
02549                            SQLDBC_Length         StartPos,
02550                            const SQLDBC_Bool     Terminate=SQLDBC_TRUE);
02551 
02552 
02553 private:
02554   friend class SQLDBC_Connection;
02563   SQLDBC_PreparedStatement(IFR_PreparedStmt *stmt);
02564   ~SQLDBC_PreparedStatement();
02565   SQLDBC_PreparedStatementStorage *m_pcstmt;
02566 };
02567 
02645 class SQLDBC_ConnectProperties
02646 {
02647 public:
02652   SQLDBC_DLLEXPORT
02653   SQLDBC_ConnectProperties();
02654 
02659   SQLDBC_DLLEXPORT
02660   SQLDBC_ConnectProperties(const SQLDBC_ConnectProperties& copy);
02661 
02668   SQLDBC_ConnectProperties(SAPDBMem_IRawAllocator& allocator);
02669 
02673   SQLDBC_DLLEXPORT
02674   ~SQLDBC_ConnectProperties();
02675 
02676 
02682   SQLDBC_DLLEXPORT
02683   void setProperty(const char *key, const char *value);
02684 
02691   SQLDBC_DLLEXPORT
02692   const char *getProperty(const char *key, const char *defaultvalue=0) const;
02693 
02694 private:
02695   friend class SQLDBC_Connection;
02696   friend class SQLDBC_Environment;
02697   IFR_ConnectProperties *m_prop;
02698 };
02699 
02700 
02711 class SQLDBC_Connection
02712   : public SQLDBC_ConnectionItem
02713 {
02714 public:
02738   SQLDBC_DLLEXPORT
02739   SQLDBC_Retcode connect(const char *connectURL,
02740                          SQLDBC_Length connectURLLength,
02741                          const char *connectCommand,
02742                          SQLDBC_Length connectCommandLength,
02743                          SQLDBC_StringEncoding connectCommandEncoding,
02744                          SQLDBC_ConnectProperties& connectProperties);
02745 
02767   SQLDBC_DLLEXPORT
02768   SQLDBC_Retcode connect(const char *servernode,
02769                          SQLDBC_Length servernodeLength,
02770                          const char *serverdb,
02771                          SQLDBC_Length serverdbLength,
02772                          const char *username,
02773                          SQLDBC_Length usernameLength,
02774                          const char *password,
02775                          SQLDBC_Length passwordLength,
02776                          const SQLDBC_StringEncoding userpwdEncoding);
02777 
02798   SQLDBC_DLLEXPORT
02799   SQLDBC_Retcode connect(const char *servernode,
02800                          const char *serverdb,
02801                          const char *username,
02802                          const char *password,
02803                          const SQLDBC_StringEncoding userpwdEncoding);
02804 
02819   SQLDBC_DLLEXPORT
02820   SQLDBC_Retcode connect(const char *servernode,
02821                          const char *serverdb,
02822                          const char *username,
02823                          const char *password);
02824 
02856   SQLDBC_DLLEXPORT
02857   SQLDBC_Retcode connect(const char* servernode,
02858                          SQLDBC_Length servernodeLength,
02859                          const char* serverdb,
02860                          SQLDBC_Length serverdbLength,
02861                          const char* username,
02862                          SQLDBC_Length usernameLength,
02863                          const char* password,
02864                          SQLDBC_Length passwordLength,
02865                          const SQLDBC_StringEncoding userpwdEncoding,
02866                          const SQLDBC_ConnectProperties& properties);
02867 
02889    /* #methodmap SQLDBC_Connection_connectNTS connect */
02890   SQLDBC_DLLEXPORT
02891   SQLDBC_Retcode connect(const char* servernode,
02892                          const char* serverdb,
02893                          const char* username,
02894                          const char* password,
02895                          const SQLDBC_StringEncoding userpwdEncoding,
02896                          const SQLDBC_ConnectProperties& properties);
02897 
02913   /* #methodmap SQLDBC_Connection_connectASCII connect */
02914   SQLDBC_DLLEXPORT
02915   SQLDBC_Retcode connect(const char* servernode,
02916                          const char* serverdb,
02917                          const char* username,
02918                          const char* password,
02919                          const SQLDBC_ConnectProperties& properties);
02920 
02921 
02933   SQLDBC_DLLEXPORT
02934   SQLDBC_Retcode connect();
02935 
02948   /* #methodmap SQLDBC_Connection_connectPROP connect */
02949   SQLDBC_DLLEXPORT
02950   SQLDBC_Retcode connect(const SQLDBC_ConnectProperties& properties);
02951 
02952 
02965   SQLDBC_DLLEXPORT
02966   SQLDBC_Statement *createStatement();
02967 
02976   SQLDBC_DLLEXPORT
02977   SQLDBC_PreparedStatement *createPreparedStatement();
02978 
02988   SQLDBC_DLLEXPORT
02989   SQLDBC_Retcode commit();
02990 
02995   SQLDBC_DLLEXPORT
02996   SQLDBC_Retcode rollback();
02997 
03002   SQLDBC_DLLEXPORT
03003   void releaseStatement(SQLDBC_Statement *stmt);
03004 
03009   /* #methodmap SQLDBC_Connection_releasePreparedStatement releaseStatement */
03010   SQLDBC_DLLEXPORT
03011   void releaseStatement(SQLDBC_PreparedStatement *stmt);
03012 
03027   SQLDBC_DLLEXPORT
03028   SQLDBC_Retcode cancel();
03029 
03043   SQLDBC_DLLEXPORT
03044   SQLDBC_Retcode close();
03045 
03046 
03060   SQLDBC_DLLEXPORT
03061   SQLDBC_Retcode commitWorkRelease();
03062 
03063 
03079   SQLDBC_DLLEXPORT
03080   SQLDBC_Retcode disconnect();
03081 
03082 
03088   SQLDBC_DLLEXPORT
03089   void setAutoCommit(SQLDBC_Bool autocommit);
03090 
03097   SQLDBC_DLLEXPORT
03098   SQLDBC_Bool getAutoCommit() const;
03099 
03109   SQLDBC_DLLEXPORT
03110   void setSQLMode(SQLDBC_SQLMode sqlmode);
03111 
03122   SQLDBC_DLLEXPORT
03123   SQLDBC_Retcode setTransactionIsolation(SQLDBC_Int4 isolationlevel);
03124 
03131   SQLDBC_DLLEXPORT
03132   SQLDBC_Int4 getTransactionIsolation() const;
03133 
03141   SQLDBC_DLLEXPORT
03142   SQLDBC_Bool isConnected() const;
03143 
03156   SQLDBC_DLLEXPORT
03157   SQLDBC_Int4 getKernelVersion() const;
03158 
03164   SQLDBC_DLLEXPORT
03165   SQLDBC_Bool isUnicodeDatabase() const;
03166 
03171   SQLDBC_DLLEXPORT
03172   SQLDBC_DateTimeFormat::Format getDateTimeFormat() const;
03173 
03174 private:
03175   friend class SQLDBC_Environment;
03182   SQLDBC_Connection(IFR_Connection *conn);
03183 };
03184 
03189 class SQLDBC_Environment
03190 {
03191 public:
03199   SQLDBC_DLLEXPORT
03200   SQLDBC_Environment(SQLDBC_IRuntime* runtime);
03201 
03205   SQLDBC_DLLEXPORT
03206   ~SQLDBC_Environment();
03207 
03213   SQLDBC_DLLEXPORT
03214   SQLDBC_Connection *createConnection() const;
03215 
03221   SQLDBC_DLLEXPORT
03222   SQLDBC_Connection *createConnection(SAPDBMem_IRawAllocator& allocator) const;
03223 
03229   SQLDBC_DLLEXPORT
03230   void releaseConnection(SQLDBC_Connection *connection) const;
03231 
03245   SQLDBC_DLLEXPORT
03246   const char *getLibraryVersion();
03247 
03257   SQLDBC_DLLEXPORT
03258   inline const char *getSDKVersion()
03259   const
03260   {
03261     return SQLDBCHeaderVersion;
03262   };
03263 
03267     SQLDBC_DLLEXPORT SAPDBMem_IRawAllocator&  getAllocator();
03268 
03269 #ifdef SQLDBC_FEATURE_TRACEOPTION
03270 
03339     SQLDBC_DLLEXPORT
03340     void setTraceOptions(const SQLDBC_ConnectProperties& traceoptions);
03341 
03348     SQLDBC_DLLEXPORT
03349     void getTraceOptions(SQLDBC_ConnectProperties& traceoptions);
03350 #endif
03351 private:
03352     IFR_Environment *m_env;
03353 };
03354 
03364 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03365 
03375 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetSingleThreadClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03376 } /* namespace SQLDBC */
03377 
03378 
03379 #endif