00001
00034 #ifndef SQLDBC_H
00035 #define SQLDBC_H
00036 #include "SQLDBC_Types.h"
00037
00038 class IFR_Environment;
00039 class IFR_Connection;
00040 class IFR_ConnectProperties;
00041 class IFR_ConnectionItem;
00042 class IFR_ErrorHndl;
00043 class IFR_Statement;
00044 class IFR_PreparedStmt;
00045 class IFR_SQLWarning;
00046 class IFR_ResultSet;
00047 class IFR_RowSet;
00048 class IFR_ParameterMetaData;
00049 class IFR_ResultSetMetaData;
00050 class IFR_LOB;
00051
00052 class SAPDBMem_IRawAllocator;
00053
00057 static const char* SQLDBCHeaderVersion = "SQLDBC.H 7.5.0 BUILD 021-123-084-954";
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 class SQLDBC_IRuntime;
00069
00070 #ifdef WIN32
00071 #define SQLDBC_DLLEXPORT __declspec(dllexport)
00072 #else
00073 #define SQLDBC_DLLEXPORT
00074 #endif
00075
00076 namespace SQLDBC {
00077
00078 class SQLDBC_Statement;
00079
00083 class SQLDBC_ErrorHndl
00084 {
00085 public:
00091 SQLDBC_DLLEXPORT
00092 SQLDBC_ErrorHndl();
00093
00097 SQLDBC_DLLEXPORT
00098 const SQLDBC_Int4 getErrorCode() const;
00099
00103 SQLDBC_DLLEXPORT
00104 const char* getSQLState() const;
00105
00110 SQLDBC_DLLEXPORT
00111 const char *getErrorText() const;
00112
00120 SQLDBC_DLLEXPORT
00121 operator SQLDBC_Bool () const;
00122
00123 private:
00124 friend class SQLDBC_ConnectionItem;
00125 friend struct SQLDBC_ConnectionItemStorage;
00126 friend class SQLDBC_Connection;
00127
00133 SQLDBC_ErrorHndl(IFR_ErrorHndl* error);
00134
00139 void setMemoryAllocationFailed();
00140
00141
00145 IFR_ErrorHndl *m_error;
00146 };
00147
00156 class SQLDBC_SQLWarning
00157 {
00158 public:
00163 SQLDBC_DLLEXPORT
00164 SQLDBC_SQLWarning* getNextWarning() const;
00165
00169 SQLDBC_DLLEXPORT
00170 SQLDBC_SQLWarningCode getWarningCode() const;
00171
00172 private:
00173 friend class SQLDBC_ConnectionItem;
00174 friend struct SQLDBC_ConnectionItemStorage;
00180 SQLDBC_SQLWarning(IFR_SQLWarning* warning);
00181 IFR_SQLWarning *m_warning;
00182 };
00183
00184 struct SQLDBC_ConnectionItemStorage;
00185
00196 class SQLDBC_ConnectionItem
00197 {
00198 public:
00199
00209 SQLDBC_DLLEXPORT
00210 SQLDBC_ErrorHndl &error();
00211
00215 SQLDBC_DLLEXPORT
00216 void clearError();
00217
00226 SQLDBC_DLLEXPORT
00227 SQLDBC_SQLWarning* warning();
00228
00232 SQLDBC_DLLEXPORT
00233 void clearWarnings();
00234
00235 private:
00236 friend class SQLDBC_Environment;
00237 friend class SQLDBC_Connection;
00238 friend class SQLDBC_Statement;
00239 friend class SQLDBC_PreparedStatement;
00240 friend class SQLDBC_ResultSet;
00241 friend class SQLDBC_RowSet;
00242 friend class SQLDBC_UpdatableRowSet;
00243
00244 SQLDBC_ConnectionItem(IFR_ConnectionItem *item);
00245
00246 ~SQLDBC_ConnectionItem();
00247
00248 SQLDBC_ConnectionItemStorage *m_citem;
00249 };
00250
00256 class SQLDBC_LOB
00257 {
00258 public:
00270 SQLDBC_DLLEXPORT SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length *paramLengthIndicator);
00271
00275 SQLDBC_DLLEXPORT SQLDBC_Retcode close();
00276
00277
00314 SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void *paramAddr,
00315 SQLDBC_Length *LengthIndicator,
00316 const SQLDBC_Length Size,
00317 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00318
00358
00359 SQLDBC_DLLEXPORT SQLDBC_Retcode getData(void *paramAddr,
00360 SQLDBC_Length *LengthIndicator,
00361 const SQLDBC_Length Size,
00362 const SQLDBC_Length position,
00363 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00364
00372 SQLDBC_DLLEXPORT SQLDBC_Length getLength();
00373
00379 SQLDBC_DLLEXPORT SQLDBC_Length getPosition();
00380
00381
00391 SQLDBC_DLLEXPORT SQLDBC_Length getPreferredDataSize();
00392
00393 private:
00394 IFR_LOB *m_lobdata;
00395 IFR_ConnectionItem *m_citem;
00396 };
00397
00402 class SQLDBC_ParameterMetaData
00403 {
00404 public:
00405
00406 #ifndef __cplusplus
00407 typedef
00408 #endif
00409 enum ParameterNullBehavior {
00413 parameterNoNulls = 0,
00414
00418 parameterNullable = 1,
00419
00423 parameterNullableUnknown = 2
00424 }
00425 #ifndef __cplusplus
00426 ParameterNullBehavior
00427 #endif
00428 ;
00429
00430 #ifndef __cplusplus
00431 typedef
00432 #endif
00433 enum ParameterMode {
00434
00438 parameterModeUnknown = 0,
00439
00443 parameterModeIn = 1,
00444
00448 parameterModeInOut = 2,
00449
00453 parameterModeOut = 4
00454 }
00455 #ifndef __cplusplus
00456 ParameterMode
00457 #endif
00458 ;
00459
00466 SQLDBC_DLLEXPORT
00467 SQLDBC_Int2 getParameterCount();
00468
00486 SQLDBC_DLLEXPORT
00487 SQLDBC_Retcode getParameterName(SQLDBC_Int2 param,
00488 char *buffer,
00489 const SQLDBC_StringEncoding encoding,
00490 const SQLDBC_Length bufferSize,
00491 SQLDBC_Length *bufferLength) const;
00492
00499 SQLDBC_DLLEXPORT
00500 SQLDBC_SQLType getParameterType(SQLDBC_Int2 param);
00501
00512 SQLDBC_DLLEXPORT
00513 ParameterMode getParameterMode(SQLDBC_Int2 param);
00514
00525 SQLDBC_DLLEXPORT
00526 SQLDBC_Int4 getParameterLength(SQLDBC_Int2 param);
00527
00542 SQLDBC_DLLEXPORT
00543 SQLDBC_Int4 getPrecision(SQLDBC_Int2 param);
00544
00557 SQLDBC_DLLEXPORT
00558 SQLDBC_Int4 getScale(SQLDBC_Int2 param);
00559
00570 SQLDBC_DLLEXPORT
00571 SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 param);
00572
00584 SQLDBC_DLLEXPORT
00585 ParameterNullBehavior isNullable(SQLDBC_Int2 param);
00586
00587 private:
00588 friend class SQLDBC_PreparedStatement;
00589 friend struct SQLDBC_PreparedStatementStorage;
00590 SQLDBC_ParameterMetaData(IFR_ParameterMetaData *metadata);
00591 IFR_ParameterMetaData *m_metadata;
00592 };
00593
00598 class SQLDBC_ResultSetMetaData
00599 {
00600 public:
00601 #ifndef __cplusplus
00602 typedef
00603 #endif
00604 enum ColumnNullBehavior {
00608 columnNoNulls = 0,
00609
00613 columnNullable = 1,
00614
00618 columnNullableUnknown = 2
00619 }
00620 #ifndef __cplusplus
00621 ColumnNullBehavior
00622 #endif
00623 ;
00629 SQLDBC_DLLEXPORT
00630 SQLDBC_Int2 getColumnCount();
00631
00651 SQLDBC_DLLEXPORT
00652 SQLDBC_Retcode getColumnName(SQLDBC_Int2 column,
00653 char *buffer,
00654 const SQLDBC_StringEncoding encoding,
00655 const SQLDBC_Length bufferSize,
00656 SQLDBC_Length *bufferLength) const;
00657
00658
00667 SQLDBC_DLLEXPORT
00668 SQLDBC_SQLType getColumnType(SQLDBC_Int2 column);
00669
00678 SQLDBC_DLLEXPORT
00679 SQLDBC_Int4 getColumnLength(SQLDBC_Int2 column);
00680
00694 SQLDBC_DLLEXPORT
00695 SQLDBC_Int4 getPrecision(SQLDBC_Int2 column);
00696
00709 SQLDBC_DLLEXPORT
00710 SQLDBC_Int4 getScale(SQLDBC_Int2 column);
00711
00721 SQLDBC_DLLEXPORT
00722 SQLDBC_Int4 getPhysicalLength(SQLDBC_Int2 column);
00723
00734 SQLDBC_DLLEXPORT
00735 ColumnNullBehavior isNullable(SQLDBC_Int2 column);
00736
00746 SQLDBC_DLLEXPORT
00747 SQLDBC_Bool isWritable(SQLDBC_Int2 column);
00748
00749 private:
00750 friend class SQLDBC_PreparedStatement;
00751 friend class SQLDBC_ResultSet;
00752 friend struct SQLDBC_ResultSetStorage;
00753 friend struct SQLDBC_PreparedStatementStorage;
00754 SQLDBC_ResultSetMetaData(IFR_ResultSetMetaData *metadata);
00755 IFR_ResultSetMetaData *m_metadata;
00756 };
00757
00769 class SQLDBC_RowSet
00770 : public SQLDBC_ConnectionItem
00771 {
00772 public:
00773
00783 SQLDBC_DLLEXPORT
00784 SQLDBC_Retcode setPos(SQLDBC_UInt4 pos);
00785
00792 SQLDBC_DLLEXPORT
00793 SQLDBC_Retcode fetch();
00794
00801 SQLDBC_DLLEXPORT
00802 const SQLDBC_Int4 getRowsAffected() const;
00803
00815 SQLDBC_DLLEXPORT
00816 const SQLDBC_Int4 *getRowStatus() const;
00817
00869 SQLDBC_DLLEXPORT
00870 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
00871 const SQLDBC_HostType Type,
00872 void *paramAddr,
00873 SQLDBC_Length *LengthIndicator,
00874 const SQLDBC_Length Size,
00875 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00876
00931
00932 SQLDBC_DLLEXPORT
00933 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
00934 const SQLDBC_HostType Type,
00935 void *paramAddr,
00936 SQLDBC_Length *LengthIndicator,
00937 const SQLDBC_Length Size,
00938 SQLDBC_Length StartPos,
00939 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
00940
00941 protected:
00942 friend class SQLDBC_ResultSet;
00943 friend struct SQLDBC_ResultSetStorage;
00944 SQLDBC_RowSet(IFR_ResultSet *resultset);
00945 };
00946
00958 class SQLDBC_UpdatableRowSet
00959 : public SQLDBC_RowSet
00960 {
00961 public:
00962
00970 SQLDBC_DLLEXPORT
00971 SQLDBC_Retcode insertAllRows();
00972
00978 SQLDBC_DLLEXPORT
00979 SQLDBC_Retcode insertOneRow();
00980
00989 SQLDBC_DLLEXPORT
00990 SQLDBC_Retcode updateRow(int position);
00991
00999 SQLDBC_DLLEXPORT
01000 SQLDBC_Retcode deleteRow(int position);
01001
01002 private:
01003 friend struct SQLDBC_ResultSetStorage;
01004 SQLDBC_UpdatableRowSet(IFR_ResultSet *resultset);
01005 };
01006
01007 struct SQLDBC_ResultSetStorage;
01008
01092 class SQLDBC_ResultSet
01093 : public SQLDBC_ConnectionItem
01094 {
01095 public:
01096
01105 SQLDBC_DLLEXPORT
01106 SQLDBC_ResultSetMetaData* getResultSetMetaData();
01107
01112 SQLDBC_DLLEXPORT
01113 const SQLDBC_Int4 getResultCount () const;
01114
01154 SQLDBC_DLLEXPORT
01155 SQLDBC_Retcode bindColumn (const SQLDBC_UInt4 Index,
01156 const SQLDBC_HostType Type,
01157 void *paramAddr,
01158 SQLDBC_Length *LengthIndicator,
01159 const SQLDBC_Length Size,
01160 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01161
01203
01204 SQLDBC_DLLEXPORT
01205 SQLDBC_Retcode bindColumn (const SQLDBC_UInt4 Index,
01206 const SQLDBC_HostType Type,
01207 void *paramAddr,
01208 SQLDBC_Length *LengthIndicator,
01209 SQLDBC_Length *PositionIndicator,
01210 const SQLDBC_Length Size,
01211 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01212
01219 SQLDBC_DLLEXPORT
01220 SQLDBC_Retcode clearColumns();
01221
01231 SQLDBC_DLLEXPORT
01232 void setFetchSize(SQLDBC_Int2 fetchsize);
01233
01239 SQLDBC_DLLEXPORT
01240 void setRowSetSize (SQLDBC_UInt4 rowsetsize);
01241
01247 SQLDBC_DLLEXPORT
01248 const SQLDBC_UInt4 getRowSetSize () const;
01249
01256 SQLDBC_DLLEXPORT
01257 SQLDBC_RowSet *getRowSet ();
01258
01265 SQLDBC_DLLEXPORT
01266 SQLDBC_UpdatableRowSet *getUpdatableRowSet ();
01267
01273 SQLDBC_DLLEXPORT
01274 SQLDBC_Statement *getStatement();
01275
01280 SQLDBC_DLLEXPORT
01281 SQLDBC_Bool isUpdatable();
01282
01293 SQLDBC_DLLEXPORT
01294 SQLDBC_Retcode first();
01295
01311 SQLDBC_DLLEXPORT
01312 SQLDBC_Retcode next();
01313
01323 SQLDBC_DLLEXPORT
01324 SQLDBC_Retcode previous();
01325
01335 SQLDBC_DLLEXPORT
01336 SQLDBC_Retcode last();
01337
01366 SQLDBC_DLLEXPORT
01367 SQLDBC_Retcode absolute (int row);
01368
01390 SQLDBC_DLLEXPORT
01391 SQLDBC_Retcode relative(int relativePos);
01392
01396 SQLDBC_DLLEXPORT
01397 void close();
01398
01405 SQLDBC_DLLEXPORT
01406 const SQLDBC_UInt4 getRowNumber() const;
01407
01459 SQLDBC_DLLEXPORT
01460 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
01461 const SQLDBC_HostType Type,
01462 void *paramAddr,
01463 SQLDBC_Length *LengthIndicator,
01464 const SQLDBC_Length Size,
01465 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01466
01467
01522
01523 SQLDBC_DLLEXPORT
01524 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
01525 const SQLDBC_HostType Type,
01526 void *paramAddr,
01527 SQLDBC_Length *LengthIndicator,
01528 const SQLDBC_Length Size,
01529 SQLDBC_Length StartPos,
01530 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
01531
01532 private:
01533 friend class SQLDBC_Statement;
01534 friend struct SQLDBC_StatementStorage;
01535
01539 SQLDBC_ResultSet(SQLDBC_Statement* statement,
01540 IFR_ResultSet *resultset);
01544 ~SQLDBC_ResultSet();
01545
01546 SQLDBC_ResultSetStorage *m_cresult;
01547 };
01548
01549 struct SQLDBC_StatementStorage;
01550
01625 class SQLDBC_Statement
01626 : public SQLDBC_ConnectionItem
01627 {
01628 public:
01645 SQLDBC_DLLEXPORT
01646 SQLDBC_Retcode execute(const char *sql,
01647 const SQLDBC_Length sqlLength,
01648 const SQLDBC_StringEncoding encoding);
01649
01665
01666 SQLDBC_DLLEXPORT
01667 SQLDBC_Retcode execute(const char *sql,
01668 const SQLDBC_StringEncoding encoding);
01669
01682
01683 SQLDBC_DLLEXPORT
01684 SQLDBC_Retcode execute(const char *sql);
01685
01699 SQLDBC_DLLEXPORT
01700 void setResultSetFetchSize(SQLDBC_Int2 rows);
01701
01714 SQLDBC_DLLEXPORT
01715 void setMaxRows(SQLDBC_UInt4 rows);
01716
01725 SQLDBC_DLLEXPORT
01726 const SQLDBC_UInt4 getMaxRows() const;
01727
01735 SQLDBC_DLLEXPORT
01736 SQLDBC_ResultSet *getResultSet();
01737
01751 SQLDBC_DLLEXPORT
01752 void setCursorName(const char *buffer,
01753 SQLDBC_Length bufferLength,
01754 const SQLDBC_StringEncoding encoding);
01755
01772 SQLDBC_DLLEXPORT
01773 SQLDBC_Retcode setCommandInfo(const char *buffer,
01774 SQLDBC_Length bufferLength,
01775 SQLDBC_Int4 lineNumber);
01798 SQLDBC_DLLEXPORT
01799 SQLDBC_Retcode getCursorName(char *buffer,
01800 const SQLDBC_StringEncoding encoding,
01801 const SQLDBC_Length bufferSize,
01802 SQLDBC_Length *bufferLength) const;
01803
01819 SQLDBC_DLLEXPORT
01820 SQLDBC_Retcode getTableName(char *buffer,
01821 const SQLDBC_StringEncoding encoding,
01822 const SQLDBC_Length bufferSize,
01823 SQLDBC_Length *bufferLength) const;
01824
01838 SQLDBC_DLLEXPORT
01839 SQLDBC_Bool isQuery() const;
01840
01850 SQLDBC_DLLEXPORT
01851 const SQLDBC_Int4 getRowsAffected() const;
01852
01853 enum ResultSetType {
01854 FORWARD_ONLY = 1,
01855 SCROLL_SENSITIVE = 2,
01856 SCROLL_INSENSITIVE = 3
01857 };
01858
01877 SQLDBC_DLLEXPORT
01878 void setResultSetType (ResultSetType type );
01879
01890 SQLDBC_DLLEXPORT
01891 const ResultSetType getResultSetType() const;
01892
01893 enum ConcurrencyType {
01894 CONCUR_UPDATABLE = 10,
01895 CONCUR_READ_ONLY = 11
01896 };
01897
01911 SQLDBC_DLLEXPORT
01912 void setResultSetConcurrencyType (ConcurrencyType type);
01913
01914 enum HoldabilityType {
01915 CURSOR_HOLD_OVER_COMMIT = 20,
01916 CURSOR_CLOSE_ON_COMMIT = 21
01917 };
01918
01928 SQLDBC_DLLEXPORT
01929 const ConcurrencyType getResultSetConcurrencyType() const;
01930
01939 SQLDBC_DLLEXPORT
01940 const SQLDBC_Int4 *getRowStatus() const;
01941
01947 SQLDBC_DLLEXPORT
01948 const SQLDBC_UInt4 getBatchSize() const;
01949
01960 SQLDBC_DLLEXPORT
01961 const SQLDBC_Retcode addBatch(const char *sql,
01962 SQLDBC_Length sqlLength,
01963 SQLDBC_StringEncoding encoding);
01964
01971
01972 SQLDBC_DLLEXPORT
01973 const SQLDBC_Retcode addBatch(const char *sql,
01974 SQLDBC_StringEncoding encoding);
01975
01982
01983 SQLDBC_DLLEXPORT
01984 const SQLDBC_Retcode addBatch(const char *sql);
01985
01992 SQLDBC_DLLEXPORT
01993 const SQLDBC_Retcode executeBatch();
01994
01998 SQLDBC_DLLEXPORT
01999 void clearBatch();
02000
02014 SQLDBC_DLLEXPORT
02015 SQLDBC_Retcode getLastInsertedKey(SQLDBC_Int4 tag,
02016 SQLDBC_HostType type,
02017 void *paramAddr,
02018 SQLDBC_Length *lengthIndicator,
02019 SQLDBC_Length size,
02020 SQLDBC_Bool terminate=SQLDBC_TRUE);
02021
02022
02023 protected:
02027 void clearResultSet();
02028
02029
02030 private:
02031 friend class SQLDBC_Connection;
02032 friend class SQLDBC_PreparedStatement;
02038 SQLDBC_Statement(IFR_Statement *stmt);
02043 SQLDBC_Statement(IFR_PreparedStmt *stmt);
02044 ~SQLDBC_Statement();
02045 SQLDBC_StatementStorage *m_cstmt;
02046 };
02047
02048 struct SQLDBC_PreparedStatementStorage;
02049
02116 class SQLDBC_PreparedStatement
02117 : public SQLDBC_Statement
02118 {
02119 public:
02128 SQLDBC_DLLEXPORT
02129 SQLDBC_Retcode prepare(const char *sql,
02130 const SQLDBC_Length sqlLength,
02131 const SQLDBC_StringEncoding encoding);
02132
02144
02145 SQLDBC_DLLEXPORT
02146 SQLDBC_Retcode prepare(const char *sql,
02147 const SQLDBC_StringEncoding encoding);
02148
02157
02158 SQLDBC_DLLEXPORT
02159 SQLDBC_Retcode prepare(const char *sql);
02160
02173
02174 SQLDBC_DLLEXPORT
02175 SQLDBC_Retcode execute();
02176
02186 SQLDBC_DLLEXPORT
02187 SQLDBC_ParameterMetaData* getParameterMetaData();
02188
02210 SQLDBC_DLLEXPORT
02211 SQLDBC_ResultSetMetaData* getResultSetMetaData();
02212
02219 SQLDBC_DLLEXPORT
02220 SQLDBC_Retcode setBatchSize(SQLDBC_UInt4 rowarraysize);
02221
02231 SQLDBC_DLLEXPORT
02232 SQLDBC_Retcode clearParameters();
02233
02234
02273 SQLDBC_DLLEXPORT
02274 SQLDBC_Retcode bindParameter (const SQLDBC_UInt2 Index,
02275 const SQLDBC_HostType Type,
02276 void *paramAddr,
02277 SQLDBC_Length *LengthIndicator,
02278 const SQLDBC_Length Size,
02279 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02280
02323 SQLDBC_DLLEXPORT
02324 SQLDBC_Retcode bindParameterAddr(const SQLDBC_UInt2 Index,
02325 const SQLDBC_HostType Type,
02326 void *paramAddr,
02327 SQLDBC_Length *LengthIndicator,
02328 const SQLDBC_Length Size,
02329 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02330
02347 SQLDBC_DLLEXPORT
02348 SQLDBC_Retcode setBindingType(SQLDBC_size_t size);
02349
02370 SQLDBC_DLLEXPORT
02371 SQLDBC_Retcode nextParameter(SQLDBC_Int2& paramIndex, void*& paramAddr);
02372
02393 SQLDBC_DLLEXPORT
02394 SQLDBC_Retcode nextParameterByIndex(SQLDBC_Int2& paramIndex, void*& paramAddr);
02395
02396
02409 SQLDBC_DLLEXPORT
02410 SQLDBC_Retcode putData(void *paramAddr, SQLDBC_Length *paramLengthIndicator);
02411
02459 SQLDBC_DLLEXPORT
02460 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
02461 const SQLDBC_HostType Type,
02462 void *paramAddr,
02463 SQLDBC_Length *LengthIndicator,
02464 const SQLDBC_Length Size,
02465 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02466
02467
02518
02519 SQLDBC_DLLEXPORT
02520 SQLDBC_Retcode getObject(const SQLDBC_Int4 Index,
02521 const SQLDBC_HostType Type,
02522 void *paramAddr,
02523 SQLDBC_Length *LengthIndicator,
02524 const SQLDBC_Length Size,
02525 SQLDBC_Length StartPos,
02526 const SQLDBC_Bool Terminate=SQLDBC_TRUE);
02527
02528
02529 private:
02530 friend class SQLDBC_Connection;
02539 SQLDBC_PreparedStatement(IFR_PreparedStmt *stmt);
02540 ~SQLDBC_PreparedStatement();
02541 SQLDBC_PreparedStatementStorage *m_pcstmt;
02542 };
02543
02621 class SQLDBC_ConnectProperties
02622 {
02623 public:
02628 SQLDBC_DLLEXPORT
02629 SQLDBC_ConnectProperties();
02630
02635 SQLDBC_DLLEXPORT
02636 SQLDBC_ConnectProperties(const SQLDBC_ConnectProperties& copy);
02637
02641 SQLDBC_DLLEXPORT
02642 ~SQLDBC_ConnectProperties();
02643
02644
02650 SQLDBC_DLLEXPORT
02651 void setProperty(const char *key, const char *value);
02652
02659 SQLDBC_DLLEXPORT
02660 const char *getProperty(const char *key, const char *defaultvalue=0) const;
02661
02662 private:
02663 friend class SQLDBC_Connection;
02664 IFR_ConnectProperties *m_prop;
02665 };
02666
02667
02678 class SQLDBC_Connection
02679 : public SQLDBC_ConnectionItem
02680 {
02681 public:
02705 SQLDBC_DLLEXPORT
02706 SQLDBC_Retcode connect(const char *connectURL,
02707 SQLDBC_Length connectURLLength,
02708 const char *connectCommand,
02709 SQLDBC_Length connectCommandLength,
02710 SQLDBC_StringEncoding connectCommandEncoding,
02711 SQLDBC_ConnectProperties& connectProperties);
02712
02734 SQLDBC_DLLEXPORT
02735 SQLDBC_Retcode connect(const char *servernode,
02736 SQLDBC_Length servernodeLength,
02737 const char *serverdb,
02738 SQLDBC_Length serverdbLength,
02739 const char *username,
02740 SQLDBC_Length usernameLength,
02741 const char *password,
02742 SQLDBC_Length passwordLength,
02743 const SQLDBC_StringEncoding userpwdEncoding);
02744
02765 SQLDBC_DLLEXPORT
02766 SQLDBC_Retcode connect(const char *servernode,
02767 const char *serverdb,
02768 const char *username,
02769 const char *password,
02770 const SQLDBC_StringEncoding userpwdEncoding);
02771
02786 SQLDBC_DLLEXPORT
02787 SQLDBC_Retcode connect(const char *servernode,
02788 const char *serverdb,
02789 const char *username,
02790 const char *password);
02791
02823 SQLDBC_DLLEXPORT
02824 SQLDBC_Retcode connect(const char* servernode,
02825 SQLDBC_Length servernodeLength,
02826 const char* serverdb,
02827 SQLDBC_Length serverdbLength,
02828 const char* username,
02829 SQLDBC_Length usernameLength,
02830 const char* password,
02831 SQLDBC_Length passwordLength,
02832 const SQLDBC_StringEncoding userpwdEncoding,
02833 const SQLDBC_ConnectProperties& properties);
02834
02856
02857 SQLDBC_DLLEXPORT
02858 SQLDBC_Retcode connect(const char* servernode,
02859 const char* serverdb,
02860 const char* username,
02861 const char* password,
02862 const SQLDBC_StringEncoding userpwdEncoding,
02863 const SQLDBC_ConnectProperties& properties);
02864
02880
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_ConnectProperties& properties);
02887
02888
02900 SQLDBC_DLLEXPORT
02901 SQLDBC_Retcode connect();
02902
02915
02916 SQLDBC_DLLEXPORT
02917 SQLDBC_Retcode connect(const SQLDBC_ConnectProperties& properties);
02918
02919
02932 SQLDBC_DLLEXPORT
02933 SQLDBC_Statement *createStatement();
02934
02943 SQLDBC_DLLEXPORT
02944 SQLDBC_PreparedStatement *createPreparedStatement();
02945
02955 SQLDBC_DLLEXPORT
02956 SQLDBC_Retcode commit();
02957
02962 SQLDBC_DLLEXPORT
02963 SQLDBC_Retcode rollback();
02964
02969 SQLDBC_DLLEXPORT
02970 void releaseStatement(SQLDBC_Statement *stmt);
02971
02976
02977 SQLDBC_DLLEXPORT
02978 void releaseStatement(SQLDBC_PreparedStatement *stmt);
02979
02994 SQLDBC_DLLEXPORT
02995 SQLDBC_Retcode cancel();
02996
03010 SQLDBC_DLLEXPORT
03011 SQLDBC_Retcode close();
03012
03013
03027 SQLDBC_DLLEXPORT
03028 SQLDBC_Retcode commitWorkRelease();
03029
03030
03046 SQLDBC_DLLEXPORT
03047 SQLDBC_Retcode disconnect();
03048
03049
03055 SQLDBC_DLLEXPORT
03056 void setAutoCommit(SQLDBC_Bool autocommit);
03057
03064 SQLDBC_DLLEXPORT
03065 SQLDBC_Bool getAutoCommit() const;
03066
03076 SQLDBC_DLLEXPORT
03077 void setSQLMode(SQLDBC_SQLMode sqlmode);
03078
03089 SQLDBC_DLLEXPORT
03090 SQLDBC_Retcode setTransactionIsolation(SQLDBC_Int4 isolationlevel);
03091
03098 SQLDBC_DLLEXPORT
03099 SQLDBC_Int4 getTransactionIsolation() const;
03100
03108 SQLDBC_DLLEXPORT
03109 SQLDBC_Bool isConnected() const;
03110
03123 SQLDBC_DLLEXPORT
03124 SQLDBC_Int4 getKernelVersion() const;
03125
03131 SQLDBC_DLLEXPORT
03132 SQLDBC_Bool isUnicodeDatabase() const;
03133
03138 SQLDBC_DLLEXPORT
03139 SQLDBC_DateTimeFormat::Format getDateTimeFormat() const;
03140
03141 private:
03142 friend class SQLDBC_Environment;
03149 SQLDBC_Connection(IFR_Connection *conn);
03150 };
03151
03156 class SQLDBC_Environment
03157 {
03158 public:
03166 SQLDBC_DLLEXPORT
03167 SQLDBC_Environment(SQLDBC_IRuntime* runtime);
03168
03172 SQLDBC_DLLEXPORT
03173 ~SQLDBC_Environment();
03174
03180 SQLDBC_DLLEXPORT
03181 SQLDBC_Connection *createConnection() const;
03182
03188 SQLDBC_DLLEXPORT
03189 SQLDBC_Connection *createConnection(SAPDBMem_IRawAllocator& allocator) const;
03190
03196 SQLDBC_DLLEXPORT
03197 void releaseConnection(SQLDBC_Connection *connection) const;
03198
03212 SQLDBC_DLLEXPORT
03213 const char *getLibraryVersion();
03214
03224 SQLDBC_DLLEXPORT
03225 inline const char *getSDKVersion()
03226 const
03227 {
03228 return SQLDBCHeaderVersion;
03229 };
03230
03234 SQLDBC_DLLEXPORT SAPDBMem_IRawAllocator& getAllocator();
03235
03236 private:
03237 IFR_Environment *m_env;
03238 };
03239
03249 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03250
03260 SQLDBC_DLLEXPORT SQLDBC_IRuntime* GetSingleThreadClientRuntime(char *errorText, const SQLDBC_Int4 errorTextSize);
03261 }
03262
03263
03264 #endif //SQLDBC_H