home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / code / kdbf / bengine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  6.5 KB  |  210 lines

  1. /*********************************************************************
  2. **
  3. **                          BENGINE.H
  4. **
  5. ** This file defines the interface of the BEngine class. 
  6. ** This class contains methods for connecting to the IDAPI
  7. ** engine and performing engine-level operations.
  8. **
  9. *********************************************************************/
  10.  
  11. // DBF - (C) Copyright 1994 by Borland International
  12.  
  13. #ifndef BENGINE_H
  14. #define BENGINE_H
  15.  
  16. #include "envdef.h"
  17. #include "bdbobjec.h"
  18. #include "blistcur.h"
  19.  
  20. class BEngine : public BDbObject {
  21.  
  22.     friend class BDatabase;
  23.     friend class BCursor;
  24.  
  25. public:
  26.     Retcode     lastError;
  27.     BOOL        isOpen;
  28.     BEngineType engineType;
  29.  
  30. public:
  31.     
  32.     // This constructor makes a C++ BEngine object without actually opening
  33.     // the Paradox engine.
  34.  
  35.     BEngine();
  36.  
  37.     // This constructor makes a C++ BEngine object and actually opens the
  38.     // Paradox engine in the requested mode using default parameters.
  39.  
  40.     BEngine(BEngineType eType);
  41.  
  42.     // This constructor makes a C++ BEngine object and actually opens the
  43.     // Paradox engine in the requested mode using suppiled parameters.
  44.  
  45.     BEngine(const BEnv& env);
  46.  
  47.     // Destructor; Closes the engine if it's open.
  48.  
  49.     virtual ~BEngine();
  50.  
  51.     // Sets the engine type and various other parameters.
  52.  
  53.     virtual Retcode setDefaults(const BEnv& env);
  54.  
  55.     // Open the Paradox Engine based on a previously set  environment.
  56.  
  57.     virtual Retcode open(void);
  58.  
  59.     // Close the currently open engine.
  60.  
  61.     virtual Retcode close(void);
  62.  
  63.     // Get the current values of all engine configuration parameters.
  64.  
  65.     virtual void getDefaults(BEnv& env) const;
  66.  
  67.     // Enable or Disable the internal harware error handler.
  68.  
  69.     Retcode setHWHandler(BOOL ehEnable);
  70.  
  71.     // Add a password to the engine's password list.
  72.  
  73.     Retcode addPassword(char *password);
  74.  
  75.     // Set the maximum size of for tables created with this engine.
  76.  
  77.     Retcode setMaxTblSize(int maxSize);
  78.  
  79.     // Set the table create mode for the engine (3.5 or 4.0 file format).
  80.  
  81.     Retcode setTblCreateMode(PXTabCrtMode crtMode);
  82.  
  83.     // Delete a previously entered password.
  84.  
  85.     Retcode deletePassword(char *password);
  86.  
  87.     // Find the name of the current user in the shared environment.
  88.  
  89.     char *getUsername(void);
  90.  
  91.     // Get the error message corresponding to a error number.
  92.  
  93.     virtual char far *getErrorMessage(int errnbr);
  94.  
  95.     virtual Retcode getErrorContext(INT16 context, char far *message);
  96.     virtual Retcode getErrorEntry(UINT16 entry, UINT32 &nativeCode,
  97.                                   char far *message);
  98.     virtual Retcode GetErrorInfo(DBIErrInfo &errorInfo);
  99.     
  100.     // Get the handle of the current session.
  101.     
  102.     hDBISes getHandle(void);
  103.  
  104.     // Session functions
  105.   
  106.     // Sets the private directory for the current session -
  107.     // all temporary or auxiliary tables are created in this
  108.     // directory.
  109.  
  110.     // Note - these functions are not fully supported by the
  111.     //        KDBF. Closing one of the sessions will not
  112.     //        automatically close the KDBF wrapper for child
  113.     //        objects, such as BDatabase and BCursor objects.
  114.  
  115.     Retcode startSession(hDBISes &sessionHandle,
  116.                          const char *netFile = NULL);
  117.                                  
  118.     Retcode getCurrSession(hDBISes &sessionHandle);
  119.     
  120.     Retcode setCurrSession(hDBISes &sessionHandle);
  121.  
  122.     Retcode closeSession(hDBISes &sessionHandle);
  123.  
  124.     Retcode getSessionInfo(SESInfo &sessionInfo);
  125.  
  126.     Retcode setPrivateDir(const char *Directory);
  127.  
  128.     Retcode getPrivateDir(char *Directory);
  129.  
  130.     Retcode getSysVersion(UINT16 &version, UINT16 &interfaceLevel,
  131.                           DATE &versionDate, TIME &versionTime);
  132.  
  133.     Retcode getSysConfig(BOOL   &localShare, UINT16 &netProtocol,
  134.                          BOOL   &netShare, CHAR   *netType,
  135.                          CHAR   *userName, CHAR   *iniFile,
  136.                          CHAR   *langDriver);
  137.  
  138.     Retcode getClientInfo(CHAR   *name,
  139.                           UINT16 &sessions,
  140.                           CHAR   *workingDirectory,
  141.                           CHAR   *language);
  142.  
  143.     Retcode getSysInfo(UINT16 &bufferSpace,
  144.                        UINT16 &heapSpace,
  145.                        UINT16 &drivers,
  146.                        UINT16 &clients,
  147.                        UINT16 &sessions,
  148.                        UINT16 &databases,
  149.                        UINT16 &cursors);
  150.  
  151.     Retcode openDriverList(BListCursor<DRVType> &driverList);
  152.  
  153.     Retcode openDatabaseList(BListCursor<DBDesc> &databaseList);
  154.  
  155.     Retcode openTableTypesList(BListCursor<TBLType> &tableTypesList,
  156.                                const char *driver = szPARADOX);
  157.  
  158.     Retcode openFieldTypesList(BListCursor<FLDType> &fieldTypesList,
  159.                                const char *driver = szPARADOX,
  160.                                const char *tableType = NULL);
  161.  
  162.     Retcode openIndexTypesList(BListCursor<IDXType> &indexTypesList,
  163.                                const char *driver = szPARADOX);
  164.  
  165.     Retcode openLanguageDriverList(BListCursor<LDDesc> &langaugeDriverList);
  166.  
  167.     Retcode openUserList(BListCursor<USERDesc> &userList);
  168.  
  169.     Retcode openCfgInfoList(BListCursor<CFGDesc> &cfgList, const char *cfgPath,
  170.                             hDBICfg cfgH = NULL,
  171.                             DBIOpenMode openMode = dbiREADONLY,
  172.                             CFGMode cfgMode = cfgPersistent);
  173.  
  174.     virtual Retcode useIdleTime(void);
  175.  
  176.     Retcode registerCallBack(CBType callBackType, UINT32 clientData,
  177.                              UINT16 callBackBufferLength,
  178.                              pVOID callBackBuffer,
  179.                              pfDBICallBack callBackFunction);
  180.  
  181.     Retcode getCallBack(CBType callBackType, UINT32 &clientData,
  182.                         UINT16 &callBackBufferLength,
  183.                         ppVOID callBackBuffer,
  184.                         ppfDBICallBack callBackFunction);
  185.  
  186.  
  187.     // pure virtuals from the BDbObject class.
  188.  
  189.     virtual char *nameOf() const;
  190.     virtual void printOn( ostream& os);
  191.  
  192. protected:
  193.     // Don't allow the copy constructor to be called unless specifically
  194.     // defined
  195.  
  196.     BEngine(BEngine ©Cur);
  197.  
  198.     // Don't allow the assignment opperator to be called unless specifically
  199.     // defined
  200.  
  201.     BEngine& operator=(BEngine ©Eng);
  202.  
  203. private:
  204.     void  *engobj;  // variable used to keep track of
  205.                     // engine's objects.
  206. };
  207.  
  208. #endif
  209.  
  210.