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

  1. // DBF - (C) Copyright 1994 by Borland International
  2.  
  3. #ifndef __STATEMNT_H
  4. #define __STATEMNT_H
  5.  
  6. #include "envdef.h"
  7. #include "bdbobjec.h"
  8. #include "bcursor.h"
  9.  
  10. class BStatement : public BDbObject {
  11.  
  12. public:
  13.     Retcode lastError;
  14.     BOOL    isOpen;
  15.  
  16. public:
  17.  
  18.     // BStatement constructor
  19.  
  20.     BStatement(BDatabase *db);
  21.  
  22.     // BStatement destructor
  23.  
  24.     ~BStatement();
  25.  
  26.     // Prepare the Query
  27.  
  28.     Retcode open(const char *QryString,
  29.                  DBIQryLang QryLang = qrylangSQL);
  30.  
  31.     // Execute the query
  32.  
  33.     Retcode execute(BCursor &answer);
  34.  
  35.     // Release memory acquired by the statement
  36.  
  37.     Retcode close(void);
  38.  
  39.     // Properties specific to statements
  40.     // Will Add specific function in the future for the individual properties
  41.     //
  42.     // stmtMAXPROPS        //ro UINT16        Number of defined properties
  43.     // stmtPARAMETERCOUNT  //ro UINT16        Count of parameters
  44.     // stmtPARAMETERDESCS  //ro aFLDDesc      Array of parameters
  45.     // stmtUNIDIRECTIONAL  //rw BOOL          Cursor Unidirectional
  46.     // stmtANSTYPE         //rw pBYTE         Table Type of Answer set
  47.     // stmtLIVENESS        //rw LIVENESS      preference for canned/live
  48.     //                                          answers
  49.     // stmtQRYMODE         //rw QryEvalMode   execute on server or local or
  50.     //                                          either
  51.     // stmtBLANKS          //rw BOOL          True if blanks to be regarded as
  52.     //                                          zeros.
  53.     // stmtDATEFORMAT      //rw FMTDate       Date format
  54.     // stmtNUMBERFORMAT    //rw FMTNumber     Number format
  55.     // stmtAUXTBLS         //rw BOOL          True if QBE to create CHANGED,
  56.     //                                          etc.
  57.     // stmtTBLVECTOR       //ro UINT16        Vector of tables generated by
  58.     //                                          query.
  59.     // stmtALLPROPS        //rw QueryLowProps
  60.     // stmtALLPROPSSIZE    //rw INT16         size of QueryLowProps
  61.     // stmtANSNAME         //rw pBYTE         Answer Table Name.
  62.  
  63.     // Set a property of the query
  64.  
  65.     Retcode setProp(UINT32 prop, UINT32 value);
  66.  
  67.     // Set if the answer table is a dynaset
  68.     
  69.     Retcode setLive(LIVENESS live);
  70.  
  71.     // Get a property of the Query
  72.  
  73.     Retcode getProp(UINT32 prop, pVOID value, UINT16 maxLen,
  74.                     UINT16 &retLen);
  75.                             
  76.     // Set the parameters of the query
  77.  
  78.     Retcode setParameters(UINT16 numFields, pFLDDesc fldDescs,
  79.                           pBYTE recBuf);
  80.  
  81.     // Get the handle of the statement. WARNING: be carefull when using the
  82.     // handle outside of the class.
  83.  
  84.     hDBIStmt getHandle(void);
  85.  
  86.     // Redefine pure virtuals from the BDbObject class.
  87.  
  88.     virtual char *nameOf() const;
  89.     virtual void printOn(ostream& os);
  90.  
  91.  
  92. protected:
  93.  
  94.     hDBIStmt        hStmt;
  95.     BDatabase       *stmtDb;
  96.  
  97.     // Don't allow the copy constructor to be called unless specifically
  98.     //   defined
  99.     BStatement(BStatement ©Cur);
  100.     // Don't allow the assignment opperator to be called unless specifically
  101.     //   defined
  102.  
  103.     BStatement& operator=(BStatement ©DB);
  104. };
  105.  
  106. #endif