home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / sybase / starbuck / hpp.z / WTRANSAC.HPP < prev    next >
C/C++ Source or Header  |  1996-10-18  |  22KB  |  822 lines

  1. /*************************************************************************
  2.  *
  3.  * WTransaction -- WClass Transaction object.
  4.  *
  5.  *************************************************************************/
  6.  
  7. #ifndef _WTRANSAC_HPP_INCLUDED
  8. #define _WTRANSAC_HPP_INCLUDED
  9.  
  10. #ifndef _WDATAERR_HPP_INCLUDED
  11. #include "wdataerr.hpp"
  12. #endif
  13. #ifndef _WDATAOBJ_HPP_INCLUDED
  14. #include "wdataobj.hpp"
  15. #endif
  16. #ifndef _WVECTOR_HPP_INCLUDED
  17. #include "wvector.hpp"
  18. #endif
  19. #ifndef _WQUERY_HPP_INCLUDED
  20. #include "wquery.hpp"
  21. #endif
  22.  
  23. extern template WVector<WQuery>;
  24.  
  25. //
  26. // Bytes used to hold messages
  27. //
  28.  
  29. #define WT_STATE_LEN            6
  30. #define WT_ERRORMESSAGE_LEN     2048
  31. #define WT_CONNSTR_LEN          1024
  32. #define WT_DSNAME_LEN           256
  33. #define WT_DSDESC_LEN           1024
  34. #define WT_OPTION_VALUE_LEN     512
  35.  
  36. //
  37. // Flags used with the List method
  38. //
  39.  
  40. #define WTF_INDEX_UNIQUE        0x00000001
  41. #define WTF_ENSURE_VALIDITY     0x00000002
  42.  
  43. //
  44. // WTListType
  45. //
  46. // Standard list types returned by the List method
  47. //
  48.  
  49. enum WTListType {
  50.     WTLColumnPrivileges = 1,
  51.     WTLColumns,
  52.     WTLForeignKeys,
  53.     WTLIndexes,
  54.     WTLPrimaryKeys,
  55.     WTLProcedureColumns,
  56.     WTLProcedures,
  57.     WTLTablePrivileges,
  58.     WTLTables,
  59.  
  60.     WTLLASTLISTTYPE = LAST_32BIT
  61. };
  62.  
  63. //
  64. // WTOptionID
  65. //
  66. // Standard option ids for use with Get*Option and Set*Option.
  67. // Values match those for the corresponding ODBC connection options for
  68. // convenience.
  69. //
  70.  
  71. enum WTOptionID {
  72.     WTONULLOPTION = 0,
  73.  
  74.     WTOAccessMode = SQL_ACCESS_MODE,
  75.     WTOAutoCommit = SQL_AUTOCOMMIT,
  76.     WTOCurrentQualifier = SQL_CURRENT_QUALIFIER,
  77.     WTOIsolationLevel = SQL_TXN_ISOLATION,
  78.     WTOLoginTimeout = SQL_LOGIN_TIMEOUT,
  79.     WTOODBCCursors = SQL_ODBC_CURSORS,
  80.     WTOPacketSize = SQL_PACKET_SIZE,
  81.     WTOQuietMode = SQL_QUIET_MODE,
  82.     WTOTrace = SQL_OPT_TRACE,
  83.     WTOTraceFile = SQL_OPT_TRACEFILE,
  84.     WTOTranslateDll = SQL_TRANSLATE_DLL,
  85.     WTOTranslateOption = SQL_TRANSLATE_OPTION,
  86.     WTOCursorDriver = SQL_ODBC_CURSORS,
  87.  
  88.     WTOLASTSTANDARDOPTION = SQL_CONNECT_OPT_DRVR_START - 1,
  89.  
  90.     WTOLASTOPTION = LAST_32BIT
  91. };
  92.  
  93. //
  94. // WTOptionInfo
  95. //
  96. // Hold information about an option -- used to implement GetOptionInfo.
  97. //
  98.  
  99. struct WTOptionInfo {
  100.     WTOptionID          id;
  101.     const WChar *       name;
  102.     WBool               isString;       // isNumeric otherwise
  103. };
  104.  
  105. //
  106. // Possible property values.
  107. //
  108. // These match ODBC for convenience.
  109. //
  110.  
  111. //
  112. // WTAccessMode
  113. //
  114.  
  115. enum WTAccessMode {
  116.     WTAMUnknown = -1,
  117.     WTAMReadOnly = SQL_MODE_READ_ONLY,
  118.     WTAMReadWrite = SQL_MODE_READ_WRITE
  119. };
  120.  
  121. //
  122. // WTBookmarkPersistence
  123. //
  124.  
  125. typedef WDWord WTBookmarkPersistence;
  126.  
  127. #define WTBPUnknown          0x80000000
  128. #define WTBPClose            SQL_BP_CLOSE
  129. #define WTBPDelete           SQL_BP_DELETE
  130. #define WTBPDrop             SQL_BP_DROP
  131. #define WTBPScroll           SQL_BP_SCROLL
  132. #define WTBPTransaction      SQL_BP_TRANSACTION
  133. #define WTBPUpdate           SQL_BP_UPDATE
  134. #define WTBPOtherStatement   SQL_BP_OTHER_HSTMT
  135.  
  136. //
  137. // WTFetchDirection
  138. //
  139.  
  140. typedef WDWord WTFetchDirection;
  141.  
  142. #define WTFDUnknown    0x80000000
  143. #define WTFDNext       SQL_FD_FETCH_NEXT
  144. #define WTFDFirst      SQL_FD_FETCH_FIRST
  145. #define WTFDLast       SQL_FD_FETCH_LAST
  146. #define WTFDPrevious   SQL_FD_FETCH_PRIOR
  147. #define WTFDAbsolute   SQL_FD_FETCH_ABSOLUTE
  148. #define WTFDRelative   SQL_FD_FETCH_RELATIVE
  149. #define WTFDBookmark   SQL_FD_FETCH_BOOKMARK
  150.  
  151. //
  152. // WTIsolationLevel
  153. //
  154.  
  155. enum WTIsolationLevel {
  156.     WTILUnknown          = 0xFFFFFFFF,
  157.     WTILReadUncommitted  = SQL_TXN_READ_UNCOMMITTED,
  158.     WTILReadCommitted    = SQL_TXN_READ_COMMITTED,
  159.     WTILRepeatableRead   = SQL_TXN_REPEATABLE_READ,
  160.     WTILSerializable     = SQL_TXN_SERIALIZABLE,
  161.     WTILVersioning       = SQL_TXN_VERSIONING
  162. };
  163.  
  164. //
  165. // WTLoginPrompt
  166. //
  167.  
  168. enum WTLoginPrompt {
  169.     WTLPAlways = SQL_DRIVER_PROMPT,
  170.     WTLPIfRequired = SQL_DRIVER_COMPLETE_REQUIRED,
  171.     WTLPNever = SQL_DRIVER_NOPROMPT
  172. };
  173.  
  174. //
  175. // WTStaticSensitivity
  176. //
  177.  
  178. typedef WDWord WTStaticSensitivity;
  179.  
  180. #define WTSSUnknown   0x80000000
  181. #define WTSSAdditions SQL_SS_ADDITIONS
  182. #define WTSSDeletions SQL_SS_DELETIONS
  183. #define WTSSUpdates   SQL_SS_UPDATES
  184.  
  185. //
  186. // WTCursorTypes
  187. //
  188.  
  189. typedef WDWord WTCursorTypes;
  190.  
  191. #define WTCTForwardOnly  SQL_SO_FORWARD_ONLY
  192. #define WTCTStatic       SQL_SO_STATIC
  193. #define WTCTKeysetDriven SQL_SO_KEYSET_DRIVEN
  194. #define WTCTDynamic      SQL_SO_DYNAMIC
  195. #define WTCTMixed        SQL_SO_MIXED
  196.  
  197. //
  198. // WTUpdateTypes
  199. //
  200.  
  201. typedef WDWord WTUpdateTypes;
  202.  
  203. //
  204. // bitmask for supported update types.
  205. //
  206.  
  207. #define WTUTNone      0x01
  208. #define WTUTDirect    0x02
  209. #define WTUTCursor    0x04
  210. #define WTUTKey       0x08
  211.  
  212. //
  213. // WTCursorDriver
  214. //
  215.  
  216. enum WTCursorDriver {
  217.     WTCDSimulateIfNeeded = SQL_CUR_USE_IF_NEEDED,
  218.     WTCDSimulate = SQL_CUR_USE_ODBC,
  219.     WTCDNative = SQL_CUR_USE_DRIVER
  220. };
  221.  
  222. //
  223. // WTQualifierLocation
  224. //
  225.  
  226. enum WTQualifierLocation {
  227.     WTQLStart = SQL_QL_START,
  228.     WTQLEnd = SQL_QL_END
  229. };
  230.  
  231. //
  232. // WTFileUsage
  233. //
  234.  
  235. enum WTFileUsage {
  236.     WTFUNotSupported = SQL_FILE_NOT_SUPPORTED,
  237.     WTFUTable = SQL_FILE_TABLE,
  238.     WTFUQualifier = SQL_FILE_QUALIFIER,
  239. };
  240.  
  241. //
  242. // WTCursorCommitBehaviour, WTCursorRollbackBehaviour values
  243. //
  244.  
  245. #define WTCBUnknown  -1
  246. #define WTCBDelete   SQL_CB_DELETE
  247. #define WTCBClose    SQL_CB_CLOSE
  248. #define WTCBPreserve SQL_CB_PRESERVE
  249.  
  250. //
  251. // WTCursorRollbackBehaviour
  252. //
  253. typedef WShort WTCursorCommitBehavior;
  254. typedef WShort WTCursorRollbackBehavior;
  255.  
  256. //
  257. // ListSource
  258. //
  259. // Used with the List* methods to specify a table, column, procedure, ...
  260. //
  261.  
  262. class WCMCLASS WTListSource {
  263.  
  264.     public:
  265.  
  266.         WTListSource();
  267.  
  268.         ~WTListSource();
  269.  
  270.         WString         qualifier;
  271.         WString         owner;
  272.         WString         name;
  273.         WString         column;
  274.         WString         type;           // TABLE, VIEW, PROCEDURE, etc.
  275. };
  276.  
  277. //
  278. // WTransaction
  279. //
  280.  
  281. class WCMCLASS WTransaction : public WObject {
  282.  
  283.     WDeclareSubclass( WTransaction, WObject );
  284.  
  285.     public:
  286.  
  287.         WTransaction();
  288.  
  289.         virtual ~WTransaction();
  290.  
  291.         /***************************************************************
  292.          * Properties
  293.          ***************************************************************/
  294.  
  295.         // AccessMode
  296.         //
  297.         //    Set the access mode for the connection. Read/write by
  298.         //    default.
  299.  
  300.         virtual WTAccessMode GetAccessMode() const;
  301.         virtual WBool        SetAccessMode( WTAccessMode accessMode );
  302.  
  303.         // AutoCommit
  304.         //
  305.         //    Controls whether operations on the database are
  306.         //    committed automatically.
  307.  
  308.         virtual WBool GetAutoCommit() const;
  309.         virtual WBool SetAutoCommit( WBool autoCommit );
  310.  
  311.         // BookmarkPersistence
  312.         //
  313.         //    Returns a set of flags describing the bookmark
  314.         //    persistence.
  315.  
  316.         virtual WTBookmarkPersistence GetBookmarkPersistence() const;
  317.  
  318.         // Connected
  319.         //
  320.         //    Returns TRUE if a connection is active.
  321.  
  322.         virtual WBool GetConnected() const;
  323.  
  324.         // ConnectionHandle
  325.         //
  326.         //    ConnectionHandle is a read-only property.
  327.  
  328.         virtual WDWord GetConnectionHandle() const;
  329.  
  330.         // ConnectParams
  331.         //
  332.         //    Database-specific string used when connecting.
  333.  
  334.         virtual WString GetConnectParams() const;
  335.         virtual WBool   SetConnectParams( const WString & connectParams );
  336.  
  337.         // CursorDriver
  338.         //
  339.         //    Determines if cursor scrolling should be simulated
  340.         //    or whether the native driver should be used.  The
  341.         //    default is to use the native driver.
  342.  
  343.         virtual WTCursorDriver GetCursorDriver() const;
  344.         virtual WBool          SetCursorDriver( WTCursorDriver driv );
  345.  
  346.         // DataSource
  347.         //
  348.         //    Identifies the database to use.
  349.  
  350.         virtual WString GetDataSource() const;
  351.         virtual WBool   SetDataSource( const WString & dataSource );
  352.  
  353.         // DBMSName
  354.         //
  355.         //    Identifies the type of database interface to use.  The
  356.         //    default is "ODBC".
  357.  
  358.         virtual WString GetDBMSName() const;
  359.         virtual WBool   SetDBMSName( const WString & dbmsName );
  360.  
  361.         // DisplayErrorDialog
  362.         //
  363.         //    When an error occurs, display a dialog describing the
  364.         //    error.  TRUE by default.
  365.  
  366.         virtual WBool GetDisplayErrorDialog() const;
  367.         virtual WBool SetDisplayErrorDialog( WBool display );
  368.  
  369.         // DisplayWarningDialog
  370.         //
  371.         //    When a warning occurs, display a dialog describing the
  372.         //    warning.  FALSE by default.
  373.  
  374.         virtual WBool GetDisplayWarningDialog() const;
  375.         virtual WBool SetDisplayWarningDialog( WBool display );
  376.  
  377.         // Driver
  378.         //
  379.         //    Return a pointer to the underlying WTransaction subclass.
  380.  
  381.         virtual WTransaction *GetDriver() const;
  382.  
  383.         // EnvironmentHandle
  384.         //
  385.         //    EnvironmentHandle is a read-only property.
  386.  
  387.         virtual WDWord GetEnvironmentHandle() const;
  388.  
  389.         // ErrorCode
  390.         //
  391.         //    Returns the error code of the last driver operation.
  392.         //    Can optionally return a code specifying which driver
  393.         //    API was called (driver-specific).
  394.  
  395.         virtual WLong GetErrorCode( WLong *apiFunc = NULL ) const;
  396.  
  397.         // ErrorList
  398.         //
  399.         //    Returns the list of errors from the last operation.
  400.  
  401.         virtual WDataErrorArray GetErrorList() const;
  402.  
  403.         // FetchDirection
  404.         //
  405.         //    Returns which fetch operations are supported by the
  406.         //    database.  Read-only.
  407.  
  408.         virtual WTFetchDirection GetFetchDirection() const;
  409.  
  410.         // FileUsage
  411.         //
  412.         //    Determines how files are treated (as databases or tables).
  413.  
  414.         virtual WTFileUsage GetFileUsage() const;
  415.  
  416.         // IsolationLevel
  417.         //
  418.         //
  419.  
  420.         virtual WTIsolationLevel GetIsolationLevel() const;
  421.         virtual WBool            SetIsolationLevel( WTIsolationLevel level );
  422.  
  423.         // LoginID
  424.         //
  425.         //    The login ID for the server (optional).
  426.  
  427.         virtual WString GetLoginID() const;
  428.         virtual WBool   SetLoginID( const WString & lid );
  429.  
  430.         // LoginPassword
  431.         //
  432.         //    The login password for the server (optional).
  433.  
  434.         virtual WString GetLoginPassword() const;
  435.         virtual WBool   SetLoginPassword( const WString & pwd );
  436.  
  437.         // LoginPrompt
  438.         //
  439.         //
  440.  
  441.         virtual WTLoginPrompt GetLoginPrompt() const;
  442.         virtual WBool         SetLoginPrompt( WTLoginPrompt prompt );
  443.  
  444.         // MaxOptionIndex
  445.         //
  446.         //    Index of the last option (largest index value that may be passed
  447.         //    to GetOptionInfo).
  448.  
  449.         virtual WLong GetMaxOptionIndex() const;
  450.  
  451.         // NumericOption
  452.         //
  453.         //
  454.  
  455.         virtual WLong GetNumericOption( WTOptionID id ) const;
  456.         virtual WBool SetNumericOption( WTOptionID id, const WLong value );
  457.  
  458.         // Password
  459.         //
  460.         //
  461.  
  462.         virtual WString GetPassword() const;
  463.         virtual WBool   SetPassword( const WString & password );
  464.  
  465.         // ServerName
  466.         //
  467.         //    The name of the server (optional).
  468.  
  469.         virtual WString GetServerName() const;
  470.         virtual WBool   SetServerName( const WString & server );
  471.  
  472.         // QualifierLocation
  473.         //
  474.         //    The location of the qualifier in a fully qualified table
  475.         //    name.
  476.  
  477.         virtual WTQualifierLocation GetQualifierLocation() const;
  478.  
  479.         // QualifierSeparator
  480.         //
  481.         //    The string that separates the qualifier from the rest
  482.         //    of the table name.
  483.  
  484.         virtual WString GetQualifierSeparator() const;
  485.  
  486.         // StaticSensitivity
  487.         //
  488.         //    Returns whether static or keyset cursors know about changes
  489.         //    made by the current user.
  490.  
  491.         virtual WTStaticSensitivity GetStaticSensitivity() const;
  492.  
  493.         // StringOption
  494.         //
  495.         //
  496.  
  497.         virtual WString GetStringOption( WTOptionID id ) const;
  498.         virtual WBool   SetStringOption( WTOptionID id, const WString & value );
  499.  
  500.         // SupportedCursorTypes
  501.         //
  502.         //    Returns a mask of supported cursor types.
  503.  
  504.         virtual WTCursorTypes GetSupportedCursorTypes() const;
  505.  
  506.         // SupportedUpdateTypes
  507.         //
  508.         //    Returns a mask of supported update types.
  509.  
  510.         virtual WTUpdateTypes GetSupportedUpdateTypes() const;
  511.  
  512.         // SupportsBookmarks
  513.         //
  514.         //    Returns TRUE if the database supports bookmarks.  Read-only.
  515.  
  516.         WBool GetSupportsBookmarks() const;
  517.  
  518.         // TraceToLog
  519.         //
  520.         //    In debug mode, if TRUE traces important actions
  521.         //    to the debug log.  Has no effect for release mode
  522.         //    applications.  (This is not the same as the ODBC
  523.         //    trace log.)
  524.  
  525.         virtual WBool GetTraceToLog() const;
  526.         virtual WBool SetTraceToLog( WBool on );
  527.  
  528.         // Userid
  529.         //
  530.         //
  531.  
  532.         virtual WString GetUserid() const;
  533.         virtual WBool   SetUserid( const WString & userid );
  534.  
  535.         // CursorCommitBehavior
  536.         //
  537.         //    Returns how a COMMIT operation affects cursors and prepared
  538.         //    statements in the data source.
  539.         //
  540.  
  541.         virtual WTCursorCommitBehavior GetCursorCommitBehavior() const;
  542.  
  543.         // CursorRollbackBehavior
  544.         //
  545.         //    Returns how a ROLLBACK operation affects cursors and prepared
  546.         //    statements in the data source.
  547.         //
  548.  
  549.         virtual WTCursorRollbackBehavior GetCursorRollbackBehavior() const;
  550.  
  551.         /***************************************************************
  552.          * Methods
  553.          ***************************************************************/
  554.  
  555.         // Commit
  556.         //
  557.         //
  558.  
  559.         virtual WBool Commit();
  560.  
  561.         // Connect
  562.         //
  563.         //
  564.  
  565.         virtual WBool Connect( WWindow *parent = NULL );
  566.  
  567.         // Create
  568.         //
  569.         //
  570.  
  571.         virtual WBool Create();
  572.         virtual WBool Create( const WString & dbmsName );
  573.  
  574.         // Destroy
  575.         //
  576.         //
  577.  
  578.         virtual WBool Destroy();
  579.  
  580.         // Disconnect
  581.         //
  582.         //
  583.  
  584.         virtual WBool Disconnect();
  585.  
  586.         // FetchErrors
  587.         //
  588.         //    Clear the current error list and fetch errors from the
  589.         //    driver for later retrieval with
  590.         //    GetErrorList.  Note that this function is called automatically
  591.         //    by most of the other methods, so you should only call it
  592.         //    after directly invoking an operation on the driver.
  593.         //    You pass in the return code and function code of the
  594.         //    last operation.  Returns TRUE if messages were fetched
  595.         //    from the driver.
  596.  
  597.         virtual WBool FetchErrors( WLong errorCode, WLong funcCode );
  598.  
  599.         // List
  600.         //
  601.         //    Pass NULL for parameters that are not required.
  602.  
  603.         virtual WBool List( WQuery & query, WTListType type,
  604.                             const WTListSource *source,
  605.                             const WTListSource *source2 = NULL,
  606.                             WDWord flags = WTF_ENSURE_VALIDITY );
  607.  
  608.         // ListColumnPrivileges
  609.         //
  610.         //
  611.  
  612.         WBool ListColumnPrivileges( WQuery & query,
  613.                                     const WString & qualifier,
  614.                                     const WString & owner,
  615.                                     const WString & name,
  616.                                     const WString & column );
  617.  
  618.         // ListColumns
  619.         //
  620.         //
  621.  
  622.         WBool ListColumns( WQuery & query,
  623.                            const WString & qualifier,
  624.                            const WString & owner,
  625.                            const WString & name,
  626.                            const WString & column );
  627.  
  628.         // ListForeignKeys
  629.         //
  630.         //
  631.  
  632.         WBool ListForeignKeys( WQuery & query,
  633.                                const WString & primaryQualifier,
  634.                                const WString & primaryOwner,
  635.                                const WString & primaryName,
  636.                                const WString & foreignQualifier,
  637.                                const WString & foreignOwner,
  638.                                const WString & foreignName );
  639.  
  640.         // ListIndexes
  641.         //
  642.         //
  643.  
  644.         WBool ListIndexes( WQuery & query,
  645.                            const WString & qualifier,
  646.                            const WString & owner,
  647.                            const WString & name,
  648.                            WBool uniqueOnly = FALSE,
  649.                            WBool ensureValidity = TRUE );
  650.  
  651.         // ListPrimaryKeys
  652.         //
  653.         //
  654.  
  655.         WBool ListPrimaryKeys( WQuery & query,
  656.                                const WString & qualifier,
  657.                                const WString & owner,
  658.                                const WString & name );
  659.  
  660.         // ListProcedureColumns
  661.         //
  662.         //
  663.  
  664.         WBool ListProcedureColumns( WQuery & query,
  665.                                     const WString & qualifier,
  666.                                     const WString & owner,
  667.                                     const WString & name,
  668.                                     const WString & column );
  669.  
  670.         // ListProcedures
  671.         //
  672.         //
  673.  
  674.         WBool ListProcedures( WQuery & query,
  675.                               const WString & qualifier,
  676.                               const WString & owner,
  677.                               const WString & name );
  678.  
  679.         // ListTablePrivileges
  680.         //
  681.         //
  682.  
  683.         WBool ListTablePrivileges( WQuery & query,
  684.                                    const WString & qualifier,
  685.                                    const WString & owner,
  686.                                    const WString & name );
  687.  
  688.         // ListTables
  689.         //
  690.         //
  691.  
  692.         WBool ListTables( WQuery & query,
  693.                           const WString & qualifier,
  694.                           const WString & owner,
  695.                           const WString & name,
  696.                           const WString & type );
  697.  
  698.         // Rollback
  699.         //
  700.         //
  701.  
  702.         virtual WBool Rollback();
  703.  
  704.         /***************************************************************
  705.          * Item Properties
  706.          ***************************************************************/
  707.  
  708.         // DataSourceInfo
  709.         //
  710.         //
  711.  
  712.         virtual WBool GetDataSourceInfo( WString *name, WString *description,
  713.                                          WBool getFirst = FALSE ) const;
  714.  
  715.         // OptionInfo
  716.         //
  717.         //
  718.  
  719.         virtual WBool GetOptionInfo( WTOptionID & id, WString & name,
  720.                                      WBool *isString = NULL,
  721.                                      WLong index = -1 ) const;
  722.  
  723.         /***************************************************************
  724.          * Query object interface functions
  725.          ***************************************************************/
  726.  
  727.         // AddQuery
  728.         //
  729.         //
  730.  
  731.         virtual WBool AddQuery( WQuery *query );
  732.  
  733.         // RemoveQuery
  734.         //
  735.         //
  736.  
  737.         virtual WBool RemoveQuery( WQuery *query );
  738.  
  739.         // RemoveAllQueries
  740.         //
  741.         //    Calls SetTransactionObject(NULL) on each query object.
  742.  
  743.         virtual WBool RemoveAllQueries();
  744.  
  745.         // NotifyQueries
  746.         //
  747.         //
  748.  
  749.         virtual WBool NotifyQueries( WEventID id, WEventData *data=NULL );
  750.  
  751.         /****************************************************************
  752.          * Deprecated
  753.          ****************************************************************/
  754.  
  755.         virtual WBool GetErrorInfo( WString *errorMessage,
  756.                                     WString *state = NULL,
  757.                                     WLong *nativeErrorCode = NULL ) const;
  758.  
  759.         /****************************************************************
  760.          * Internal
  761.          ****************************************************************/
  762.  
  763.     private:
  764.  
  765.         // AllocateTransaction
  766.         //
  767.         //
  768.  
  769.         WBool AllocateTransaction();
  770.  
  771.     protected:
  772.  
  773.         WVector<WQuery>         _queries;       // attached WQuery objects
  774.         WTransaction *          _trans;         // transaction driver
  775.         WString                 _dbmsName;
  776.         WBool                   _traceToLog;
  777.         WULong                  _traceLevel;
  778.  
  779.         #ifdef _DEBUG
  780.  
  781.         class WCMCLASS TTrace {
  782.             public:
  783.                 TTrace( const WTransaction *, const WChar * );
  784.                 ~TTrace();
  785.  
  786.                 const WTransaction *transaction;
  787.                 const WChar        *function;
  788.         };
  789.  
  790.         friend class TTrace;
  791.  
  792.         void TDbg( const TTrace *q, const WChar *format, ... ) const;
  793.  
  794.         #endif
  795. };
  796.  
  797. class WCMCLASS WTransactionFactory : public WObject {
  798.  
  799.     protected:
  800.  
  801.         WTransactionFactory();
  802.  
  803.         ~WTransactionFactory();
  804.  
  805.     public:
  806.  
  807.         static WTransactionFactory *GetFactoryObject();
  808.  
  809.         static WTransaction *Allocate( const WString & dbmsName, WTransaction *proxy );
  810.  
  811.         static void Register( WTransaction * WCMDEF (*func)( const WString &, WTransaction * ) );
  812.         static void Deregister( WTransaction * WCMDEF (*func)( const WString &, WTransaction * ) );
  813.  
  814.     protected:
  815.         wllist_header                list;
  816.  
  817.     private:
  818.         static WTransactionFactory *_theObject;
  819. };
  820.  
  821. #endif
  822.