;;blob.cpp
;;
;;TBlob::TBlob(const string & field_name, const string & init_data)
;;
;;TBlob::TBlob( const TBlob & other )
;;
;;TBlob::~TBlob()
;;
;;TBlob&
;;TBlob::operator = ( const TBlob & other )
;;
;;void
;;TBlob::Read( const TBRecord & rawRec )
;;
;;void
;;TBlob::Write( TBRecord & rawRec ) const
;;
;;TBlobRO::TBlobRO( const string& field_name,
;;                      const TBRecord& rawRec )
;;
;;  TBlobRO constructor--open blob for reading a segment at a time
;;
;;  Entry:
;;    rawRec must be attached to an open TBCursor
;;
;;TBlobRO::TBlobRO( const TBlobRO& other )
;;
;;  TBlobRO copy constructor--open blob for reading a segment at a time
;;
;;  **Not tested (or fully defined) as of 950705
;;
;;TBlobRO::~TBlobRO()
;;
;;UINT16
;;TBlobRO::GetString( string& str,
;;                    UINT16 maxLen = 0 ) const
;;
;;  **Not implemented as of 950706
;;
;;  Buffered read from blob
;;
;;  Get up to maxLen chrs into string (not incl. c_str() term-null)
;;
;;
;;UINT16
;;TBlobRO::Read() const
;;
;;  Read up to maxSegsize or bytes remaining in BLOB, whichever is
;;  lesser, reading from where last Read() left off
;;
;;  Return:
;;    Number of bytes read, 0 if EOB
;;  Exit:
;;    Data() is pointer to what is read
;;
;;TBlobRW::TBlobRW( const string& field_name,
;;                        TBRecord& rawRec )
;;
;;  TBlobRW constructor--open blob for writing a segment at a time
;;
;;  Entry:
;;    rawRec must be attached to an open TBCursor
;;
;;TBlobRW::TBlobRW( const TBlobRW& other )
;;
;;  TBlobRW copy constructor--open blob for writing a segment at a time
;;
;;  **Not tested (or fully defined) as of 950705
;;
;;TBlobRW::~TBlobRW()
;;
;;UINT16
;;TBlobRW::GetString( string& str,
;;                    UINT16 maxLen = 0 ) const
;;
;;  **Not implemented as of 950706
;;
;;  Buffered read from blob
;;
;;  Get up to maxLen chrs into string (not incl. c_str() term-null)
;;
;;  Return:
;;    Number of bytes read (not incl. term-null)
;;
;;void
;;TBlobRW::PutString( const string& str )
;;
;;  **Not implemented as of 950706
;;
;;  Buffered write to blob
;;
;;  Put contents of string to blob
;;
;;  Return:
;;    none
;;
;;void
;;TBlobRW::Write( unsigned char* str,
;;                UINT16 len )
;;
;;  Write len bytes to BLOB, appending to previous Write() calls
;;
;;blob.h
;;
;;inline
;;unsigned char*
;;TBlobRO::Data()
;;
;;inline
;;string
;;TBlobRO::Field() const
;;
;;inline
;;long
;;TBlobRO::Offset() const
;;
;;inline
;;const TBRecord&
;;TBlobRO::Rec() const
;;
;;inline
;;void
;;TBlobRO::SetOffset( long offsetArg ) const
;;
;;inline
;;void
;;TBlobRO::SetOffsetToEnd( long offsetArg ) const
;;
;;  Set offset to end (to append to blob)
;;
;;inline
;;long
;;TBlobRO::SizeBlob() const
;;
;;inline
;;unsigned char*
;;TBlobRW::Data()
;;
;;inline
;;string
;;TBlobRW::Field() const
;;
;;inline
;;long
;;TBlobRW::Offset() const
;;
;;inline
;;TBRecord&
;;TBlobRW::Rec()
;;
;;inline
;;void
;;TBlobRW::SetOffset( long offsetArg ) const
;;
;;inline
;;void
;;TBlobRW::SetOffsetToEnd( long offsetArg ) const
;;
;;  Set offset to end (to append to blob)
;;
;;example.cpp
;;950706
;;
;;  Example TDBF code
;;
;;  This is not a ready to run application--it offers only code examples for
;;  initializing and using the TDBF wrapper around the IDAPI engine.
;;
;;  Major sections are:
;;    TApp::Init()
;;      x Engine initialization
;;      x Callback registration
;;      x Private directory setting
;;      x Windows file handle setting
;;      x Databases opened on both shared database and private database
;;
;;    TApp::Run()
;;      x Opening a TBCursor and TBRecord on a table
;;      x Example query using TQueryNoAnswer
;;      x Example query using TQueryAnswerRO
;;      x Example query using TQueryAnswerRO, cloning result cursor
;;      x Example query using TQueryAnswerRO, saving result cursor to local
;;          table
;;      x Example query using TQueryAnswerRW, writing to result cursor then
;;          updating orig. table with it, and using TBlobRO and TBlobRW
;;
;;strstream*
;;winout
;;
;;  Output stream stub for example application
;;
;;CBRType DBIFN
;;TApp::CallBackFunc( CBType ecbType, UINT32 iClientData, pVOID pCbInfo )
;;
;;void
;;TApp::DeInit()
;;
;;  Deallocate any dynamically allocated class member objects
;;
;;void
;;TApp::Init()
;;
;;      x Engine initialization
;;      x Callback registration
;;      x Private directory setting
;;      x Windows file handle setting
;;      x Databases opened on both shared database and private database
;;
;;void
;;TApp::Run()
;;
;;  Example app function including cursor and query examples
;;
;;void
;;TApp::ShowTdbfExc( const TTdbfExc& excTdbf )
;;
;;  Routine to put TDBF exception object to winout
;;
;;heapptr.h             Heap Smart Pointer Template
;;
;;template<class T>
;;class THeapPtr
;;
;;  Automatic clean up of dynamically allocated object of type T
;;
;;  Accepts a pointer to a dyamically allocated object, which is dynamically
;;    deallocated ('deleted') by THeapPtr destructor
;;
;;template<class T>
;;class THeapPtrArray
;;
;;  Automatic clean up of dynamically allocated array of objects of type T
;;
;;  Accepts a pointer to a dyamically allocated object, which is dynamically
;;    deallocated ('deleted') by THeapPtr destructor
;;
;;class
;;TBuffer
;;
;;  Accepts a pointer to a dyamically allocated object, which is dynamically
;;    deallocated ('deleted') by TBuffer destructor
;;
;;tbcursor.cpp
;;
;;TBCursor::TBCursor()
;;  : BCursor()
;;
;;TBCursor::TBCursor( TBDatabase& dbArg,
;;                    const char* tableName,
;;                    int indexID = 0,
;;                    BOOL saveEveryChange = FALSE,
;;                    DBIOpenMode openMode = dbiREADWRITE,
;;                    DBIShareMode shareMode = dbiOPENSHARED,
;;                    XLTMode xltMode = xltFIELD)
;;  : TBCursor( &dbArg, tableName, indexID, saveEveryChange, openMode, shareMode,
;;              xltMode )
;;
;;  Constructor; make a TBCursor object and open the specified Paradox table.
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;TBCursor::TBCursor( TBDatabase& dbArg,
;;                  const char* tableName,
;;                  const char *tableType,
;;                  int indexID,
;;                  DBIOpenMode openMode = dbiREADWRITE,
;;                  DBIShareMode shareMode = dbiOPENSHARED,
;;                  XLTMode xltMode = xltFIELD)
;;  : BCursor( &dbArg, tableName, tableType, indexID, openMode, shareMode, xltMode )
;;
;;  Constructor; make a TBCursor object and open the specified table of the
;;  specified type
;;
;;TBCursor::TBCursor( TBDatabase& dbArg,
;;                  const char* tableName,
;;                  const char* indexName,
;;                  DBIOpenMode openMode = dbiREADWRITE,
;;                  DBIShareMode shareMode = dbiOPENSHARED,
;;                  XLTMode xltMode = xltFIELD )
;;  : BCursor()
;;
;;  Constructor; make a TBCursor object and open the specified table of the
;;  specified type. Use the indexName to identify the index. Note that for
;;  dBASE tables, the indexName is used as the indexTagName and the
;;  <tablename>.MDX is used as the indexname (idnetifying the production
;;  index).
;;
;;  941123
;;    -Added XPRIM reserved suffix support
;;
;;TBCursor::TBCursor( TBDatabase& dbArg,
;;                  const char* tableName,
;;                  const char* indexName,
;;                  const char* indexTagName,
;;                  DBIOpenMode openMode = dbiREADWRITE,
;;                  DBIShareMode shareMode = dbiOPENSHARED,
;;                  XLTMode xltMode = xltFIELD)
;;  : BCursor( &dbArg, tableName, indexName, indexTagName, openMode, shareMode,
;;              xltMode )
;;
;;  Constructor; make a TBCursor object and open the specified table of the
;;  specified type. Use the indexName and indexTagName to identify the
;;  index. Needed for dBASE tables
;;
;;
;;TBCursor::TBCursor(const TBCursor &copyCur)
;;     Copy Constructor
;;
;;TBCursor::operator =(const TBCursor &copyCur)
;;     Assignment of cursors
;;
;;virtual
;;TBCursor::~TBCursor()
;;
;;  Destructor; closes the engine if it's open.
;;
;;Retcode
;;TBCursor::attach( TBDatabase& dbArg, TABLEHANDLE tableHandle )
;;
;;Retcode
;;TBCursor::appendRec( TBRecord& rec)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::appendRec()
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_BOF
;;    DBIERR_EOF
;;    DBIERR_FILELOCKED     (likely for this funct.)
;;    DBIERR_KEYVIOL        (likely for this funct.)
;;    DBIERR_RECLOCKFAILED  (likely for this funct.)
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::appendRec(const void far *buffer, int size)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::clearRec()
;;
;;Retcode
;;TBCursor::clearRec( TBRecord& rec )
;;
;;  Used to clear any open blobs. This function should be called
;;  if any blobs have been written to a record, but appendRec(),
;;  insertRec() or updateRec() was never called successfully.
;;
;;  For example, if there is a locking conflict, and a decision
;;  is made not to post a record having had blobs written to its
;;  record buffer, clearRec() should be called to free those blob
;;  resources. clearRec() may be called even after the blobs have
;;  already been closed by appendRec(), insertRec() or updateRec().
;;
;;  In summary, whenever a blob is written to a BRecord, it MUST
;;  be followed by a successfull call to one of the following BCursor
;;  functions, or BLOB resources will not be freed:
;;    appendRec()
;;    clearRec()
;;    insertRec()
;;    updateRec()
;;
;;  Throws a (TTdbfExc) exception on any error.
;;
;;virtual
;;Retcode
;;TBCursor::close()
;;
;;virtual
;;Retcode
;;TBCursor::closeIfOpen() const
;;
;;RECORDNUMBER
;;TBCursor::getCurRecNum() const
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBCursor::getFirstRecord( TBRecord& rec ) const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_EOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getFirstRecord() const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_EOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getLastRecord( TBRecord& rec ) const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_BOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getLastRecord() const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_BOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getNextRecord(TBRecord& rec) const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_EOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getNextRecord() const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_EOF
;;    PXERR_INVCURRRECORD
;;
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getPreviousRecord( TBRecord& rec ) const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_BOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;Retcode
;;TBCursor::getPreviousRecord() const
;;
;;  Throws a (TTdbfExc) exception on anything but:
;;    DBIERR_NONE
;;    DBIERR_BOF
;;    PXERR_INVCURRRECORD
;;
;;    (otherwise returns one of the above)
;;
;;RECORDNUMBER
;;TBCursor::getRecCount() const
;;
;;Retcode
;;TBCursor::getRecord( TBRecord& rec ) const
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::getRecord() const
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::getRecord(void far *buffer, int size)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;string
;;TBCursor::getTableName()
;;
;;Retcode
;;TBCursor::gotoBegin() const
;;
;;Retcode
;;TBCursor::gotoEnd() const
;;
;;Retcode
;;TBCursor::gotoRec( RECORDNUMBER recNum ) const
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBCursor::gotoRecGet( RECORDNUMBER recNum ) const
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBCursor::gotoRecGet( RECORDNUMBER recNum, TBRecord& rec ) const
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBCursor::insertRec()
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::insertRec(TBRecord& rec)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::insertRec(const void far *buffer, int size)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::open( TBDatabase& dbArg,
;;                const char* tableName,
;;                int indexID = 0,
;;                BOOL saveEveryChange = FALSE,
;;                DBIOpenMode openMode = dbiREADWRITE,
;;                DBIShareMode shareMode = dbiOPENSHARED,
;;                XLTMode xltMode = xltFIELD)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::open( TBDatabase& dbArg,
;;                const char* tableName,
;;                const char* tableType,
;;                int indexID,
;;                DBIOpenMode openMode = dbiREADWRITE,
;;                DBIShareMode shareMode = dbiOPENSHARED,
;;                XLTMode xltMode = xltFIELD)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::open( TBDatabase& dbArg,
;;                const char* tableName,
;;                const char* indexName,
;;                DBIOpenMode openMode,
;;                DBIShareMode shareMode,
;;                XLTMode xltMode)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;  941123
;;    -Added XPRIM reserved suffix support
;;
;;Retcode
;;TBCursor::open( TBDatabase& dbArg,
;;                const char* tableName,
;;                const char* indexName,
;;                const char* indexTagName,
;;                DBIOpenMode openMode = dbiREADWRITE,
;;                DBIShareMode shareMode = dbiOPENSHARED,
;;                XLTMode xltMode = xltFIELD)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::searchIndex( TBRecord& keyRec,
;;                       PXSearchMode mode,
;;                       int fldCnt = 1,
;;                       bool doGetRecord = false ) const
;;
;;Retcode
;;TBCursor::searchIndexRec( PXSearchMode mode,
;;                          int fldCnt = 1,
;;                          bool doGetRecord = false ) const
;;
;;  Search using TBCursor::Rec() field value(s)
;;
;;Retcode
;;TBCursor::searchNonIndex( const char* psFldName,
;;                          const char* psFldvalExpr,
;;                          bool    bLikePattern = false,
;;                          bool    doSearch = false )
;;
;;  Search on single non-indexed field. Table must have a unique key index.
;;    1.) Runs query on table, returns ERRCODE_RECNOTFOUND if 0 recs result
;;    2.) Otherwise uses searchIndex() to return first found occurence
;;          in this TBCursor
;;
;;  Note if bLikePattern is true, SQL-style wildcards (not QBE) apply
;;
;;protected:
;;void
;;TBCursor::throwExc( const char* fnArg,
;;                    const char* errArg = NULL,
;;                    const char* infoArg = NULL ) const
;;
;;Retcode
;;TBCursor::updateRec()
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::updateRec(TBRecord& rec)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;Retcode
;;TBCursor::updateRec(const void far *buffer, int size)
;;
;;  Throws a (TTdbfExc) exception on any error
;;
;;tbcursor.hpp
;;
;;  TBCursor class, inherited from BCursor
;;
;;  Design notes
;;    950609
;;      x const TBCursor& = NULL not supported in arglists for TBCursor class
;;
;;class TBCursor
;;  : public BCursor
;;
;;  This class adds the following functionality beyond BCursor:
;;    -Throws exception to app for getRecord(), insertRec(), appendRec(),
;;      nextrec() errors other than 'usual' ones (EOF, locked by other
;;      user, etc.)
;;
;;inline
;;virtual
;;const char*
;;TBCursor::getClassName()
;;
;;inline
;;TBRecord&
;;TBRecord::Rec()
;;
;;inline
;;TBRecord&
;;const TBRecord::RecRO() const
;;
;;tbdataba.cpp
;;
;;  Class inherited from BDatabase
;;
;;  Design notes
;;    950609
;;      x const TBDatabase& = NULL is supported in arglists for TBDatabase class
;;          functions via protected constructor kluge
;;
;;TBDatabase::TBDatabase( TBEngine& eng,
;;                        DBIOpenMode openMode = dbiREADWRITE,
;;                        DBIShareMode shareMode = dbiOPENSHARED)
;;  : BDatabase( &eng, openMode, shareMode )
;;
;;  Constructor for TBDatabase, 'universal' form
;;
;;  Throws exception on failure
;;
;;TBDatabase::TBDatabase( TBEngine& eng,
;;                        const char *BDDriver,
;;                        const char *BDAlias = "",
;;                        const char *BDPassword = "",
;;                        DBIOpenMode openMode = dbiREADWRITE,
;;                        DBIShareMode shareMode = dbiOPENSHARED)
;;  : BDatabase( &eng, BDDriver, BDAlias, BDPassword,
;;                openMode, shareMode )
;;
;;  Constructor for TBDatabase, explicit form
;;
;;  Throws exception on failure
;;
;;TBDatabase::TBDatabase( TBEngine& eng,
;;                        const char *BDDriver,
;;                        const char *BDAlias,
;;                        const char *BDPassword,
;;                        const char *BDUserName, //This is the new (SQL) parameter
;;                        DBIOpenMode openMode = dbiREADWRITE,
;;                        DBIShareMode shareMode = dbiOPENSHARED)
;;  : BDatabase( &eng, BDDriver, BDAlias, BDPassword,
;;                openMode, shareMode )
;;
;;  Constructor for TBDatabase, explicit form
;;
;;  Throws exception on failure
;;
;;virtual
;;TBDatabase::~TBDatabase()
;;
;;  Destructor for TBDatabase
;;
;;Retcode
;;TBDatabase::appendTable( const char *srcTable,  //(This database)
;;                         const char *destTable, //(This or other database)
;;                         const char *destType,
;;                         TBDatabase &dbDest,
;;                         eBATMode xBatMode = batAppend )
;;
;;  Throws TTdbfExc exception on any error
;;
;;  Changes by //BR to KDBF original
;;    941112
;;      -Made sure destTblDesc is cleared initially
;;
;;  Additions by //BR
;;    941123
;;      -Removed 'xBatMode' arg from BDatabase (moved to TBDatabase class)
;;    941112
;;      -Added 'xBatMode' arg
;;
;;Retcode
;;TBDatabase::appendTable( const TBCursor& ptCsrSource,        //MUST be Csr of THIS database
;;                         const char *destTableName,   //This or other database
;;                         const char *destType,
;;                         TBDatabase &dbDest,
;;                         eBATMode xBatMode = batAPPEND )
;;
;;  Throws TTdbfExc exception on any error
;;
;;  Additions by //BR
;;    11/06/94
;;      -New function: appendTable with BCursor source
;;
;;Retcode
;;TBDatabase::appendTable(const char* srcTable,   //This database
;;                       TBCursor& ptCsrDest,     //MUST be Csr of THIS database
;;                       eBATMode xBatMode = batAPPEND )
;;
;;  Throws TTdbfExc exception on any error
;;
;;  Additions by //BR
;;    11/06/94
;;      -New function: appendTable with BCursor dest.
;;
;;Retcode
;;TBDatabase::appendTable(const TBCursor& ptCsrSrc,   //MUST be Csr of THIS database
;;                       TBCursor& ptCsrDest,  //MUST be Csr of THIS database
;;                       eBATMode xBatMode = batAPPEND )
;;
;;  Throws TTdbfExc exception on any error
;;
;;    11/06/94
;;      -New function: appendTable with BCursor src., dest.
;;
;;Retcode
;;TBDatabase::beginTransaction( eXILType tranType )
;;
;;  Throws TTdbfExc exception on any error
;;
;;Retcode
;;TBDatabase::beginTransaction(hDBIXact &tranHandle, eXILType tranType)
;;
;;  Throws TTdbfExc exception on any error
;;
;;Retcode
;;TBDatabase::createTable( const char *tableName,
;;                         int numFields, const FieldDesc *fldDescs,
;;                         ValidityDesc *valDesc, RefDesc *refDesc )
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBDatabase::createTableBorrow( const char* psTblName,
;;                               const char* psBorrowFrom,
;;                               const TBDatabase& ptDbFrom = NULL )
;;
;;  New function added by //BR
;;
;;  Creates table in home database or specified path, using
;;    structure of the BorrowFrom table (also in the home database)
;;
;;  Throws (TTdbfExc) exception on any error
;;
;;Retcode
;;TBDatabase::deleteTable( const char *tableName )
;;
;;  Throws TTdbfExc exception on any error
;;
;;Retcode
;;TBDatabase::deleteTableIfExists( const char* tblName )
;;
;;  Deletes table only if it exists. Use this instead of deleteTable()
;;    since IDAPI deletetable function appears to have bug when table
;;    does not exist.
;;
;;  Returns: DBIERR_NONE if table did not exist or did exist and was deleted
;;
;;  Errors: Exceptions thrown on errors (anything but DBIERR_NONE return)
;;
;;Retcode
;;TBDatabase::emptyTable(const char *tableName)
;;
;;  Throws TTdbfExc on any error
;;
;;Retcode
;;TBDatabase::endTransaction( eXEnd tranType )
;;
;;  Throws TTdbfExc exception on any error
;;
;;Retcode
;;TBDatabase::forceWrite()
;;
;;  Force writing out to disk all open buffers associated with this
;;  database (applies to local tables only)
;;
;;  Returns with no error if not applicable (isRemote() )
;;
;;string
;;TBDatabase::getAliasName()
;;
;;  Return alias in a string object
;;
;;Retcode
;;TBDatabase::getDescVector( char *tableName,
;;                           int& numFields,
;;                            FieldDesc*& desc ) const
;;
;;bool
;;TBDatabase::isRemote()
;;
;;  Returns bTrue if database is remote (sql) (as opposed to ISAM pdox/dbase)
;;
;;Retcode
;;TBDatabase::query(const char *qryString, TBCursor &answer,
;;                         DBIQryLang qryLang)
;;
;;  Use for only for queries returning an answer cursor (select, etc.)
;;    Throws an exception if query does not return an answer cursor
;;
;;Retcode
;;TBDatabase::queryNoAnswer(const char *qryString,
;;                         DBIQryLang qryLang)
;;
;;  Use only for queries returning no answer cursor (delete, etc.)
;;    Throws an exception if query does return an answer cursor
;;
;;Retcode
;;TBDatabase::sortTable( const char* psTblname,
;;                       TSortTable& rtSortTable )
;;
;;  Sort (unkeyed, local) table to itself
;;  FieldNumber args
;;
;;Retcode
;;TBDatabase::sortTable( const char* psTblname,
;;                       TSortTableFldName& rtSortTableFldName )
;;
;;  Sort (unkeyed, local) table to itself
;;  FieldName args
;;
;;BOOL
;;TBDatabase::tableExists(const char *tableName)
;;
;;  See if a table exists in the database.
;;
;;  Returns: TRUE if table exists.
;;
;;  Errors: Throws exception on errors other than DBIERR_NOSUCHTABLE
;;
;;  Design notes:
;;    950524
;;      o Need to correct kluge that ignores helper function errors
;;
;;protected:
;;void
;;TBDatabase::throwExc( const char* fnArg,
;;                    const char* errArg = NULL,
;;                    const char* infoArg = NULL,
;;                    const char* aliasArg = NULL,
;;                    const char* tblArg = NULL ) const
;;
;;TSortTable::TSortTable()
;;
;;  Constructor for TSortTable class
;;
;;TSortTableFldName::TSortTableFldName()
;;
;;  Constructor for TSortTableFldName class
;;
;;TSortTableFldName::~TSortTableFldName()
;;
;;  Destructor for TSortTableFldName class
;;
;;tbdataba.hpp
;;
;;  TBDatabase class, inherited from BDatabase
;;
;;class
;;TSortTable
;;
;;  Struct to store sort-fields specifier for sortTable() function
;;class
;;TSortTableFldName
;;
;;  Class to store sort-fields specifier for sortTable() function
;;  by field name
;;
;;class
;;TBDatabase
;;  : public BDatabase
;;
;;  This class adds the following functionality beyond BDatabase:
;;    -New function CreateTableBorrow() creates an empty table, borrowing
;;      structure from a table in any open database. Typically used to
;;      create tables for local processing.
;;
;;inline
;;virtual
;;const char*
;;TBDatabase::getClassName() const
;;
;;tbengine.cpp
;;
;;  Requires utils.cpp
;;
;;  TDBF, a class derived from KDBF, written by:
;;    Buc Rogers (buc@mcs.com),
;;
;;  With major help from:
;;    Chris Smith (ccas@mcs.com)
;;    Jacques Doornebos
;;
;;TBEngine::TBEngine()
;;  : BEngine()
;;
;;TBEngine::TBEngine(BEngineType eType)
;;  : BEngine( eType )
;;
;;  This constructor makes a C++ BEngine object and actually opens the
;;  Paradox engine in the requested mode using default parameters.
;;
;;TBEngine::TBEngine(const BEnv& env)
;;  : BEngine( env )
;;
;;  This constructor makes a C++ BEngine object and actually opens the
;;  Paradox engine in the requested mode using suppiled parameters.
;;
;;virtual
;;TBEngine::~TBEngine()
;;
;;Retcode
;;TBEngine::checkExc()
;;
;;  Returns:
;;      DBIERR_NONE if lastError is a "sanctioned" (non-thrown) error, otherwise
;;      returns lastError
;;
;;protected:
;;void
;;TBEngine::init()
;;
;;protected:
;;void
;;TBEngine::readCfgFile( pCHAR CfgPath,
;;                       INT16 Level )
;;
;;  DbiOpenCfgInfoList() helper function
;;
;;    Derived from snipit\config.c
;;
;;Retcode
;;TBEngine::registerAllCallBacks( void* fnAll )
;;
;;void
;;TBEngine::setDebugLayerOptions( UINT16 opt,
;;                                const char* fn = NULL )
;;
;;Retcode
;;TBEngine::setPrivateDirAndCheck( const char *Directory )
;;
;;  Differs from BEngine::setPrivateDir() in checking
;;    to see if dir exists, returning error if it does not
;;
;;  Does NOT set IDAPI privdir if dir does not exist
;;
;;  Returns one of the following:
;;    DBIERR_NONE
;;    throw ( lastError )
;;      (usually "dir does not exist") )
;;
;;protected:
;;void
;;TBEngine::throwExc( const char* fnArg,
;;                    const char* errArg = NULL,
;;                    const char* infoArg = NULL )
;;
;;tbengine.hpp
;;
;;  TBEngine class, inherited from BEngine
;;
;;class TBEngine
;;  : public BEngine
;;
;;  TBEngine, derived from BEngine
;;
;;inline
;;virtual
;;const char*
;;TBEngine::getClassName()
;;
;;tdbf.hpp
;;
;;  Include file to use TBCursor, TBDatabase, TBEngine, TBRecord,
;;    TQuery
;;
;;  General TDBF notes:
;;
;;    x TTdbfExc exceptions are thrown to application for all errors except:
;;        x "normal" errors like EOF on getNextRecord()
;;
;;    x "constness" of functions ("const" suffix) is applied using the following
;;        rules:
;;
;;        x A TBCursor/TBDatabase/TBRecord/TQueryAnswer/TQueryNoAnswer function
;;            is regarded as "const" if it does not affect the underlying table,
;;
;;            Prerequisite writes to the IDAPI record buffer (in TBRecord) are
;;            regarded as "non-const" operations, as are functions whose express
;;            purpose is to prepare for a write (e.g., openBlobWrite() ).
;;
;;            lockRecord() and unlockRecord() are regarded as non-const.
;;
;;            Transaction operations (beginTransaction(), endTransaction() )
;;            are regarded as non-const, since beginning or ending a transaction
;;            does affect the database state.
;;
;;            As of 950607, only TBRecord, TQueryAnswer and TQueryNoAnswer have
;;            const functions assigned in this manner.
;;
;;        x Note that the TBCursor/TBDatabase/TBRecord/TQueryAnswer/TQueryNoAnswer
;;            object is NOT guaranteed not to be changed when the const suffix is
;;            present--constness with these classes is with regard to the DATABASE,
;;            not the WRAPPER around it. Changes to the WRAPPER object state are
;;            "casted" away (e.g., member data lastError) using the const_cast<>(this)
;;            operator.
;;
;;class
;;TTdbfExc
;;
;;  Exception object thrown by all tdbf exceptions (incl. TUtil)
;;
;;  public:
;;    const string& AliasName() const
;;    const string& ClassName() const
;;    const string& ErrMsg() const
;;    const string& FldName() const
;;    const string& FnName() const
;;    const string& IdapiMsg() const
;;    Retcode       LastError() const
;;    const string& ErrInfo() const
;;    const string& TblName() const
;;
;;    const string& GetAliasName(); **OBS use AliasName()
;;    const string& GetClassName(); **OBS use ClassName()
;;    const string& GetErrMsg();    **OBS use ErrMsg()
;;    const string& GetFldName();   **OBS use FldName()
;;    const string& GetFnName();    **OBS use FnName()
;;    const string& GetIdapiMsg();  **OBS use IdapiMsg()
;;    Retcode       GetLastError(); **OBS use LastError()
;;    const string& GetErrInfo();   **OBS use ErrInfo()
;;    const string& GetTblName();   **OBS use TblName()
;;
;;    **OBS These data members will no longer be publicly accessable
;;                  in the future. Use the above selector functions instead.
;;;
;;    string  aliasName;  //Alias name (if available)
;;    string  className;  //Class name (Tutil, TBEngine, etc.)
;;    string  errMsg;     //Error message
;;    string  fldName;    //Field name (if available)
;;    string  fnName;     //Caller function in which error occurred
;;    Retcode lastError;  //IDAPI error code (if available)
;;    string  errInfo;    //Error message aux. info
;;    string  tblName;    //Table name (if available)
;;tbrecord.cpp
;;
;;  Design notes
;;    950609
;;      x const TBRecord& = NULL is supported in arglists for TBRecord class
;;          functions via protected constructor kluge
;;
;;TBRecord::TBRecord()
;;  : BRecord()
;;
;;TBRecord::TBRecord( TBCursor& cursor )
;;  : BRecord( &cursor )
;;
;;
;;TBRecord::TBRecord( const TBRecord &copyCur )
;;     Copy Constructor
;;
;;    Record state is completely copied EXCEPT for any open BLOBs
;;
;;
;;TBRecord::operator =( const TBRecord &copyCur )
;;     Assignment of records
;;
;;    Record state is completely copied EXCEPT for any open BLOBs
;;
;;virtual
;;TBRecord::~TBRecord()
;;
;;  Destructor; will close the record buffer associated with the record.
;;
;;Retcode
;;TBRecord::attach( TBCursor& curArg )
;;
;;Retcode
;;TBRecord::checkExc() const
;;
;;  Check if lastError is not DBIERR_NONE, throw (TTdbfExc) exception to app
;;    if so, otherwise return DBIERR_NONE
;;
;;Retcode
;;TBRecord::clear()
;;
;;  Clear the record buffer and set fields to "empty" values.
;;  RecBufEmpty will fail if a BLOB is open. This function
;;  doesn't perform operations on BLOBs.
;;
;;Retcode
;;TBRecord::closeBlob(FIELDNUMBER fldnbr,
;;                    BOOL bAccept = TRUE) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::closeBlob(const char* psFldName,
;;                    BOOL bAccept = TRUE) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::copyTo( TBRecord& destRec, bool doBlobs = true ) const
;;
;;  Copies one rec to another (assumes all fields
;;    of source rec are same or comparable to first n fields
;;    in dest rec)
;;
;;  If doBlobs is true, then copies blob fields over, otherwise does not.
;;
;;  Performance can be substantially improved by NOT copying blob field
;;  contents over if they are not needed in the target record.
;;
;;Retcode
;;TBRecord::copyToSimilar( TBRecord& ptRecDest ) const
;;
;;  Copy same-named fields only, whatever their position or type in dest.
;;
;;  Throws (TTdbfExc) exception on error
;;
;;Retcode
;;TBRecord::dropBlob(FIELDNUMBER fldnbr) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::dropBlob(const char* psFldName) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;UINT32
;;TBRecord::getBlob(FIELDNUMBER fldnbr,
;;                  long nOffset,
;;                  string& buf,
;;                  UINT16 nSize = 0 ) const //0 means read up to 0xFFFF from blob
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;  Design notes:
;;    950523
;;      o Need to adapt to work with other than text blobs (embedded nulls)
;;
;;Retcode
;;TBRecord::getBlob(FIELDNUMBER fldnbr,
;;                  unsigned int nSize,
;;                  long nOffset,
;;                  void far *pvBuffer) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;UINT32
;;TBRecord::getBlob(const char* psFldName,
;;                  long nOffset,
;;                  string& buf,
;;                  UINT16 nSize = 0 ) const //0 means read up to 0xFFFF from blob
;;
;;  Returns bytes read
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;  Design notes:
;;    950523
;;      o Need to adapt to work with other than text blobs (embedded nulls)
;;
;;Retcode
;;TBRecord::getBlob(const char* psFldName,
;;                  unsigned int nSize,
;;                  long nOffset,
;;                  void far *pvBuffer) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getBlobHeader(FIELDNUMBER fldnbr,
;;                        int nSize,
;;                        void* pvBuffer,
;;                        int& rnBytesRead) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getBlobHeader(const char* psFldName,
;;                        int nSize,
;;                        void* pvBuffer,
;;                        int& rnBytesRead) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;unsigned long
;;TBRecord::getBlobSize(FIELDNUMBER fldnbr) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;unsigned long
;;TBRecord::getBlobSize(const char* psFldName) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField( FIELDNUMBER fldnbr, string& buf ) const
;;
;;  Note timestamp field types are returned formatted as follows:
;;    hh:mm:ss, mm/dd/yyyy
;;
;;Retcode
;;TBRecord::getField( FIELDNUMBER fldnbr, char *buf,
;;                    int bufLen ) const
;;
;;  Note timestamp field types are returned formatted as follows:
;;    hh:mm:ss, mm/dd/yyyy
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, void *buf,
;;                   int bufLen ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, double& val ) const;
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, INT16& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, INT32& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, UINT16& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, UINT32& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, FMTBcd& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BDate& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BTime& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BTimeStamp& val ) const
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, char *buf,
;;                             int bufLen, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, void *buf,
;;                             int bufLen, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, double& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, INT16& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, INT32& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, UINT16& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, UINT32& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, FMTBcd& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BDate& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BTime& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(FIELDNUMBER fldnbr, BTimeStamp& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, char *buf, int bufLen,
;;                               BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, void *buf, int bufLen,
;;                               BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, double& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, INT16& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, INT32& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, UINT16& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, UINT32& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, FMTBcd& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, BDate& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, BTime& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(char *fldName, BTimeStamp& val, BOOL& fNull) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, string& buf ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, char *buf, int bufLen ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, void *buf, int bufLen ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, double& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, INT16& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, INT32& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, UINT16& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, UINT32& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, FMTBcd& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, BDate& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, BTime& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::getField(const char *fldName, BTimeStamp& val ) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;FIELDNUMBER
;;TBRecord::getFieldNumber( const char *fldName ) const
;;
;;  Return:
;;    Throws TTdbfExc object on any error
;;
;;int
;;TBRecord::getFieldCount() const
;;
;;  For the generic table (and record) descriptor in use,
;;  return its field count.
;;
;;  Return:
;;    Throws TTdbfExc object on any error
;;
;;Retcode
;;TBRecord::getFieldDesc( FIELDNUMBER fldnbr,
;;                        FieldDesc& desc ) const
;;
;;  Given a field handle, return a field descriptor describing
;;  the field's name, type, length, and so on. For generic
;;  records, use the field descriptor in the cursor. (Table and
;;  record descriptors are the same).
;;
;;  Return:
;;    Throws TTdbfExc object on any error
;;
;;string
;;TBRecord::getFieldName( FIELDNUMBER h ) const
;;
;;  Return field name in string object
;;
;;  Return:
;;    Throws TTdbfExc object on any error
;;
;;double
;;TBRecord::getFloat( const string& fldName ) const
;;
;;  Return: floating point (double) value from field in record
;;
;;  Error:  Throws TTdbfExc exception on any error
;;
;;INT32
;;TBRecord::getInt32( const string& fldName ) const
;;
;;  Return: integer (long) value from field in record
;;
;;  Error:  Throws TTdbfExc exception on any error
;;
;;string
;;TBRecord::getString( const string& fldName ) const
;;
;;  Return: string value from field in record
;;
;;  Error:  Throws TTdbfExc exception on any error
;;
;;BTimeStamp
;;TBRecord::getTimestamp( const string& fldName ) const
;;
;;  Return: BTimeStamp value from field in record
;;
;;  Error:  Throws TTdbfExc exception on any error
;;
;;BOOL
;;TBRecord::isNull(FIELDNUMBER fldnbr) const
;;
;;TBool
;;TBRecord::isNull(const char *fldname) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::openBlobRead(FIELDNUMBER fldnbr,
;;                       BOOL usePrivateCopy = FALSE) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::openBlobRead(const char* psFldName,
;;                       BOOL usePrivateCopy = FALSE) const
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::openBlobWrite(FIELDNUMBER fldnbr,
;;                        long nSize = 0,         //OBS PARAM
;;                        BOOL bCopyOld = FALSE)  //OBS PARAM
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::openBlobWrite(const char* psFldName,
;;                        long nSize = 0,         //OBS PARAM
;;                        BOOL bCopyOld = FALSE)  //OBS PARAM
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putBlob( FIELDNUMBER fldnbr,
;;                   unsigned long nOffset,
;;                   const string& buf )
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;  Design notes:
;;    950523
;;      o Need to adapt to work with other than null-terminated strings
;;          (string class supports this, but string::c_str() does not)
;;Retcode
;;TBRecord::putBlob(FIELDNUMBER fldnbr,
;;                  unsigned long nSize,
;;                  unsigned long nOffset,
;;                  void far *pvBuffer)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putBlob( const char* psFldName,
;;                   unsigned long nOffset,
;;                   const string& buf )
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;  Design notes:
;;    950523
;;      o Need to adapt to work with other than null-terminated strings
;;          (string class supports this, but string::c_str() does not)
;;Retcode
;;TBRecord::putBlob(const char* psFldName,
;;                  unsigned long nSize,
;;                  unsigned long nOffset,
;;                  void far *pvBuffer)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField( FIELDNUMBER fldnbr, const string& buf )
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, const char *buf)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, const void *buf)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, double val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, INT16 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, INT32 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, UINT16 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, UINT32 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, FMTBcd val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, const BDate& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, const BTime& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(FIELDNUMBER fldnbr, const BTimeStamp& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField( char *fldName, const string& buf )
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, const char *buf)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, const void *buf)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, double val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, INT16 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, INT32 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, UINT16 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, UINT32 val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, FMTBcd val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, const BDate& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, const BTime& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::putField(char *fldName, const BTimeStamp& val)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;Retcode
;;TBRecord::setNull(FIELDNUMBER fldnbr)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;  For BLOB fields, openBlobWrite() must have been called prior
;;
;;Retcode
;;TBRecord::setNull(const char *fldName)
;;
;;  Throws a (TTdbfExc) exception on error
;;    (otherwise returns DBIERR_NONE)
;;
;;protected:
;;void
;;TBRecord::throwExc( const char* fnArg,
;;                    const char* errArg = NULL,
;;                    const char* infoArg = NULL,
;;                    const char* fldArg = NULL ) const
;;
;;tbrecord.hpp
;;
;;  TBRecord class, inherited from BRecord
;;
;;class TBRecord
;;  : public BRecord
;;
;;  This class adds the following functionality beyond BRecord:
;;    -Throws exception to app for getField(), putField(), et al.
;;
;;inline
;;virtual
;;const char*
;;TBRecord::getClassName()
;;
;;tquery.cpp
;;
;;  **OBS--use tquery_2.cpp classes for all new design
;;
;;  Design notes:
;;
;;    950503
;;      o Nice option would be to pass opt. trx type to query
;;
;;TQuery::TQuery( TBEngine* ptEngineArg,
;;                TBDatabase* ptDatabaseArg )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;  Constructor for TQuery
;;
;;virtual
;;TQuery::~TQuery()
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;  Destructor for TQuery
;;
;;Retcode
;;TQuery::Query( const char* psQuerystring,
;;               DBIQryLang xQryLang = qrylangSQL )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;  Use only for queries returning no answer (delete, etc.)
;;
;;    Will throw TTdbfExc exception if query returns (unexpected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;Retcode
;;TQuery::Query( const char* psQuerystring, TBCursor*& rptCsrOut, TBRecord*& rptRecOut,
;;               DBIQryLang xQryLang  )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;    Will throw TTdbfExc exception if query does not return (expected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;Retcode
;;TQuery::Query( strstream* ptQuerystream,
;;               DBIQryLang xQryLang = qrylangSQL )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;  Use only for queries returning no answer (delete, etc.)
;;
;;    Will throw TTdbfExc exception if query returns (unexpected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;Retcode
;;TQuery::Query( strstream* ptQuerystream,
;;               TBCursor*& rptCsrOut,
;;               TBRecord*& rptRecOut,
;;               DBIQryLang xQryLang = qrylangSQL )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;    Will throw TTdbfExc exception if query does not return (expected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;Retcode
;;TQuery::Query( const char* psQuerystring,
;;               const char* psTblResult,
;;               TBDatabase* ptDbResult,
;;               DBIQryLang  xQryLang = qrylangSQL,
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;    Will throw TTdbfExc exception if query does not return (expected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;Retcode
;;TQuery::Query( strstream* sqlstr,
;;               const char* psTblResult,
;;               TBDatabase* ptDbResult,
;;               DBIQryLang xQryLang = qrylangSQL )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;    Will throw TTdbfExc exception if query does not return (expected) answer cursor
;;
;;    Will also throw TTdbfExc exception on any other error (app should
;;      catch)--original query string included in TTdbfExc.errInfo member
;;
;;protected:
;;void
;;TQuery::ThrowExc( const char* fnArg,
;;                  const char* errArg = NULL,
;;                  const char* infoArg = NULL )
;;
;;  **OBS--use TQueryAnswer and TQueryNoAnswer for all new design
;;
;;tquery.hpp
;;
;;tquery_2.cpp
;;
;;  This class was designed by Chris Smith (ccas@mcs.com),
;;  with modifications from    Buc Rogers  (buc@mcs.com)
;;
;;  Design notes:
;;
;;    950503
;;      o Nice option would be to pass opt. trx type to query
;;===========================================================
;;  CLASS TQueryBase  --  Query Object Base Class
;;===========================================================
;;
;;TQueryBase::TQueryBase (TBDatabase& ptDatabaseArg )
;;
;;  Constructor for TQueryBase
;;
;;virtual
;;TQueryBase::~TQueryBase()
;;
;;  Destructor for TQueryBase
;;
;;const string&
;;TQueryBase::QueryString() const
;;
;;  Return query string streamed into Text() to this point
;;
;;  Notes:
;;    1) Streaming into Text() after this call is not supported
;;        and will have undefined results
;;    2) If Text() is a null string, "<< ends" can be called more than
;;        once if QueryString() called more than once
;;
;;protected:
;;void
;;TQueryBase::ThrowExc( const char * fnArg,
;;                      const char * errArg = NULL,
;;                      const char * infoArg = NULL ) const
;;
;;===========================================================
;;    CLASS TQueryNoAnswer  --  Query without Results
;;===========================================================
;;
;;virtual
;;TQueryNoAnswer::~TQueryNoAnswer()
;;
;;  Destructor for TQueryNoAnswer
;;
;;Retcode
;;TQueryNoAnswer::Run()
;;
;;    -Throws TTdbfExc exception if query returns an Answer cursor
;;
;;    -Will also throw TTdbfExc on other query error, which the App should
;;        catch. The original Query string is returned in TTdbfExec::errInfo.
;;
;;===========================================================
;;   CLASS TQueryAnswerRO     --  Query returning Result Table
;;===========================================================
;;TQueryAnswerRO::TQueryAnswerRO( TBDatabase& ptDatabaseArg )
;;
;;  Constructor for TQueryAnswerRO
;;
;;
;;virtual
;;TQueryAnswerRO::~TQueryAnswerRO()
;;
;;  Destructor for TQueryAnswerRO
;;
;;Retcode
;;TQueryAnswerRO::Run()
;;
;;    -Throws TTdbfExc exception if query returns an Answer cursor
;;
;;    -Will also throw TTdbfExc on other query error, which the App should
;;        catch. The original Query string is returned in TTdbfExec::errInfo.
;;
;;TQueryAnswerRW::TQueryAnswerRW( TBDatabase& theDatabase,
;;                                TBDatabase& dbPriv,
;;                                const string& nameQueriedTable )
;;
;;  Constructor for TQueryAnswerRW
;;
;;  This class encapsulates a writable answer cursor and associated
;;  Update() function to write any changes back to the queried table.
;;
;;  This class should be adapted or expanded to work with updateable cursors
;;  when IDAPI supports those.
;;
;;  nameQueriedTable is used in two places:
;;    1) To specifiy the table for Update() to update
;;    2) To specify the dbPriv table name to use (if necessary--see below).
;;
;;  nameQueriedTable is not necessarily created in the specified dbPriv
;;  (is created there only if isRemote() ).
;;
;;  Use TQueryAnswerRO with setResultTbl() to guarantee
;;  a returned result table in dbPriv.
;;
;;
;;virtual
;;TQueryAnswerRW::~TQueryAnswerRW()
;;
;;  Destructor for TQueryAnswerRW
;;
;;Retcode
;;TQueryAnswerRW::Run()
;;
;;    -Throws TTdbfExc exception if query returns an Answer cursor
;;
;;    -Will also throw TTdbfExc on other query error, which the App should
;;        catch. The original Query string is returned in TTdbfExec::errInfo.
;;
;;void
;;TQueryAnswerRW::Update()
;;
;;  Update the result table specified in the constructor with
;;    the query result.
;;
;;  Note that all fields in the source cursor MUST match the first
;;  n fields in the destination table--so if anything but select * was
;;  used, the fields specified in the select clause MUST be
;;  in physical table order and without gaps.
;;
;;tquery_2.hpp
;;
;;inline
;;Retcode
;;TQueryBase::Error()
;;
;;inline
;;DBIQryLang
;;TQueryBase::Language()
;;
;;inline
;;void
;;TQueryBase::SetLanguage( DBIQryLang newLang )   //  Override Query
;;
;;inline
;;void
;;TQueryBase::SetQuery( const string & QueryText) //  Lazy way to
;;
;;inline
;;strstream&
;;TQueryBase::Text()
;;
;;pure virtual
;;const char*
;;ClassName()
;;
;;  Used by ThrowExc() in all derived classes
;;
;;protected:
;;inline
;;TBDatabase*
;;TQueryBase::Db()
;;
;;protected:
;;inline
;;TBEngine*
;;TQueryBase::Engine()
;;
;;protected:
;;inline
;;void
;;TQueryBase::SetError( Retcode err )        //  Override Error
;;
;;class
;;TQueryAnswerRO
;;  : public TQueryBase
;;
;;===========================================================
;;   CLASS TQueryAnswerRO     --  Query returning Result Table
;;===========================================================
;;
;;inline
;;const TBCursor&
;;TQueryAnswerRO::Csr() const
;;
;;inline
;;const TBCursor
;;TQueryAnswerRO::CloneCursor() const
;;
;;inline
;;const TBRecord&
;;TQueryAnswerRO::Rec() const
;;
;;inline
;;void
;;TQueryAnswerRO::SetResultTbl( TBDatabase& tblDB,
;;                              const string& tblname )
;;
;;protected:
;;inline
;;virtual
;;const char*
;;TQueryAnswerRO::ClassName()
;;
;;class
;;TQueryAnswerRW
;;  : public TQueryBase
;;
;;===========================================================
;;   CLASS TQueryAnswerRW     --  Query returning Result Table
;;===========================================================
;;
;;inline
;;const TBCursor&
;;TQueryAnswerRW::Csr() const
;;
;;inline
;;TBCursor
;;TQueryAnswerRW::CloneCursor() const
;;
;;inline
;;TBRecord&
;;TQueryAnswerRW::Rec()
;;
;;protected:
;;inline
;;virtual
;;const char*
;;TQueryAnswerRW::ClassName()
;;
;;class
;;TQueryNoAnswer
;;  : public TQueryBase
;;
;;===========================================================
;;   CLASS TQueryNoAnswer  --  Query without Results
;;===========================================================
;;
;;inline
;;TQueryNoAnswer::TQueryNoAnswer( TBDatabase* theDatabase )
;;  : TQueryBase( theDatabase )
;;
;;inline
;;virtual
;;const char*
;;TQueryNoAnswer::ClassName()
;;
;;utils.cpp
;;
;;  Non-class functions
;;
;;  Commenting conventions:
;;    NOTWIN32  This line is not Win32-compatible
;;
;;TIntString::TIntString( long n )
;;
;;  Convert int (or long int) to string type
;;
;;static int
;;TUtil::ChDir( const char* psPath )
;;
;;  Works with or without trailing backslash, unlike RTL chdir()
;;
;;  Returns 0 on success.
;;
;;static bool
;;TUtil::CnvStrToUnix( const char* psdTime, long& rdTime )
;;
;;  Convert timestamp string to unix form time. The following forms
;;  are acceptable:
;;    MM/DD/YYYY HH:MM:SS
;;    HH:MM:SS MM/DD/YYYY
;;    MM/DD/YYYY          (00:00:00 assigned)
;;
;;static bool
;;TUtil::CnvTimestampToUnix( BTimeStamp* pdTimestamp,
;;                           long& rdTime )
;;
;;  Convert BTimeStamp fmt to Unix fmt (secs. since 1970)
;;
;;static bool
;;TUtil::CnvTimestrToSec( const char* psdTime,
;;                        long& rdTime )
;;
;;  Convert 24hr. Timestring (hh:mm:ss) to seconds
;;
;;static bool
;;TUtil::CnvTimeToBTime( const char* psTime,
;;                       BTime& rBTime )
;;
;;  Converts time string 'hh:mm:ss' to BTime struct
;;  0-len time string returns 00:00:00
;;
;;static bool
;;TUtil::CnvUnixToStr( long dTime,
;;                     char* psTime )
;;
;;  Cnv unix-fmt datetime to sql-ready string
;;
;;static string
;;TUtil::CnvUnixToString( long dTime )
;;
;;  Cnv unix-fmt datetime to sql-ready string
;;
;;static int
;;TUtil::GetCWD( char* ps, int nBufLen )
;;
;;  Get cwd, including drive prefix, and ensure trailing '\' is in place
;;
;;  Return:
;;    0 on success, != 0 otherwise
;;
;;static char*
;;TUtil::GetDateTime( int hours,
;;                    int minutes,
;;                    int seconds,
;;                    time_t external_time )
;;
;;  Converts integer date/time values to timestamp string, formatted as:
;;    ' mm/dd/yyyy hh:mm:ss '
;;
;;  Return:
;;    Pointer to static char*
;;
;;static long
;;TUtil::GetTimeFromMidnight()
;;
;;  Return:
;;    Number of seconds since midnight (local time)
;;
;;static bool
;;TUtil::IsValidPath( const char* path )
;;
;;  Works with or without trailing backslash
;;
;;static int
;;TUtil::LookUp( char* key,
;;        char** table )
;;
;;  Lookup string key in table, return index to it
;;
;;static void
;;TUtil::MakePath( const char* psFrom, char* psTo )
;;
;;  Appends trailing '\\' to psTo if not present
;;
;;static bool
;;TUtil::SetDriveAndCwd( const char* psPath )
;;
;;  Sets both current drive and working directory on that drive
;;    Works with or without trailing backslash
;;
;;static char*
;;TUtil::TrimXStr( char* psBuf );
;;
;;  Strip any leading and trailing whitespace from string psBuf
;;    (Returns pointer to new start of string, which will differ from psBuf
;;    if leading whitespace was removed)
;;
;;  All control characters and 8bit ascii chrs are stripped (< 0x20, >0x7F)
;;
;;static void
;;TTdbfExc::ThrowExc( const char* fnArg,
;;                    const char* errArg = NULL,
;;                    const char* infoArg = NULL,
;;                    const char* classArg = NULL, //(Defaults to TUtil)
;;                    Retcode     lastErrorArg = -1,
;;                    const char* aliasArg = NULL,
;;                    const char* tblArg = NULL,
;;                    const char* fldArg = NULL )
;;
;;  Creates and throws TTdbfExc object, initializing data members as appr.
;;
;;utils.hpp
;;
;;  General utilities, including kdbf- and tdbf- related ones
;;
;;class
;;TIntString
;;
;;===================================================================
;;   CLASS TIntString   -- Integer to String conversions
;;===================================================================
;;
;;TIntString::TIntString( long n )
;;
;;TIntString::operator string()
;;
;;class
;;TUtil
;;
;;  Fully-static class (no instantiation needed, call all functions using
;;    TUtil:: prefix)
;;
