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
00055 #ifdef SQLDBC_FEATURE_PROFILE_OFF
00056 #undef SQLDBC_FEATURE_PROFILE
00057 #else
00058 #define SQLDBC_FEATURE_PROFILE
00059 #endif
00060
00067 #ifdef SQLDBC_FEATURE_DECIMAL_OFF
00068 #undef SQLDBC_FEATURE_DECIMAL
00069 #else
00070 #ifndef SQLDBC_FEATURE_DECIMAL
00071 #define SQLDBC_FEATURE_DECIMAL
00072 #endif
00073 #endif
00074
00080 #ifdef SQLDBC_FEATURE_OMS_ASCII_OFF
00081 #undef SQLDBC_FEATURE_OMS_ASCII
00082 #else
00083 #ifndef SQLDBC_FEATURE_OMS_ASCII
00084 #define SQLDBC_FEATURE_OMS_ASCII
00085 #endif
00086 #endif
00087
00094 #ifdef SQLDBC_RESULTSET_ROWWISE_OFF
00095 #undef SQLDBC_FEATURE_RESULTSET_ROWWISE
00096 #else
00097 #define SQLDBC_FEATURE_RESULTSET_ROWWISE
00098 #endif
00099 #include "SQLDBC_Types.h"
00100
00101 #ifdef IFR_NAMESPACE
00102 namespace IFR_NAMESPACE {
00103 #endif
00104 class IFR_Environment;
00105 class IFR_Connection;
00106 class IFR_ConnectProperties;
00107 class IFR_ConnectionItem;
00108 class IFR_ErrorHndl;
00109 class IFR_Statement;
00110 class IFR_PreparedStmt;
00111 class IFR_SQLWarning;
00112 class IFR_ResultSet;
00113 class IFR_RowSet;
00114 class IFR_ParameterMetaData;
00115 class IFR_ResultSetMetaData;
00116 class IFR_LOB;
00117 class IFR_Profile;
00118 #ifdef IFR_NAMESPACE
00119 };
00120
00121 using namespace IFR_NAMESPACE;
00122 #endif
00123 class SAPDBMem_IRawAllocator;
00124
00128 static const char* SQLDBCHeaderVersion = "SQLDBC.H 7.6.0 BUILD 032-121-130-190";
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139 #ifdef SQLDBC_RUNTIME_IN_NAMESPACE
00140 namespace SQLDBC {
00141 class SQLDBC_IRuntime;
00142 };
00143 #else
00144 class SQLDBC_IRuntime;
00145 #endif
00146
00147 #ifdef WIN32
00148 #define SQLDBC_DLLEXPORT __declspec(dllexport)
00149 #else
00150 #define SQLDBC_DLLEXPORT
00151 #endif
00152
00153 namespace SQLDBC {
00154 class SQLDBC_Statement;
00155 class SQLDBC_ConnectProperties;
00156 class SQLDBC_Connection;
00157
00161 class SQLDBC_ErrorHndl
00162 {
00163 public:
00169 SQLDBC_DLLEXPORT
00170 SQLDBC_ErrorHndl();
00171
00175 SQLDBC_DLLEXPORT
00176 const SQLDBC_Int4 getErrorCode() const;
00177
00181 SQLDBC_DLLEXPORT
00182 const char* getSQLState() const;
00183
00188 SQLDBC_DLLEXPORT
00189 const char *getErrorText() const;
00190
00198 SQLDBC_DLLEXPORT
00199 operator SQLDBC_Bool () const;
00200
00201 private:
00202 friend class SQLDBC_ConnectionItem;
00203 friend struct SQLDBC_ConnectionItemStorage;
00204 friend class SQLDBC_Connection;
00205
00211 SQLDBC_ErrorHndl(IFR_ErrorHndl* error);
00212
00217 void setMemoryAllocationFailed();
00218
00219
00223 IFR_ErrorHndl *m_error;
00224 };
00225
00234 class SQLDBC_SQLWarning
00235 {
00236 public:
00241 SQLDBC_DLLEXPORT
00242 SQLDBC_SQLWarning* getNextWarning() const;
00243
00247 SQLDBC_DLLEXPORT
00248 SQLDBC_SQLWarningCode getWarningCode() const;
00249
00250 private:
00251 friend class SQLDBC_ConnectionItem;
00252 friend struct SQLDBC_ConnectionItemStorage;
00258 SQLDBC_SQLWarning(IFR_SQLWarning* warning);
00259 IFR_SQLWarning *m_warning;
00260 };
00261
00262 struct SQLDBC_ConnectionItemStorage;
00263
00274 class SQLDBC_ConnectionItem
00275 {
00276 public:
00277
00287 SQLDBC_DLLEXPORT
00288 SQLDBC_ErrorHndl &error();
00289
00293 SQLDBC_DLLEXPORT
00294 void clearError();
00295
00304 SQLDBC_DLLEXPORT
00305 SQLDBC_SQLWarning* warning();
00306
00310 SQLDBC_DLLEXPORT
00311 void clearWarnings();
00312
00313 private:
00314 friend class SQLDBC_Environment;
00315 friend class SQLDBC_Connection;
00316 friend class SQLDBC_Statement;
00317 friend class SQLDBC_PreparedStatement;
00318 friend class SQLDBC_ResultSet;
00319 friend class SQLDBC_RowSet;
00320 friend class SQLDBC_UpdatableRowSet;
00321 friend struct SQLDBC_StatementStorage;
00322 friend struct SQLDBC_EnvironmentItemStorage;
00323
00324 SQLDBC_ConnectionItem(IFR_ConnectionItem *item, SQLDBC_Bool isCreatedForSQLDBC_Connection, SQLDBC_Connection* self);
00325
00326 ~SQLDBC_ConnectionItem();
00327
00328 SQLDBC_ConnectionItemStorage *m_citem;
00329 };
00330
00336 class SQLDBC_LOB
00337 {
00338 public:
00350 SQLDBC_DLLEXPORT SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length *paramLengthIndicator);
00351
00355 SQLDBC_DLLEXPORT SQLDBC_Retcode close();
00356
00357
00394 SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void *paramAddr,
00395 SQLDBC_Length *LengthIndicator,
00396 const SQLDBC_Length Size,
00397 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00398
00438
00439 SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void *paramAddr,
00440 SQLDBC_Length *LengthIndicator,
00441 const SQLDBC_Length Size,
00442 const SQLDBC_Length position,
00443 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00444
00452 SQLDBC_DLLEXPORT SQLDBC_Length getLength();
00453
00459 SQLDBC_DLLEXPORT SQLDBC_Length getPosition();
00460
00461
00471 SQLDBC_DLLEXPORT SQLDBC_Length getPreferredDataSize();
00472
00473 private:
00474 IFR_LOB *m_lobdata;
00475 IFR_ConnectionItem *m_citem;
00476 };
00477
00482 class SQLDBC_ParameterMetaData
00483 {
00484 public:
00485
00486 #ifndef __cplusplus
00487 typedef
00488 #endif
00489 enum ParameterNullBehavior {
00493 parameterNoNulls = 0,
00494
00498 parameterNullable = 1,
00499
00503 parameterNullableUnknown = 2
00504 }
00505 #ifndef __cplusplus
00506 ParameterNullBehavior
00507 #endif
00508 ;
00509
00510 #ifndef __cplusplus
00511 typedef
00512 #endif
00513 enum ParameterMode {
00514
00518 parameterModeUnknown = 0,
00519
00523 parameterModeIn = 1,
00524
00528 parameterModeInOut = 2,
00529
00533 parameterModeOut = 4
00534 }
00535 #ifndef __cplusplus
00536 ParameterMode
00537 #endif
00538 ;
00539
00546 SQLDBC_DLLEXPORT
00547 SQLDBC_Int2 getParameterCount();
00548
00566 SQLDBC_DLLEXPORT
00567 SQLDBC_Retcode getParameterName(SQLDBC_Int2 param,
00568 char *buffer,
00569 const SQLDBC_StringEncoding encoding,
00570 const SQLDBC_Length bufferSize,
00571 SQLDBC_Length *bufferLength) const;
00572
00579 SQLDBC_DLLEXPORT
00580 SQLDBC_SQLType getParameterType(SQLDBC_Int2 param);
00581
00592 SQLDBC_DLLEXPORT
00593 ParameterMode getParameterMode(SQLDBC_Int2 param);
00594
00605 SQLDBC_DLLEXPORT
00606 SQLDBC_Int4 getParameterLength(SQLDBC_Int2 param);
00607
00622 SQLDBC_DLLEXPORT
00623 SQLDBC_Int4 getPrecision(SQLDBC_Int2 param);
00624
00637 SQLDBC_DLLEXPORT
00638 SQLDBC_Int4 getScale(SQLDBC_Int2 param);
00639
00650 SQLDBC_DLLEXPORT
00651 SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 param);
00652
00664 SQLDBC_DLLEXPORT
00665 ParameterNullBehavior isNullable(SQLDBC_Int2 param);
00666
00667 private:
00668 friend class SQLDBC_PreparedStatement;
00669 friend struct SQLDBC_PreparedStatementStorage;
00670 SQLDBC_ParameterMetaData(IFR_ParameterMetaData *metadata);
00671 IFR_ParameterMetaData *m_metadata;
00672 };
00673
00678 class SQLDBC_ResultSetMetaData
00679 {
00680 public:
00681 #ifndef __cplusplus
00682 typedef
00683 #endif
00684 enum ColumnNullBehavior {
00688 columnNoNulls = 0,
00689
00693 columnNullable = 1,
00694
00698 columnNullableUnknown = 2
00699 }
00700 #ifndef __cplusplus
00701 ColumnNullBehavior
00702 #endif
00703 ;
00709 SQLDBC_DLLEXPORT
00710 SQLDBC_Int2 getColumnCount();
00711
00731 SQLDBC_DLLEXPORT
00732 SQLDBC_Retcode getColumnName(SQLDBC_Int2 column,
00733 char *buffer,
00734 const SQLDBC_StringEncoding encoding,
00735 const SQLDBC_Length bufferSize,
00736 SQLDBC_Length *bufferLength) const;
00737
00738
00747 SQLDBC_DLLEXPORT
00748 SQLDBC_SQLType getColumnType(SQLDBC_Int2 column);
00749
00758 SQLDBC_DLLEXPORT
00759 SQLDBC_Int4 getColumnLength(SQLDBC_Int2 column);
00760
00774 SQLDBC_DLLEXPORT
00775 SQLDBC_Int4 getPrecision(SQLDBC_Int2 column);
00776
00789 SQLDBC_DLLEXPORT
00790 SQLDBC_Int4 getScale(SQLDBC_Int2 column);
00791
00801 SQLDBC_DLLEXPORT
00802 SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 column);
00803
00814 SQLDBC_DLLEXPORT
00815 ColumnNullBehavior isNullable(SQLDBC_Int2 column);
00816
00826 SQLDBC_DLLEXPORT
00827 SQLDBC_Bool isWritable(SQLDBC_Int2 column);
00828
00829 private:
00830 friend class SQLDBC_PreparedStatement;
00831 friend class SQLDBC_ResultSet;
00832 friend struct SQLDBC_ResultSetStorage;
00833 friend struct SQLDBC_PreparedStatementStorage;
00834 SQLDBC_ResultSetMetaData(IFR_ResultSetMetaData *metadata);
00835 IFR_ResultSetMetaData *m_metadata;
00836 };
00837
00849 class SQLDBC_RowSet
00850 : public SQLDBC_ConnectionItem
00851 {
00852 public:
00853
00863 SQLDBC_DLLEXPORT
00864 SQLDBC_Retcode setPos(SQLDBC_UInt4 pos);
00865
00872 SQLDBC_DLLEXPORT
00873 SQLDBC_Retcode fetch();
00874
00881 SQLDBC_DLLEXPORT
00882 const SQLDBC_Int4 getRowsAffected() const;
00883
00895 SQLDBC_DLLEXPORT
00896 const SQLDBC_Int4 *getRowStatus() const;
00897
00949 SQLDBC_DLLEXPORT
00950 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
00951 const SQLDBC_HostType Type,
00952 void *paramAddr,
00953 SQLDBC_Length *LengthIndicator,
00954 const SQLDBC_Length Size,
00955 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00956
01011
01012 SQLDBC_DLLEXPORT
01013 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
01014 const SQLDBC_HostType Type,
01015 void *paramAddr,
01016 SQLDBC_Length *LengthIndicator,
01017 const SQLDBC_Length Size,
01018 SQLDBC_Length StartPos,
01019 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01020
01021 protected:
01022 friend class SQLDBC_ResultSet;
01023 friend struct SQLDBC_ResultSetStorage;
01024 SQLDBC_RowSet(IFR_ResultSet *resultset);
01025 };
01026
01042 class SQLDBC_UpdatableRowSet
01043 : public SQLDBC_RowSet
01044 {
01045 public:
01046
01054 SQLDBC_DLLEXPORT
01055 SQLDBC_Retcode insertAllRows();
01056
01062 SQLDBC_DLLEXPORT
01063 SQLDBC_Retcode insertOneRow();
01064
01071 SQLDBC_DLLEXPORT
01072 SQLDBC_Retcode insertRow(SQLDBC_UInt4 position);
01073
01074
01083 SQLDBC_DLLEXPORT
01084 SQLDBC_Retcode updateRow(SQLDBC_UInt4 position);
01085 SQLDBC_DLLEXPORT
01086 SQLDBC_Retcode updateRow(int position);
01087
01095 SQLDBC_DLLEXPORT
01096 SQLDBC_Retcode deleteRow(SQLDBC_UInt4 position);
01097 SQLDBC_DLLEXPORT
01098 SQLDBC_Retcode deleteRow(int position);
01099
01120 SQLDBC_DLLEXPORT
01121 SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
01122
01143 SQLDBC_DLLEXPORT
01144 SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
01145
01146
01159 SQLDBC_DLLEXPORT
01160 SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length *paramLengthIndicator);
01161
01162
01163 private:
01164 friend struct SQLDBC_ResultSetStorage;
01165 SQLDBC_UpdatableRowSet(IFR_ResultSet *resultset);
01166 };
01167
01168 struct SQLDBC_ResultSetStorage;
01169
01253 class SQLDBC_ResultSet
01254 : public SQLDBC_ConnectionItem
01255 {
01256 public:
01257
01266 SQLDBC_DLLEXPORT
01267 SQLDBC_ResultSetMetaData* getResultSetMetaData();
01268
01273 SQLDBC_DLLEXPORT
01274 const SQLDBC_Int4 getResultCount () const;
01275
01315 SQLDBC_DLLEXPORT
01316 SQLDBC_Retcode bindColumn (const SQLDBC_UInt4 Index,
01317 const SQLDBC_HostType Type,
01318 void *paramAddr,
01319 SQLDBC_Length *LengthIndicator,
01320 const SQLDBC_Length Size,
01321 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01322
01364
01365 SQLDBC_DLLEXPORT
01366 SQLDBC_Retcode bindColumn (const SQLDBC_UInt4 Index,
01367 const SQLDBC_HostType Type,
01368 void *paramAddr,
01369 SQLDBC_Length *LengthIndicator,
01370 SQLDBC_Length *PositionIndicator,
01371 const SQLDBC_Length Size,
01372 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01373
01374
01392 SQLDBC_DLLEXPORT
01393 SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
01394
01401 SQLDBC_DLLEXPORT
01402 SQLDBC_Retcode clearColumns();
01403
01413 SQLDBC_DLLEXPORT
01414 void setFetchSize(SQLDBC_Int2 fetchsize);
01415
01421 SQLDBC_DLLEXPORT
01422 void setRowSetSize (SQLDBC_UInt4 rowsetsize);
01423
01429 SQLDBC_DLLEXPORT
01430 const SQLDBC_UInt4 getRowSetSize () const;
01431
01438 SQLDBC_DLLEXPORT
01439 SQLDBC_RowSet *getRowSet ();
01440
01447 SQLDBC_DLLEXPORT
01448 SQLDBC_UpdatableRowSet *getUpdatableRowSet ();
01449
01455 SQLDBC_DLLEXPORT
01456 SQLDBC_Statement *getStatement();
01457
01462 SQLDBC_DLLEXPORT
01463 SQLDBC_Bool isUpdatable();
01464
01475 SQLDBC_DLLEXPORT
01476 SQLDBC_Retcode first();
01477
01493 SQLDBC_DLLEXPORT
01494 SQLDBC_Retcode next();
01495
01505 SQLDBC_DLLEXPORT
01506 SQLDBC_Retcode previous();
01507
01517 SQLDBC_DLLEXPORT
01518 SQLDBC_Retcode last();
01519
01548 SQLDBC_DLLEXPORT
01549 SQLDBC_Retcode absolute (int row);
01550
01572 SQLDBC_DLLEXPORT
01573 SQLDBC_Retcode relative(int relativePos);
01574
01578 SQLDBC_DLLEXPORT
01579 void close();
01580
01587 SQLDBC_DLLEXPORT
01588 const SQLDBC_UInt4 getRowNumber() const;
01589
01641 SQLDBC_DLLEXPORT
01642 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
01643 const SQLDBC_HostType Type,
01644 void *paramAddr,
01645 SQLDBC_Length *LengthIndicator,
01646 const SQLDBC_Length Size,
01647 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01648
01649
01704
01705 SQLDBC_DLLEXPORT
01706 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
01707 const SQLDBC_HostType Type,
01708 void *paramAddr,
01709 SQLDBC_Length *LengthIndicator,
01710 const SQLDBC_Length Size,
01711 SQLDBC_Length StartPos,
01712 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01713
01714 private:
01715 friend class SQLDBC_Statement;
01716 friend struct SQLDBC_StatementStorage;
01717
01721 SQLDBC_ResultSet(SQLDBC_Statement* statement,
01722 IFR_ResultSet *resultset);
01726 ~SQLDBC_ResultSet();
01727
01728 SQLDBC_ResultSetStorage *m_cresult;
01729 };
01730
01731 struct SQLDBC_StatementStorage;
01732
01807 class SQLDBC_Statement
01808 : public SQLDBC_ConnectionItem
01809 {
01810 public:
01827 SQLDBC_DLLEXPORT
01828 SQLDBC_Retcode execute(const char *sql,
01829 const SQLDBC_Length sqlLength,
01830 const SQLDBC_StringEncoding encoding);
01831
01847
01848 SQLDBC_DLLEXPORT
01849 SQLDBC_Retcode execute(const char *sql,
01850 const SQLDBC_StringEncoding encoding);
01851
01864
01865 SQLDBC_DLLEXPORT
01866 SQLDBC_Retcode execute(const char *sql);
01867
01881 SQLDBC_DLLEXPORT
01882 void setResultSetFetchSize(SQLDBC_Int2 rows);
01883
01896 SQLDBC_DLLEXPORT
01897 void setMaxRows(SQLDBC_UInt4 rows);
01898
01907 SQLDBC_DLLEXPORT
01908 const SQLDBC_UInt4 getMaxRows() const;
01909
01917 SQLDBC_DLLEXPORT
01918 SQLDBC_ResultSet *getResultSet();
01919
01933 SQLDBC_DLLEXPORT
01934 void setCursorName(const char *buffer,
01935 SQLDBC_Length bufferLength,
01936 const SQLDBC_StringEncoding encoding);
01937
01954 SQLDBC_DLLEXPORT
01955 SQLDBC_Retcode setCommandInfo(const char *buffer,
01956 SQLDBC_Length bufferLength,
01957 SQLDBC_Int4 lineNumber);
01980 SQLDBC_DLLEXPORT
01981 SQLDBC_Retcode getCursorName(char *buffer,
01982 const SQLDBC_StringEncoding encoding,
01983 const SQLDBC_Length bufferSize,
01984 SQLDBC_Length *bufferLength) const;
01985
02001 SQLDBC_DLLEXPORT
02002 SQLDBC_Retcode getTableName(char *buffer,
02003 const SQLDBC_StringEncoding encoding,
02004 const SQLDBC_Length bufferSize,
02005 SQLDBC_Length *bufferLength) const;
02006
02020 SQLDBC_DLLEXPORT
02021 SQLDBC_Bool isQuery() const;
02022
02032 SQLDBC_DLLEXPORT
02033 SQLDBC_Int4 getKernelVersion() const;
02034
02035
02045 SQLDBC_DLLEXPORT
02046 const SQLDBC_Int4 getRowsAffected() const;
02047
02048 enum ResultSetType {
02049 FORWARD_ONLY = 1,
02050 SCROLL_SENSITIVE = 2,
02051 SCROLL_INSENSITIVE = 3
02052 };
02053
02073 SQLDBC_DLLEXPORT
02074 void setResultSetType (ResultSetType type );
02075
02088 SQLDBC_DLLEXPORT
02089 const ResultSetType getResultSetType() const;
02090
02091 enum ConcurrencyType {
02092 CONCUR_UPDATABLE = 10,
02093 CONCUR_READ_ONLY = 11
02094 };
02095
02109 SQLDBC_DLLEXPORT
02110 void setResultSetConcurrencyType (ConcurrencyType type);
02111
02112 enum HoldabilityType {
02113 CURSOR_HOLD_OVER_COMMIT = 20,
02114 CURSOR_CLOSE_ON_COMMIT = 21
02115 };
02116
02126 SQLDBC_DLLEXPORT
02127 const ConcurrencyType getResultSetConcurrencyType() const;
02128
02137 SQLDBC_DLLEXPORT
02138 const SQLDBC_Int4 *getRowStatus() const;
02139
02145 SQLDBC_DLLEXPORT
02146 const SQLDBC_UInt4 getBatchSize() const;
02147
02158 SQLDBC_DLLEXPORT
02159 const SQLDBC_Retcode addBatch(const char *sql,
02160 SQLDBC_Length sqlLength,
02161 SQLDBC_StringEncoding encoding);
02162
02169
02170 SQLDBC_DLLEXPORT
02171 const SQLDBC_Retcode addBatch(const char *sql,
02172 SQLDBC_StringEncoding encoding);
02173
02180
02181 SQLDBC_DLLEXPORT
02182 const SQLDBC_Retcode addBatch(const char *sql);
02183
02190 SQLDBC_DLLEXPORT
02191 const SQLDBC_Retcode executeBatch();
02192
02196 SQLDBC_DLLEXPORT
02197 void clearBatch();
02198
02212 SQLDBC_DLLEXPORT
02213 SQLDBC_Retcode getLastInsertedKey(SQLDBC_Int4 tag,
02214 SQLDBC_HostType type,
02215 void *paramAddr,
02216 SQLDBC_Length *lengthIndicator,
02217 SQLDBC_Length size,
02218 SQLDBC_Bool terminate=SQLDBC_TRUE);
02219
02220
02221 protected:
02225 void clearResultSet();
02226
02227
02228 private:
02229 friend struct SQLDBC_ConnectionItemStorageForConnection;
02230 friend class SQLDBC_Connection;
02231 friend class SQLDBC_PreparedStatement;
02237 SQLDBC_Statement(IFR_Statement *stmt);
02242 SQLDBC_Statement(IFR_PreparedStmt *stmt);
02243 ~SQLDBC_Statement();
02244 SQLDBC_StatementStorage *m_cstmt;
02245 };
02246
02247 struct SQLDBC_PreparedStatementStorage;
02248
02410 class SQLDBC_PreparedStatement
02411 : public SQLDBC_Statement
02412 {
02413 public:
02422 SQLDBC_DLLEXPORT
02423 SQLDBC_Retcode prepare(const char *sql,
02424 const SQLDBC_Length sqlLength,
02425 const SQLDBC_StringEncoding encoding);
02426
02438
02439 SQLDBC_DLLEXPORT
02440 SQLDBC_Retcode prepare(const char *sql,
02441 const SQLDBC_StringEncoding encoding);
02442
02451
02452 SQLDBC_DLLEXPORT
02453 SQLDBC_Retcode prepare(const char *sql);
02454
02467
02468 SQLDBC_DLLEXPORT
02469 SQLDBC_Retcode execute();
02470
02480 SQLDBC_DLLEXPORT
02481 SQLDBC_ParameterMetaData* getParameterMetaData();
02482
02504 SQLDBC_DLLEXPORT
02505 SQLDBC_ResultSetMetaData* getResultSetMetaData();
02506
02513 SQLDBC_DLLEXPORT
02514 SQLDBC_Retcode setBatchSize(SQLDBC_UInt4 rowarraysize);
02515
02527 SQLDBC_DLLEXPORT
02528 SQLDBC_UInt4 getPreferredBatchSize();
02529
02530
02540 SQLDBC_DLLEXPORT
02541 SQLDBC_Retcode clearParameters();
02542
02543
02588 SQLDBC_DLLEXPORT
02589 SQLDBC_Retcode bindParameter (const SQLDBC_UInt2 Index,
02590 const SQLDBC_HostType Type,
02591 void *paramAddr,
02592 SQLDBC_Length *LengthIndicator,
02593 const SQLDBC_Length Size,
02594 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02595
02643 SQLDBC_DLLEXPORT
02644 SQLDBC_Retcode bindParameterAddr(const SQLDBC_UInt2 Index,
02645 const SQLDBC_HostType Type,
02646 void *paramAddr,
02647 SQLDBC_Length *LengthIndicator,
02648 const SQLDBC_Length Size,
02649 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02650
02667 SQLDBC_DLLEXPORT
02668 SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
02669
02690 SQLDBC_DLLEXPORT
02691 SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
02692
02713 SQLDBC_DLLEXPORT
02714 SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
02715
02716
02729 SQLDBC_DLLEXPORT
02730 SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length *paramLengthIndicator);
02731
02779 SQLDBC_DLLEXPORT
02780 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
02781 const SQLDBC_HostType Type,
02782 void *paramAddr,
02783 SQLDBC_Length *LengthIndicator,
02784 const SQLDBC_Length Size,
02785 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02786
02787
02838
02839 SQLDBC_DLLEXPORT
02840 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
02841 const SQLDBC_HostType Type,
02842 void *paramAddr,
02843 SQLDBC_Length *LengthIndicator,
02844 const SQLDBC_Length Size,
02845 SQLDBC_Length StartPos,
02846 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02847
02848
02849 private:
02850 friend class SQLDBC_Connection;
02851 friend struct SQLDBC_ConnectionItemStorageForConnection;
02860 SQLDBC_PreparedStatement(IFR_PreparedStmt *stmt);
02861 ~SQLDBC_PreparedStatement();
02862 SQLDBC_PreparedStatementStorage *m_pcstmt;
02863 };
02864
03032 class SQLDBC_ConnectProperties
03033 {
03034 public:
03039 SQLDBC_DLLEXPORT
03040 SQLDBC_ConnectProperties();
03041
03046 SQLDBC_DLLEXPORT
03047 SQLDBC_ConnectProperties(const SQLDBC_ConnectProperties& copy);
03048
03055 SQLDBC_ConnectProperties(SAPDBMem_IRawAllocator& allocator);
03056
03060 SQLDBC_DLLEXPORT
03061 ~SQLDBC_ConnectProperties();
03062
03063
03069 SQLDBC_DLLEXPORT
03070 void setProperty(const char *key, const char *value);
03071
03078 SQLDBC_DLLEXPORT
03079 const char *getProperty(const char *key, const char *defaultvalue=0) const;
03080
03081 private:
03082 friend class SQLDBC_Connection;
03083 friend class SQLDBC_Environment;
03084 IFR_ConnectProperties *m_prop;
03085 };
03086
03087
03098 class SQLDBC_Connection
03099 : public SQLDBC_ConnectionItem
03100 {
03101 public:
03125 SQLDBC_DLLEXPORT
03126 SQLDBC_Retcode connect(const char *connectURL,
03127 SQLDBC_Length connectURLLength,
03128 const char *connectCommand,
03129 SQLDBC_Length connectCommandLength,
03130 SQLDBC_StringEncoding connectCommandEncoding,
03131 SQLDBC_ConnectProperties& connectProperties);
03132
03154 SQLDBC_DLLEXPORT
03155 SQLDBC_Retcode connect(const char *servernode,
03156 SQLDBC_Length servernodeLength,
03157 const char *serverdb,
03158 SQLDBC_Length serverdbLength,
03159 const char *username,
03160 SQLDBC_Length usernameLength,
03161 const char *password,
03162 SQLDBC_Length passwordLength,
03163 const SQLDBC_StringEncoding userpwdEncoding);
03164
03185 SQLDBC_DLLEXPORT
03186 SQLDBC_Retcode connect(const char *servernode,
03187 const char *serverdb,
03188 const char *username,
03189 const char *password,
03190 const SQLDBC_StringEncoding userpwdEncoding);
03191
03206 SQLDBC_DLLEXPORT
03207 SQLDBC_Retcode connect(const char *servernode,
03208 const char *serverdb,
03209 const char *username,
03210 const char *password);
03211
03243 SQLDBC_DLLEXPORT
03244 SQLDBC_Retcode connect(const char* servernode,
03245 SQLDBC_Length servernodeLength,
03246 const char* serverdb,
03247 SQLDBC_Length serverdbLength,
03248 const char* username,
03249 SQLDBC_Length usernameLength,
03250 const char* password,
03251 SQLDBC_Length passwordLength,
03252 const SQLDBC_StringEncoding userpwdEncoding,
03253 const SQLDBC_ConnectProperties& properties);
03254
03276
03277 SQLDBC_DLLEXPORT
03278 SQLDBC_Retcode connect(const char* servernode,
03279 const char* serverdb,
03280 const char* username,
03281 const char* password,
03282 const SQLDBC_StringEncoding userpwdEncoding,
03283 const SQLDBC_ConnectProperties& properties);
03284
03300
03301 SQLDBC_DLLEXPORT
03302 SQLDBC_Retcode connect(const char* servernode,
03303 const char* serverdb,
03304 const char* username,
03305 const char* password,
03306 const SQLDBC_ConnectProperties& properties);
03307
03308
03320 SQLDBC_DLLEXPORT
03321 SQLDBC_Retcode connect();
03322
03335
03336 SQLDBC_DLLEXPORT
03337 SQLDBC_Retcode connect(const SQLDBC_ConnectProperties& properties);
03338
03339
03352 SQLDBC_DLLEXPORT
03353 SQLDBC_Statement *createStatement();
03354
03363 SQLDBC_DLLEXPORT
03364 SQLDBC_PreparedStatement *createPreparedStatement();
03365
03375 SQLDBC_DLLEXPORT
03376 SQLDBC_Retcode commit();
03377
03382 SQLDBC_DLLEXPORT
03383 SQLDBC_Retcode rollback();
03384
03389 SQLDBC_DLLEXPORT
03390 void releaseStatement(SQLDBC_Statement *stmt);
03391
03396
03397 SQLDBC_DLLEXPORT
03398 void releaseStatement(SQLDBC_PreparedStatement *stmt);
03399
03414 SQLDBC_DLLEXPORT
03415 SQLDBC_Retcode cancel();
03416
03430 SQLDBC_DLLEXPORT
03431 SQLDBC_Retcode close();
03432
03433
03447 SQLDBC_DLLEXPORT
03448 SQLDBC_Retcode commitWorkRelease();
03449
03450
03466 SQLDBC_DLLEXPORT
03467 SQLDBC_Retcode disconnect();
03468
03469
03475 SQLDBC_DLLEXPORT
03476 void setAutoCommit(SQLDBC_Bool autocommit);
03477
03484 SQLDBC_DLLEXPORT
03485 SQLDBC_Bool getAutoCommit() const;
03486
03496 SQLDBC_DLLEXPORT
03497 void setSQLMode(SQLDBC_SQLMode sqlmode);
03498
03509 SQLDBC_DLLEXPORT
03510 SQLDBC_Retcode setTransactionIsolation(SQLDBC_Int4 isolationlevel);
03511
03518 SQLDBC_DLLEXPORT
03519 SQLDBC_Int4 getTransactionIsolation() const;
03520
03528 SQLDBC_DLLEXPORT
03529 SQLDBC_Bool isConnected() const;
03530
03543 SQLDBC_DLLEXPORT
03544 SQLDBC_Int4 getKernelVersion() const;
03545
03551 SQLDBC_DLLEXPORT
03552 SQLDBC_Bool isUnicodeDatabase() const;
03553
03558 SQLDBC_DLLEXPORT
03559 SQLDBC_DateTimeFormat::Format getDateTimeFormat() const;
03560
03561 private:
03562 friend class SQLDBC_Environment;
03569 SQLDBC_Connection(IFR_Connection *conn);
03570 };
03571
03572
03573 #ifdef SQLDBC_FEATURE_PROFILE
03574
03591 class SQLDBC_Profile
03592 {
03593 public:
03594
03598 SQLDBC_DLLEXPORT
03599 void resetCounters();
03600
03604 SQLDBC_DLLEXPORT
03605 void collectCounters();
03606
03613 SQLDBC_DLLEXPORT
03614 SQLDBC_UInt8 getCounter(SQLDBC_ProfileCountValues counter);
03615
03616 private:
03617 friend class SQLDBC_Environment;
03618 friend struct SQLDBC_EnvironmentItemStorage;
03619 SQLDBC_Profile(IFR_Profile *profile);
03620 IFR_Profile *m_profile;
03621 };
03622 #endif
03623
03624 struct SQLDBC_EnvironmentItemStorage;
03625
03630 class SQLDBC_Environment
03631 {
03632 public:
03640 SQLDBC_DLLEXPORT
03641 SQLDBC_Environment(SQLDBC_IRuntime* runtime);
03642
03646 SQLDBC_DLLEXPORT
03647 ~SQLDBC_Environment();
03648
03654 SQLDBC_DLLEXPORT
03655 SQLDBC_Connection *createConnection() const;
03656
03662 SQLDBC_DLLEXPORT
03663 SQLDBC_Connection *createConnection(SAPDBMem_IRawAllocator& allocator) const;
03664
03670 SQLDBC_DLLEXPORT
03671 void releaseConnection(SQLDBC_Connection *connection) const;
03672
03686 SQLDBC_DLLEXPORT
03687 const char *getLibraryVersion();
03688
03698 SQLDBC_DLLEXPORT
03699 inline const char *getSDKVersion()
03700 const
03701 {
03702 return SQLDBCHeaderVersion;
03703 };
03704
03708 SQLDBC_DLLEXPORT SAPDBMem_IRawAllocator& getAllocator();
03709
03710 #ifdef SQLDBC_FEATURE_TRACEOPTION
03711
03780 SQLDBC_DLLEXPORT
03781 void setTraceOptions(const SQLDBC_ConnectProperties& traceoptions);
03782
03789 SQLDBC_DLLEXPORT
03790 void getTraceOptions(SQLDBC_ConnectProperties& traceoptions);
03791 #endif
03792
03793 #ifdef SQLDBC_FEATURE_PROFILE
03794
03799 SQLDBC_DLLEXPORT
03800 SQLDBC_Profile* getProfile();
03801
03802 #endif
03803 private:
03804 SQLDBC_EnvironmentItemStorage *m_eitem;
03805 };
03806
03816 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03817
03827 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetSingleThreadClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03828 }
03829
03830
03831 #endif