(*****************************************************************************)
(* MODULE: BTRERRS^                                                          *)
(* AUTHOR: Peter Blair                                                       *)
(* RIGHTS: Reggatta Systems, Inc. - COPYRIGHT 1995 - 2000                    *)
(* DESCR.: This module contains the Btrieve Engine Error Routines            *)
(*****************************************************************************)
Unit BtrErrs;
{$I BSE.INC}
{$I BAPI.INC}
Interface
Uses
  Windows,
  BDE,

  BseErrs,
  BseTypes;

Type
  EBtrieveEngineError =
  Class( ETitanEngineError )
    Private
      FKeyBuffer       : TttKeyBuffer;                      (* Btrieve key buffer *)
      FKeyBuffSize     : Word;                              (* key buffer size    *)
    Public
      Constructor Create( BtrieveError : SmallInt );
      Constructor CreateMsg( BtrieveError : SmallInt; Const ErrorMsg : ShortString );
      Function GetNativeErrorMsg : ShortString; Override;
  end;

Procedure ThrowBtrieveException( Error : SmallInt );
Procedure ThrowBtrieveExceptionMsg( Error : SmallInt; Const ErrorMsg : ShortString );

Implementation
Uses
  SysUtils,

  BseUtils,
  BseConst,

  BtrConst;

Const
  BTRIEVE_ERROR_OFFSET = 5000;

{$R SQLERRS.RES}
{$I BTRIEVE.INC}

Const
  NO_MAPPING        = $FEFE;
  MAX_MAPPED_ERRORS = 65;

Const
  ErrorCodeMap : Array[1..MAX_MAPPED_ERRORS ] of MapRec =
    (
       (* /***************************************************************************/	*)
       (* /* MICROKERNEL DATABASE ENGINE STATUS CODES                                */	*)
       (* /*                                                                         */	*)
       (* /* The Microkernel Database Engine may return these status codes.          */	*)
       (* /***************************************************************************/	*)
       (  NatError: 0000;  BDEError: DBIERR_NONE ),         {Btrieve Call completed successfully.}
       (  NatError: 0001;  BDEError: DBIERR_INVALIDPARAM ), {The operation parameter is invalid.}
       (  NatError: 0002;  BDEError: DBIERR_READERR ),      {The application encountered an I/O error.}
       (  NatError: 0003;  BDEError: DBIERR_READERR ),      {The file is not open.}
       (  NatError: 0004;  BDEError: DBIERR_RECNOTFOUND  ), {The application cannot find the key value.}
       (  NatError: 0005;  BDEError: DBIERR_NOUNIQUERECS ), {The record has a key field containing a duplicate key value.}
       (  NatError: 0006;  BDEError: DBIERR_NOSUCHINDEX ),  {The key number parameter is invalid.}
       (  NatError: 0007;  BDEError: DBIERR_INVALIDINDEXNAME ), {The key number has changed.}
       (  NatError: 0008;  BDEError: DBIERR_NOCURRREC ),    {The current positioning is invalid.}

       (  NatError: 0009;  BDEError: DBIERR_EOF ),          {The operation encountered an end-of-file mark.}
       (  NatError: 0009;  BDEError: DBIERR_BOF ),          {The operation encountered an start-of-file mark.}

       (  NatError: 0010;  BDEError: DBIERR_KEYVIOL ),      {The key field is not modifiable.}
       (  NatError: 0011;  BDEError: DBIERR_INVALIDFILENAME ), {The specified filename is invalid.}
       (  NatError: 0012;  BDEError: DBIERR_NOSUCHFILE ),   {The MicroKernel cannot find the specified file.}
       (  NatError: 0013;  BDEError: DBIERR_UNKNOWNFILE ),  {The MicroKernel could not open the extension file.}
       (  NatError: 0014;  BDEError: DBIERR_UNKNOWNFILE ),  {The MicroKernel cannot create or open the preimage file.}
       (  NatError: 0015;  BDEError: DBIERR_READERR ),      {The application encountered an I/O error during preimaging.}
       (  NatError: 0016;  BDEError: DBIERR_WRITEERR ),     {The application encountered an expansion error.}
       (  NatError: 0017;  BDEError: DBIERR_CANNOTCLOSE ),  {The application encountered a close error.}
       (  NatError: 0018;  BDEError: DBIERR_NODISKSPACE ),  {The disk is full.}
       (  NatError: 0019;  BDEError: DBIERR_SYSCORRUPT ),   {The application encountered an unrecoverable error.}
       (  NatError: 0020;  BDEError: DBIERR_NOTINITIALIZED ), {The MicroKernel or Btrieve Requester is inactive.}
       (* NatError: 0021;  BDEError: DBIERR_???? ),         {The key buffer parameter is too short.} *)
       (* NatError: 0022;  BDEError: DBIERR_???? ),         {The data buffer parameter is too short.} *)
       (* NatError: 0023;  BDEError: DBIERR_???? ),         {The position block parameter is not 128 bytes long.} *)
       (* NatError: 0024;  BDEError: DBIERR_???? ),         {The page size or data buffer size is invalid.} *)
       (* NatError: 0025;  BDEError: DBIERR_???? ),         {The application cannot create the specified file.} *)
       (* NatError: 0026;  BDEError: DBIERR_???? ),         {The number of keys specified is invalid.} *)
       (* NatError: 0027;  BDEError: DBIERR_???? ),         {The key position is invalid.}	*)
       (* NatError: 0028;  BDEError: DBIERR_???? ),         {The record length is invalid.} *)
       (* NatError: 0029;  BDEError: DBIERR_???? ),         {The key length is invalid.} *)
       (* NatError: 0030;  BDEError: DBIERR_???? ),         {The file specified is not a Btrieve-compatible file.}	*)
       (* NatError: 0031;  BDEError: DBIERR_???? ),         {The file is already extended.} *)
       (* NatError: 0032;  BDEError: DBIERR_???? ),         {The file cannot be extended.}	*)
       (* NatError: 0033;  BDEError: DBIERR_???? ),         {The MicroKernel cannot unload.} *)
       (* NatError: 0034;  BDEError: DBIERR_???? ),         {The specified extension name is invalid.} *)
       (  NatError: 0035;  BDEError: DBIERR_INVALIDDIR ),   {The application encountered a directory error.}
       (* NatError: 0036;  BDEError: DBIERR_???? ),         {The application encountered a transaction error.} *)
       (* NatError: 0037;  BDEError: DBIERR_???? ),         {Another transaction is active.} *)
       (* NatError: 0038;  BDEError: DBIERR_???? ),         {The MicroKernel encountered a transaction control...} *)
       (* NatError: 0039;  BDEError: DBIERR_???? ),         {A Begin Transaction operation must precede an...} *)
       (* NatError: 0040;  BDEError: DBIERR_???? ),         {The file access request exceeds the maximum number...}*)
       (* NatError: 0041;  BDEError: DBIERR_???? ),         {The MicroKernel does not allow the attempted operation.} *)
       (  NatError: 0042;  BDEError: DBIERR_LOSTEXCLACCESS ), {A file previously opened in Accelerated mode...}
       (* NatError: 0043;  BDEError: DBIERR_???? ),         {The specified record address is invalid.} *)
       (* NatError: 0044;  BDEError: DBIERR_???? ),         {The specified key path is invalid.} *)
       (* NatError: 0045;  BDEError: DBIERR_???? ),         {The specified key flags are invalid.}	*)
       (* NatError: 0046;  BDEError: DBIERR_???? ),         {Access to the requested file is denied.} *)
       (  NatError: 0047;  BDEError: DBIERR_NOFILEHANDLES ), {The number of files opened exceeds the maximum allowed.}
       (* NatError: 0048;  BDEError: DBIERR_???? ),         {The alternate collating sequence definition is invalid.} *)
       (* NatError: 0049;  BDEError: DBIERR_???? ),         {The extended key type is invalid.} *)
       (* NatError: 0050;  BDEError: DBIERR_???? ),         {The file owner is already set.} *)
       (  NatError: 0051;  BDEError: DBIERR_INVALIDPASSWORD ), {The owner name is invalid.}
       (* NatError: 0053;  BDEError: DBIERR_???? ),         {The language interface version is invalid.}*)
       (* NatError: 0054;  BDEError: DBIERR_???? ),         {The variable-length portion of the record is corrupt.}*)
       (* NatError: 0055;  BDEError: DBIERR_???? ),         {The application specified an invalid attribute for...}*)
       (* NatError: 0058;  BDEError: DBIERR_???? ),         {The compression buffer length is too short.} *)
       (* NatError: 0059;  BDEError: DBIERR_???? ),         {The specified file already exists.} *)
       (* NatError: 0060;  BDEError: DBIERR_???? ),         {The specified reject count has been reached.}	*)
       (* NatError: 0061;  BDEError: DBIERR_???? ),         {The work space is too small.}	*)
       (* NatError: 0062;  BDEError: DBIERR_???? ),         {The descriptor is incorrect.}	*)
       (* NatError: 0063;  BDEError: DBIERR_???? ),         {The data buffer parameter specified on an Insert...} *)
       (* NatError: 0064;  BDEError: DBIERR_???? ),         {The filter limit has been reached.} *)
       (* NatError: 0065;  BDEError: DBIERR_???? ),         {The field offset is incorrect.} *)
       (  NatError: 0066;  BDEError: DBIERR_DBLIMIT ),      {The maximum number of open databases has been exceeded.}
       (* NatError: 0067;  BDEError: DBIERR_???? ),         {The MicroKernel cannot open the SQL data dictionary files.} *)
       (* NatError: 0068;  BDEError: DBIERR_???? ),         {The MicroKernel cannot perform the RI Delete...} *)
       (* NatError: 0069;  BDEError: DBIERR_???? ),         {The Delete operation specified a file that is damaged.} *)
       (* NatError: 0071;  BDEError: DBIERR_???? ),         {There is a violation of the RI definitions.} *)
       (* NatError: 0072;  BDEError: DBIERR_???? ),         {The MicroKernel cannot open the RI referenced file.} *)
       (* NatError: 0073;  BDEError: DBIERR_???? ),         {The RI definition is out of sync.} *)
       (* NatError: 0074;  BDEError: DBIERR_???? ),         {The MicroKernel aborted the transaction.} *)
       (* NatError: 0076;  BDEError: DBIERR_???? ),         {There is a conflict on the referenced file.} *)
       (* NatError: 0077;  BDEError: DBIERR_???? ),         {The application encountered a wait error.} *)
       (  NatError: 0078;  BDEError: DBIERR_DEADLOCK ),     {The MicroKernel detected a deadlock condition.}
       (  NatError: 0080;  BDEError: DBIERR_FILEBUSY ),     {The MicroKernel encountered a record-level conflict.}
       (  NatError: 0081;  BDEError: DBIERR_LOCKED ),       {The MicroKernel encountered a lock error.}
       (  NatError: 0082;  BDEError: DBIERR_NOCURRREC ),    {The MicroKernel lost positioning.}
       (* NatError: 0083;  BDEError: DBIERR_???? ),         {The MicroKernel attempted to read a record...} *)
       (  NatError: 0084;  BDEError: DBIERR_LOCKED ),       {The record or page is locked.}
       (  NatError: 0085;  BDEError: DBIERR_FILEBUSY ),     {The file is locked.}
       (  NatError: 0086;  BDEError: DBIERR_OPENTBLLIMIT ), {The file table is full.}
       (  NatError: 0087;  BDEError: DBIERR_CURSORLIMIT ),  {The handle table is full.}
       (  NatError: 0088;  BDEError: DBIERR_INVALIDMODE ),         {The application encountered an incompatible mode error.}
       (* NatError: 0090;  BDEError: DBIERR_???? ),         {Redirected device table full.} *)
       (  NatError: 0091;  BDEError: DBIERR_OSUNKNOWNSRVERR ), {The application encountered a server error.}
       (* NatError: 0092;  BDEError: DBIERR_???? ),         {The transaction table is full.} *)
       (* NatError: 0093;  BDEError: DBIERR_???? ),         {The record lock types are incompatible.} *)
       (* NatError: 0094;  BDEError: DBIERR_???? ),         {The application encountered a permission error.} *)
       (* NatError: 0095;  BDEError: DBIERR_???? ),         {The session is no longer valid.} *)
       (* NatError: 0096;  BDEError: DBIERR_???? ),         {A communications environment error occurred.}	*)
       (* NatError: 0097;  BDEError: DBIERR_???? ),         {The data buffer is too small.} *)
       (* NatError: 0098;  BDEError: DBIERR_???? ),         {The MicroKernel detected an internal transaction error.} *)
       (* NatError: 0099;  BDEError: DBIERR_???? ),         {Btrieve requester unable to access NetWare Runtime server.} *)
       (* NatError: 0100;  BDEError: DBIERR_???? ),         {No cache buffers are available.} *)
       ( NatError: 0101;  BDEError: DBIERR_NOMEMORY ),         {Insufficient operating system memory is available.}
       (* NatError: 0102;  BDEError: DBIERR_???? ),         {Insufficient stack space is available.} *)
       (* NatError: 0103;  BDEError: DBIERR_???? ),         {The chunk offset is too big.}	*)
       (* NatError: 0104;  BDEError: DBIERR_???? ),         {The MicroKernel does not recognize the locale.} *)
       (* NatError: 0105;  BDEError: DBIERR_???? ),         {The file cannot be created with Variable-tail Allocation.}  *)
       (* NatError: 0106;  BDEError: DBIERR_???? ),         {The chunk cannot perform a Get Next operation.} *)
       (* NatError: 0107;  BDEError: DBIERR_???? ),         {The application attempted to perform a chunk operation...} *)
       (* NatError: 0109;  BDEError: DBIERR_???? ),         {The application's transaction has become too complex.} *)
       (  NatError: 0130;  BDEError: DBIERR_LOCKFILELIMIT ), {The MicroKernel ran out of system locks.}
       (  NatError: 0133;  BDEError: DBIERR_USECOUNT ),     {6 concurrent users attempted to use Developers kit.}

       (* /***************************************************************************/	*)
       (* /* SCALABLE SQL ENGINE STATUS CODES                                        */	*)
       (* /*                                                                         */	*)
       (* /* The Scalable SQL engine may return these status codes.                  */	*)
       (* /* Many of the status codes in this section refer to APIs that are         */	*)
       (* /* no longer documented, but were documented in the predecessor to         */	*)
       (* /* this product, NetWare SQL. All functions are supported by               */	*)
       (* /* Scalable SQL for backward compatibility.                                */	*)
       (* /***************************************************************************/	*)
       (* NatError: 0200;  BDEError: DBIERR_???? ),         {The Scalable SQL local engine or Requester is not loaded.} *)
       (* NatError: 0201;  BDEError: DBIERR_???? ),         {The relational primitive function code is invalid.} *)
       (* NatError: 0202;  BDEError: DBIERR_???? ),         {The cursor ID parameter is invalid.} *)
       (* NatError: 0203;  BDEError: DBIERR_???? ),         {The master password is invalid.} *)
       (  NatError: 0204;  BDEError: DBIERR_NOSUCHTABLE ),  {The table is not defined in the dictionary.}
       (  NatError: 0205;  BDEError: DBIERR_INVALIDPASSWORD ),{The password is invalid.}
       (  NatError: 0206;  BDEError: DBIERR_CURSORLIMIT ),  {The maximum number of cursors has been exceeded.}
       (* NatError: 0207;  BDEError: DBIERR_???? ),         {The field does not exist in the dictionary.} *)
       (* NatError: 0208;  BDEError: DBIERR_???? ),         {The position parameter value is out of range for...} *)
       (  NatError: 0209;  BDEError: DBIERR_INVALIDUSRPASS ), {The specified username or group name is invalid.}
       (* NatError: 0210;  BDEError: DBIERR_???? ),         {The buffer is not large enough to hold all the data.} *)
       (  NatError: 0211;  BDEError: DBIERR_RECTOOBIG ),    {The maximum record size has been exceeded.}
       (* NatError: 0212;  BDEError: DBIERR_???? ),         {The maximum index size has been exceeded.} *)
       (* NatError: 0213;  BDEError: DBIERR_???? ),         {You do not have Select (Read) rights for the...} *)
       (* NatError: 0214;  BDEError: DBIERR_???? ),         {You must revoke Alter rights before attempting to...} *)
       (* NatError: 0215;  BDEError: DBIERR_???? ),         {The lock flag is invalid.} *)
       (* NatError: 0217;  BDEError: DBIERR_???? ),         {You cannot join a table to a view that is ordered by a...} *)
       (* NatError: 0218;  BDEError: DBIERR_???? ),         {You have exceeded the maximum number of tables allowed...} *)
       (* NatError: 0219;  BDEError: DBIERR_???? ),         {You can specify a maximum of 24 index segments for a...} *)
       (* NatError: 0220;  BDEError: DBIERR_???? ),         {The secondary fields you defined have no matching...} *)
       (* NatError: 0221;  BDEError: DBIERR_???? ),         {The syntax for an expression or restriction clause is...} *)
       (* NatError: 0222;  BDEError: DBIERR_???? ),         {The memory allocation is insufficient for Scalable SQL...} *)
       (* NatError: 0223;  BDEError: DBIERR_???? ),         {The data type is invalid for the expression.}	*)
       (* NatError: 0224;  BDEError: DBIERR_???? ),         {A character in the numeric data is invalid.} *)
       (* NatError: 0225;  BDEError: DBIERR_???? ),         {Scalable SQL allows a maximum of 119 fields in...} *)
       (* NatError: 0226;  BDEError: DBIERR_???? ),         {The record count is invalid.}	*)
       (* NatError: 0227;  BDEError: DBIERR_???? ),         {The expressions must be field names or constants.} *)
       (* NatError: 0228;  BDEError: DBIERR_???? ),         {The data length in the buffer is invalid.} *)
       (* NatError: 0229;  BDEError: DBIERR_???? ),         {The field already exists in this table definition.} *)
       (* NatError: 0230;  BDEError: DBIERR_???? ),         {The restriction clause is incomplete.} *)
       ( NatError: 0231;  BDEError: DBIERR_INVALIDRECSTRUCT ), {No fields are defined in the view.}
       (* NatError: 0232;  BDEError: DBIERR_???? ),         {The field must be in the current view.} *)
       (* NatError: 0234;  BDEError: DBIERR_???? ),         {Scalable SQL cannot create the external index file.} *)
       (* NatError: 0235;  BDEError: DBIERR_???? ),         {The option value is invalid for the Fetch, Update, or Delete.} *)
       (* NatError: 0236;  BDEError: DBIERR_???? ),         {You cannot update a view that is ordered on an...} *)
       (* NatError: 0237;  BDEError: DBIERR_???? ),         {When you define a named index, you must specify...} *)
       (* NatError: 0238;  BDEError: DBIERR_???? ),         {The named index does not exist.} *)
       (* NatError: 0239;  BDEError: DBIERR_???? ),         {The table in the view definition is not in the...} *)
       (* NatError: 0240;  BDEError: DBIERR_???? ),         {The field in the view definition is not in the...} *)
       (* NatError: 0241;  BDEError: DBIERR_???? ),         {The application cannot explicitly update a system table.} *)
       (* NatError: 0242;  BDEError: DBIERR_???? ),         {You do not have Write access to this table.} *)
       (* NatError: 0243;  BDEError: DBIERR_???? ),         {You do not have Write access to all the fields...} *)
       (* NatError: 0244;  BDEError: DBIERR_???? ),         {You do not have Write access to all fields in this table.} *)
       (* NatError: 0245;  BDEError: DBIERR_???? ),         {The application cannot delete a system table.} *)
       (* NatError: 0246;  BDEError: DBIERR_???? ),         {You do not have rights to specify or alter table definitions.} *)
       (* NatError: 0247;  BDEError: DBIERR_???? ),         {You do not have Read rights to all the fields you specified.}	*)
       (* NatError: 0248;  BDEError: DBIERR_???? ),         {The specified size is invalid for the defined data type.} *)
       (* NatError: 0249;  BDEError: DBIERR_???? ),         {The data types of the fields are incompatible.} *)
       (* NatError: 0250;  BDEError: DBIERR_???? ),         {Scalable SQL cannot recall the view.}	*)
       (* NatError: 0251;  BDEError: DBIERR_???? ),         {Scalable SQL cannot read the X$View system table.} *)
       (* NatError: 0252;  BDEError: DBIERR_???? ),         {VIEW.DDF must be open before you can perform this operation.}	*)
       (* NatError: 0253;  BDEError: DBIERR_???? ),         {The view definition was created with a later version...} *)
       (* NatError: 0254;  BDEError: DBIERR_???? ),         {Scalable SQL cannot create the X$View system table.} *)
       (* NatError: 0255;  BDEError: DBIERR_???? ),         {The field is not defined as an index.} *)
       (* NatError: 0256;  BDEError: DBIERR_???? ),         {You must specify at least one table for an Insert,...} *)
       (* NatError: 0257;  BDEError: DBIERR_???? ),         {The specified table is already defined.} *)
       (* NatError: 0258;  BDEError: DBIERR_???? ),         {Scalable SQL cannot update the table definition...} *)
       (* NatError: 0259;  BDEError: DBIERR_???? ),         {Scalable SQL cannot insert the new table...} *)
       (* NatError: 0260;  BDEError: DBIERR_???? ),         {Scalable SQL cannot update the X$Rights system table.} *)
       (* NatError: 0261;  BDEError: DBIERR_???? ),         {A variable-length field must be defined last in a...} *)
       (* NatError: 0262;  BDEError: DBIERR_???? ),         {You cannot define a variable-length field as an index.} *)
       (* NatError: 0263;  BDEError: DBIERR_???? ),         {You cannot sort a view by a variable-length field.} *)
       (* NatError: 0264;  BDEError: DBIERR_???? ),         {You cannot modify or remove the master username.} *)
       (* NatError: 0265;  BDEError: DBIERR_???? ),         {The session identifier is invalid.} *)
       (* NatError: 0266;  BDEError: DBIERR_???? ),         {You have exceeded the maximum number of sessions.} *)
       (* NatError: 0269;  BDEError: DBIERR_???? ),         {Scalable SQL cannot create the X$User system table.} *)
       (* NatError: 0270;  BDEError: DBIERR_???? ),         {Scalable SQL cannot open the X$User system table.} *)
       (* NatError: 0271;  BDEError: DBIERR_???? ),         {Scalable SQL cannot create the X$Rights system table.} *)
       (* NatError: 0272;  BDEError: DBIERR_???? ),         {Scalable SQL cannot open the X$Rights system table.} *)
       (* NatError: 0273;  BDEError: DBIERR_???? ),         {Scalable SQL cannot read or update the X$User system table.} *)
       (* NatError: 0274;  BDEError: DBIERR_???? ),         {Scalable SQL cannot assign the owner name to the...} *)
       (* NatError: 0275;  BDEError: DBIERR_???? ),         {The user or group already exists in the dictionary.} *)
       (* NatError: 0276;  BDEError: DBIERR_???? ),         {Only the master user can perform this operation.} *)
       (* NatError: 0277;  BDEError: DBIERR_???? ),         {The access rights code is invalid.} *)
       (* NatError: 0278;  BDEError: DBIERR_???? ),         {The option is invalid.} *)
       (* NatError: 0279;  BDEError: DBIERR_???? ),         {The mask is invalid for the data type specified.} *)
       (* NatError: 0280;  BDEError: DBIERR_???? ),         {The USING clause in the ALTER TABLE statement contains...} *)
       (* NatError: 0281;  BDEError: DBIERR_???? ),         {The attribute is not defined in the current dictionary.} *)
       (* NatError: 0282;  BDEError: DBIERR_???? ),         {The data you specified includes invalid characters.} *)
       (* NatError: 0283;  BDEError: DBIERR_???? ),         {A field value is not within the range of valid values.} *)
       (* NatError: 0284;  BDEError: DBIERR_???? ),         {A field value is not in the list of valid values.} *)
       (  NatError: 0285;  BDEError: DBIERR_NOTABLESUPPORT ), {Scalable SQL cannot open the system tables.}
       (* NatError: 0286;  BDEError: DBIERR_???? ),         {You cannot turn security on(off) when it is already on(off).} *)
       (* NatError: 0287;  BDEError: DBIERR_???? ),         {No data dictionary is currently active.} *)
       (* NatError: 0288;  BDEError: DBIERR_???? ),         {The data dictionary is in use.} *)
       (* NatError: 0290;  BDEError: DBIERR_???? ),         {The specified data dictionary already exists.} *)
       (* NatError: 0291;  BDEError: DBIERR_???? ),         {The specified directory does not contain a data dictionary.} *)
       (* NatError: 0292;  BDEError: DBIERR_???? ),         {The numeric value for the month is invalid.} *)
       (* NatError: 0293;  BDEError: DBIERR_???? ),         {The numeric value for the day of the month is invalid.} *)
       (* NatError: 0294;  BDEError: DBIERR_???? ),         {The specified numeric time value is not within...} *)
       (* NatError: 0295;  BDEError: DBIERR_???? ),         {The specified open mode value is invalid.} *)
       (* NatError: 0296;  BDEError: DBIERR_???? ),         {Scalable SQL cannot open the data file to retrieve...} *)
       (* NatError: 0297;  BDEError: DBIERR_???? ),         {You cannot delete the field from the view.} *)
       (* NatError: 0298;  BDEError: DBIERR_???? ),         {A string constant contains mismatched quotes.} *)
       (* NatError: 0299;  BDEError: DBIERR_???? ),         {The join index for tableName:n.fieldName is invalid.} *)
       (* NatError: 0300;  BDEError: DBIERR_???? ),         {A conditional computed field must contain a :: operator.} *)
       (* NatError: 0301;  BDEError: DBIERR_???? ),         {No restriction clause has been defined for the view.} *)
       (* NatError: 0302;  BDEError: DBIERR_???? ),         {The specified field is not a computed field.}	*)
       (* NatError: 0304;  BDEError: DBIERR_???? ),         {You cannot change another user's password.} *)
       (* NatError: 0305;  BDEError: DBIERR_???? ),         {The specified view is not in the current dictionary.} *)
       (* NatError: 0306;  BDEError: DBIERR_???? ),         {Scalable SQL encountered an error while attempting...} *)
       (* NatError: 0307;  BDEError: DBIERR_???? ),         {The computed field you specified for the join does not...} *)
       (* NatError: 0308;  BDEError: DBIERR_???? ),         {Scalable SQL cannot read the master password from the...}	*)
       (* NatError: 0309;  BDEError: DBIERR_???? ),         {The valid owner access codes are 0, 1, 2, and 3.} *)
       (* NatError: 0310;  BDEError: DBIERR_???? ),         {You do not have Read access to all the specified tables.} *)
       (* NatError: 0312;  BDEError: DBIERR_???? ),         {Scalable SQL aborted the transaction.} *)
       (* NatError: 0313;  BDEError: DBIERR_???? ),         {You have already started transaction processing.} *)
       (* NatError: 0314;  BDEError: DBIERR_???? ),         {Scalable SQL cannot initiate the transaction; you must...} *)
       (* NatError: 0315;  BDEError: DBIERR_???? ),         {An application cannot change the dictionary or data path...} *)
       (* NatError: 0316;  BDEError: DBIERR_???? ),         {Scalable SQL engine or Requester cannot unload.} *)
       (* NatError: 0317;  BDEError: DBIERR_???? ),         {Another user has locked the dictionary within a transaction.}	*)
       (* NatError: 0318;  BDEError: DBIERR_???? ),         {You cannot update a read-only view.} *)
       (* NatError: 0319;  BDEError: DBIERR_???? ),         {A value in the list is invalid for the defined field...} *)
       (* NatError: 0320;  BDEError: DBIERR_???? ),         {A character in the list is invalid for the defined...}*)
       (* NatError: 0321;  BDEError: DBIERR_???? ),         {The specified default value is invalid for the defined...}*)
       (* NatError: 0322;  BDEError: DBIERR_???? ),         {The specified range value is invalid for the defined...}*)
       (* NatError: 0323;  BDEError: DBIERR_???? ),         {You cannot perform the specified operation on a table...} *)
       (* NatError: 0324;  BDEError: DBIERR_???? ),         {The restriction clause or computed field contains...} *)
       (* NatError: 0325;  BDEError: DBIERR_???? ),         {The sum of the sizes of the fixed-length fields must...} *)
       (* NatError: 0326;  BDEError: DBIERR_???? ),         {Scalable SQL has exhausted its internal stack space.}	*)
       (* NatError: 0328;  BDEError: DBIERR_???? ),         {The syntax in a restriction clause or computed field...} *)
       (* NatError: 0329;  BDEError: DBIERR_???? ),         {The specified number of decimal places exceeds...} *)
       (* NatError: 0330;  BDEError: DBIERR_???? ),         {The data is not formatted according to the appropriate mask.}	*)
       (* NatError: 0331;  BDEError: DBIERR_???? ),         {The operation performed on a group is invalid.} *)
       (* NatError: 0332;  BDEError: DBIERR_???? ),         {You must convert the dictionary for use with Scalable...}*)
       (* NatError: 0333;  BDEError: DBIERR_???? ),         {Scalable SQL cannot store the index definitions.} *)
       (* NatError: 0334;  BDEError: DBIERR_???? ),         {Index names must be unique in the dictionary.} *)
       (* NatError: 0335;  BDEError: DBIERR_???? ),         {The specified join option is invalid.} *)
       (* NatError: 0336;  BDEError: DBIERR_???? ),         {You cannot use xConvert or XQLConvert to convert...} *)
       (* NatError: 0337;  BDEError: DBIERR_???? ),         {You have specified a pathname that exceeds the max...} *)
       (* NatError: 0338;  BDEError: DBIERR_???? ),         {You cannot enable or disable security when a view is active.}	*)
       (* NatError: 0339;  BDEError: DBIERR_???? ),         {You cannot perform an Insert, Update, or Delete op...}*)
       (* NatError: 0340;  BDEError: DBIERR_???? ),         {You cannot define a field of data type BIT as an index.} *)
       (* NatError: 0341;  BDEError: DBIERR_???? ),         {An index of data type AUTOINC must be unique and...} *)
       (* NatError: 0342;  BDEError: DBIERR_???? ),         {A parameter for the scalar function in an expression...} *)
       (* NatError: 0343;  BDEError: DBIERR_???? ),         {You cannot remove the group PUBLIC.} *)
       (* NatError: 0344;  BDEError: DBIERR_???? ),         {The DOS rename function failed.} *)
       (* NatError: 0345;  BDEError: DBIERR_???? ),         {The computed field name is invalid.} *)
       (* NatError: 0346;  BDEError: DBIERR_???? ),         {Scalable SQL has detected a math overflow.} *)
       (* NatError: 0347;  BDEError: DBIERR_???? ),         {A field descriptor is missing.} *)
       ( NatError: 0348;  BDEError: DBIERR_UNKNOWNDB ),     {Cannot locate the named database you specified.}
       (* NatError: 0349;  BDEError: DBIERR_???? ),         {The specified value exceeds the maximum length defined...} *)
       (* NatError: 0350;  BDEError: DBIERR_???? ),         {Security has not been enabled on this dictionary.} *)
       (* NatError: 0351;  BDEError: DBIERR_???? ),         {A transaction has not yet been started.} *)
       (* NatError: 0352;  BDEError: DBIERR_???? ),         {The record count must be greater than zero.} *)
       (* NatError: 0353;  BDEError: DBIERR_???? ),         {The data definition includes an inconsistency.} *)
       (* NatError: 0354;  BDEError: DBIERR_???? ),         {The iCount parameter is not set correctly for the API.} *)
       (* NatError: 0501;  BDEError: DBIERR_???? ),         {The SQL statement does not begin with a valid keyword.} *)
       (* NatError: 0502;  BDEError: DBIERR_???? ),         {The SELECT statement is invalid.} *)
       (* NatError: 0503;  BDEError: DBIERR_???? ),         {The function code is invalid.} *)
       (* NatError: 0504;  BDEError: DBIERR_???? ),         {The specified open mode is invalid.} *)
       (* NatError: 0505;  BDEError: DBIERR_???? ),         {Each item in the attribute list must be enclosed in...}*)
       (* NatError: 0506;  BDEError: DBIERR_???? ),         {The INSERT statement is invalid.} *)
       (* NatError: 0507;  BDEError: DBIERR_???? ),         {The UPDATE statement is invalid.} *)
       (* NatError: 0508;  BDEError: DBIERR_???? ),         {The DELETE statement is invalid.} *)
       (* NatError: 0509;  BDEError: DBIERR_???? ),         {The SET statement is invalid.} *)
       (* NatError: 0510;  BDEError: DBIERR_???? ),         {The keyword following CREATE must be TABLE, VIEW,...}*)
       (* NatError: 0511;  BDEError: DBIERR_???? ),         {The index name is missing or invalid.} *)
       (* NatError: 0512;  BDEError: DBIERR_???? ),         {The GRANT statement is invalid.} *)
       (* NatError: 0513;  BDEError: DBIERR_???? ),         {You must specify a username in a GRANT or REVOKE statement.} *)
       (* NatError: 0514;  BDEError: DBIERR_???? ),         {The table name is missing or invalid.} *)
       (* NatError: 0515;  BDEError: DBIERR_???? ),         {The syntax of the ALTER TABLE statement is invalid.} *)
       (* NatError: 0516;  BDEError: DBIERR_???? ),         {The ALTER TABLE statement requires either an ADD, DROP,...} *)
       (* NatError: 0517;  BDEError: DBIERR_???? ),         {You must include a FROM clause in the SELECT statement.} *)
       (* NatError: 0518;  BDEError: DBIERR_???? ),         {The sort keyword must follow a field name in an ORDER...} *)
       (* NatError: 0519;  BDEError: DBIERR_???? ),         {The AS keyword is missing, or a field heading is invalid.} *)
       (* NatError: 0520;  BDEError: DBIERR_???? ),         {The keyword BY must follow ORDER and GROUP.} *)
       (* NatError: 0521;  BDEError: DBIERR_???? ),         {The view name is missing or invalid.}	*)
       (* NatError: 0522;  BDEError: DBIERR_???? ),         {The statement contains an unknown keyword.} *)
       (* NatError: 0523;  BDEError: DBIERR_???? ),         {The access privilege keyword following GRANT...} *)
       (* NatError: 0524;  BDEError: DBIERR_???? ),         {You can grant field-level privileges for Select...} *)
       (* NatError: 0525;  BDEError: DBIERR_???? ),         {You must specify a master password in a SET SECURITY...} *)
       (* NatError: 0526;  BDEError: DBIERR_???? ),         {The field name cannot be a Scalable SQL keyword.} *)
       (* NatError: 0527;  BDEError: DBIERR_???? ),         {You must specify the new user's password in a GRANT...}*)
       (* NatError: 0528;  BDEError: DBIERR_???? ),         {You must provide a valid value enclosed in single...} *)
       (* NatError: 0529;  BDEError: DBIERR_???? ),         {You must supply one or more owner names after the = sign.} *)
       (* NatError: 0530;  BDEError: DBIERR_???? ),         {You must supply a dictionary path after the equal sign.} *)
       (* NatError: 0531;  BDEError: DBIERR_???? ),         {You must supply a data file path after the equal sign.} *)
       (* NatError: 0532;  BDEError: DBIERR_???? ),         {The SET statement must contain an equal sign.} *)
       (* NatError: 0533;  BDEError: DBIERR_???? ),         {The specified data type is invalid.} *)
       (* NatError: 0534;  BDEError: DBIERR_???? ),         {You must include SELECT in a CREATE VIEW statement.} *)
       (* NatError: 0535;  BDEError: DBIERR_???? ),         {When defining an index, you must include index attributes.} *)
       (* NatError: 0536;  BDEError: DBIERR_???? ),         {A field name in ALTER TABLE is invalid, or CREATE...} *)
       (* NatError: 0537;  BDEError: DBIERR_???? ),         {The specified field name already exists in this def.} *)
       ( NatError: 0538;  BDEError: DBIERR_INVALIDIDXDESC ),{The field name you specified for the index def is invalid.}
       (* NatError: 0539;  BDEError: DBIERR_???? ),         {The specified index is already defined in this definition.} *)
       (* NatError: 0540;  BDEError: DBIERR_???? ),         {A field list must follow SELECT, ORDER BY, and GROUP BY.} *)
       (* NatError: 0541;  BDEError: DBIERR_???? ),         {A restriction clause must follow WHERE and HAVING.} *)
       (* NatError: 0542;  BDEError: DBIERR_???? ),         {The keyword following DROP must be DICTIONARY,...} *)
       (* NatError: 0543;  BDEError: DBIERR_???? ),         {You must enclose a string in single quotation marks.}	*)
       (* NatError: 0544;  BDEError: DBIERR_???? ),         {You must specify a dir path in a DROP DICT statement.} *)
       (* NatError: 0545;  BDEError: DBIERR_???? ),         {You must include INTO in an INSERT statement.} *)
       (* NatError: 0546;  BDEError: DBIERR_???? ),         {The max string size allowed in a statement is 255 bytes.} *)
       (* NatError: 0547;  BDEError: DBIERR_???? ),         {You must include a field attribute in a SET statement.} *)
       (* NatError: 0548;  BDEError: DBIERR_???? ),         {TRANSACTION must follow START; COMMIT or ROLLBACK...}*)
       (* NatError: 0549;  BDEError: DBIERR_???? ),         {The ORDER BY clause must be specified last...} *)
       (* NatError: 0550;  BDEError: DBIERR_???? ),         {An alias name has already been defined for the table.} *)
       (* NatError: 0551;  BDEError: DBIERR_???? ),         {The specified dictionary name contains invalid characters.} *)
       (* NatError: 0552;  BDEError: DBIERR_???? ),         {A SELECT clause must follow UNION.} *)
       (* NatError: 0553;  BDEError: DBIERR_???? ),         {The field name must not exceed 20 characters.} *)
       (* NatError: 0554;  BDEError: DBIERR_???? ),         {You must specify a group name with CREATE GROUP,...} *)
       (* NatError: 0555;  BDEError: DBIERR_???? ),         {The keyword DICTIONARY must follow IN in an ALTER TABLE } *)
       (* NatError: 0556;  BDEError: DBIERR_???? ),         {A parameter in the CREATE TABLE statement is invalid.} *)
       (* NatError: 0557;  BDEError: DBIERR_???? ),         {Scalable SQL cannot access the alternate collating { *)
       (* NatError: 0558;  BDEError: DBIERR_???? ),         {You cannot use a group aggregate function within an expr.}*)
       (* NatError: 0559;  BDEError: DBIERR_???? ),         {You cannot create a view or a stored SQL...} *)
       (* NatError: 0560;  BDEError: DBIERR_???? ),         {Scalable SQL encountered an error while...} *)
       (* NatError: 0561;  BDEError: DBIERR_???? ),         {A CREATE PROCEDURE statement must include...} *)
       (* NatError: 0562;  BDEError: DBIERR_???? ),         {The parameter name must precede the parameter value.}*)
       (* NatError: 0564;  BDEError: DBIERR_???? ),         {You must declare all parameters when you...} *)
       (* NatError: 0565;  BDEError: DBIERR_???? ),         {The specified isolation level is invalid.} *)
       (* NatError: 0566;  BDEError: DBIERR_???? ),         {You must specify an isolation level in a SET ISOLATION...}*)
       (* NatError: 0567;  BDEError: DBIERR_???? ),         {The syntax for the primary or foreign key def is invalid.} *)
       (* NatError: 0569;  BDEError: DBIERR_???? ),         {A CREATE VIEW statement cannot specify a union.} *)
       (* NatError: 0800;  BDEError: DBIERR_???? ),         {The memory allocation is insufficient for...} *)
       (* NatError: 0802;  BDEError: DBIERR_???? ),         {The Scalable SQL local engine or Requester is not loaded.} *)
       (* NatError: 0803;  BDEError: DBIERR_???? ),         {You must obtain a valid session ID before...} *)
       (* NatError: 0804;  BDEError: DBIERR_???? ),         {The speci}
       (* NatError: 0805;  BDEError: DBIERR_???? ),         {The specified size for the data type is invalid.} *)
       (* NatError: 0806;  BDEError: DBIERR_???? ),         {The specified # of decimal places exceeds the field size.} *)
       (* NatError: 0807;  BDEError: DBIERR_???? ),         {A variable in the substitution list is invalid.} *)
       (* NatError: 0808;  BDEError: DBIERR_???? ),         {All variables were not replaced with values.}	*)
       (* NatError: 0809;  BDEError: DBIERR_???? ),         {The specified field is not in the recalled view.} *)
       (* NatError: 0810;  BDEError: DBIERR_???? ),         {The specified numeric data contains invalid characters.} *)
       (* NatError: 0811;  BDEError: DBIERR_???? ),         {The specified numeric value for the month is invalid.} *)
       (* NatError: 0812;  BDEError: DBIERR_???? ),         {The specified numeric value for the day...} *)
       (* NatError: 0813;  BDEError: DBIERR_???? ),         {The numeric time value is...} *)
       (* NatError: 0815;  BDEError: DBIERR_???? ),         {The specified join field is invalid.} *)
       (* NatError: 0816;  BDEError: DBIERR_???? ),         {The specified field is not defined in this table.} *)
       (* NatError: 0818;  BDEError: DBIERR_???? ),         {The select terms must be either group aggregate...} *)
       (* NatError: 0819;  BDEError: DBIERR_???? ),         {The specified table name is invalid.}	*)
       (* NatError: 0820;  BDEError: DBIERR_???? ),         {You must include a comparison operator in the HAVING clause.}	*)
       (* NatError: 0821;  BDEError: DBIERR_???? ),         {The specified cursor ID is invalid.} *)
       (* NatError: 0822;  BDEError: DBIERR_???? ),         {The data buffer is too small to hold the requested data.} *)
       (* NatError: 0823;  BDEError: DBIERR_???? ),         {The position you specified in the ORDER BY clause is invalid.} *)
       (* NatError: 0824;  BDEError: DBIERR_???? ),         {The statement contains an unmatched parenthesis.} *)
       (* NatError: 0825;  BDEError: DBIERR_???? ),         {You cannot use the AVG or SUM functions on STRING,...}*)
       (* NatError: 0826;  BDEError: DBIERR_???? ),         {The statement contains an unmatched parenthesis...} *)
       (* NatError: 0827;  BDEError: DBIERR_???? ),         {The fields in the GROUP BY control field list must...} *)
       (* NatError: 0828;  BDEError: DBIERR_???? ),         {The WHERE clause must be the last clause in the statement.} *)
       (* NatError: 0829;  BDEError: DBIERR_???? ),         {The syntax for the computed field definition is invalid.} *)
       (* NatError: 0830;  BDEError: DBIERR_???? ),         {The HAVING clause requires another condition or contains...} *)
       (* NatError: 0831;  BDEError: DBIERR_???? ),         {An expression in a HAVING condition is invalid.} *)
       (* NatError: 0832;  BDEError: DBIERR_???? ),         {The statement cannot be recalled because it is not of...} *)
       (* NatError: 0833;  BDEError: DBIERR_???? ),         {The fields in the ORDER BY clause must be defined in...} *)
       (* NatError: 0835;  BDEError: DBIERR_???? ),         {The specified option for XQLStatus is invalid.} *)
       (* NatError: 0836;  BDEError: DBIERR_???? ),         {The specified mask is invalid for the field's data type.} *)
       (* NatError: 0837;  BDEError: DBIERR_???? ),         {The delimiter separating the field size and decimal...} *)
       (* NatError: 0838;  BDEError: DBIERR_???? ),         {In a union, the number of fields in each SELECT clause...} *)
       (* NatError: 0839;  BDEError: DBIERR_???? ),         {In a union, the fields must be compatible data types.} *)
       (* NatError: 0840;  BDEError: DBIERR_???? ),         {Scalable SQL has exhausted its internal stack space.}*)
       (* NatError: 0841;  BDEError: DBIERR_???? ),         {Scalable SQL cannot create a temporary sort file.} *)
       (* NatError: 0842;  BDEError: DBIERR_???? ),         {The HAVING clause cannot contain a correlated subquery.} *)
       (* NatError: 0845;  BDEError: DBIERR_???? ),         {The number of field headings must match the number of...} *)
       (* NatError: 0846;  BDEError: DBIERR_???? ),         {You must specify a field name for the group agg function.} *)
       (* NatError: 0847;  BDEError: DBIERR_???? ),         {The syntax in the WHERE clause is invalid.} *)
       (* NatError: 0848;  BDEError: DBIERR_???? ),         {A statement may contain only one DISTINCT keyword.} *)
       (* NatError: 0849;  BDEError: DBIERR_???? ),         {The buffer is not large enough for SSQL to process...} *)
       (* NatError: 0850;  BDEError: DBIERR_???? ),         {SSQL cannot convert the data values to the new data type.} *)
       (* NatError: 0851;  BDEError: DBIERR_???? ),    	    {In an INSERT or UPDATE statement, a subquery cannot...} *)
       (* NatError: 0852;  BDEError: DBIERR_???? ),         {The record count must be greater than zero.} *)
       (* NatError: 0853;  BDEError: DBIERR_???? ),         {You do not have the necessary rights to access the table.} *)
       (* NatError: 0856;  BDEError: DBIERR_???? ),         {The number of values cannot exceed the number of fields...}*)
       (* NatError: 0857;  BDEError: DBIERR_???? ),         {You cannot use the equal to (=) operator with ALL in...}*)
       (* NatError: 0858;  BDEError: DBIERR_???? ),         {You can use CASE only with string data types.} *)
       (* NatError: 0859;  BDEError: DBIERR_???? ),         {The ORDER BY clause must specify the field position.}	*)
       (* NatError: 0860;  BDEError: DBIERR_???? ),         {The buffer is not large enough for Scalable SQL to...}*)
       (* NatError: 0861;  BDEError: DBIERR_???? ),         {A value must follow the equal sign (=).} *)
       (* NatError: 0862;  BDEError: DBIERR_???? ),         {The specified stored SQL statement name is not in...}*)
       (* NatError: 0863;  BDEError: DBIERR_???? ),         {Scalable SQL cannot recall the stored SQL statement.}*)
       (* NatError: 0864;  BDEError: DBIERR_???? ),         {The specified parameter is not saved in the stored SQL...}*)
       (* NatError: 0865;  BDEError: DBIERR_???? ),         {You cannot update fields that exceed 255 characters by...} *)
       (* NatError: 0866;  BDEError: DBIERR_???? ),         {You cannot use the XQLSubst function with a stored SQL..}*)
       (* NatError: 0867;  BDEError: DBIERR_???? ),	    {The stored SQL statement was not created with the...} *)
       (* NatError: 0868;  BDEError: DBIERR_???? ),         {Scalable SQL cannot read or update the X$Relate system...}*)
       (* NatError: 0869;  BDEError: DBIERR_???? ),         {No primary key is defined on the parent table.} *)
       (* NatError: 0870;  BDEError: DBIERR_???? ),	    {The index must exist before you can use ALTER TABLE to...} *)
       (* NatError: 0871;  BDEError: DBIERR_???? ),         {The primary key must be a unique, non-null index.} *)
       (* NatError: 0872;  BDEError: DBIERR_???? ),         {The specified foreign key name already exists in the dict.} *)
       (* NatError: 0873;  BDEError: DBIERR_???? ),         {The parent table must exist before you define...}*)
       (* NatError: 0874;  BDEError: DBIERR_???? ),         {The specified foreign key does not exist.} *)
       (* NatError: 0875;  BDEError: DBIERR_???? ),	    {You must place the plus sign (+) for an outer join...} *)
       (* NatError: 0876;  BDEError: DBIERR_???? ),         {You cannot drop a primary key that is referenced.} *)
       (* NatError: 0877;  BDEError: DBIERR_???? ),	    {Before performing an RI operation, you must log in to...} *)
       (* NatError: 0878;  BDEError: DBIERR_???? ),         {A referenced table does not exist.} *)
       (* NatError: 0879;  BDEError: DBIERR_???? ),         {The foreign and primary keys must match exactly.} *)
       (* NatError: 0880;  BDEError: DBIERR_???? ),         {You cannot define a key as both a foreign key and...} *)
       (* NatError: 0881;  BDEError: DBIERR_???? ),         {You must remove all referential constraints before...} *)
       (* NatError: 0882;  BDEError: DBIERR_???? ),         {The delete rule for self-referencing tables must be...}*)
       (* NatError: 0883;  BDEError: DBIERR_???? ),         {The delete rule for at least two of the foreign key...} *)
       (* NatError: 0884;  BDEError: DBIERR_???? ),         {The delete rules for multiple paths to the same parent...} *)
       (* NatError: 0885;  BDEError: DBIERR_???? ), 	    {Scalable SQL allows a maximum of 16 adjacent delete...} *)
       (* NatError: 0886;  BDEError: DBIERR_???? ),         {The Btrieve-compatible file version does not support...} *)
       (* NatError: 0887;  BDEError: DBIERR_???? ),         {A CREATE TABLE statement cannot reference the same...} *)
       (* NatError: 0888;  BDEError: DBIERR_???? ),         {A primary key is already defined on this table.} *)

       (* /***************************************************************************/	*)
       (* /* MICROKERNEL DATABASE ENGINE STATUS CODES FOR WINDOWS AND OS/2           */	*)
       (* /* LOCAL ENVIRONMENTS                                                      */	*)
       (* /*                                                                         */	*)
       (* /* The MicroKernel Database Engine may return the following status         */	*)
       (* /* codes in Windows or OS/2 local environments.                            */	*)
       (* /***************************************************************************/	*)
       (* NatError: 1001;  BDEError: DBIERR_???? ),         {The lock parameter is out of range.} *)
       (* NatError: 1002;  BDEError: DBIERR_???? ),         {A memory allocation error occurred.} *)
       (* NatError: 1003;  BDEError: DBIERR_???? ),         {An invalid memory size parameter was specified.} *)
       (* NatError: 1004;  BDEError: DBIERR_???? ),         {A page size error occurred.} *)
       (* NatError: 1005;  BDEError: DBIERR_???? ),         {The preimage drive parameter is invalid.} *)
       (* NatError: 1006;  BDEError: DBIERR_???? ),         {The preimage buffer parameter is out of range.} *)
       (* NatError: 1007;  BDEError: DBIERR_???? ),         {The files parameter is out of range.}	*)
       (* NatError: 1008;  BDEError: DBIERR_???? ),         {The initialization parameter is invalid.} *)
       (* NatError: 1009;  BDEError: DBIERR_???? ),         {The transaction filename parameter is invalid.} *)
       (* NatError: 1010;  BDEError: DBIERR_???? ),         {An error occurred during the access of the transaction...}*)
       (* NatError: 1011;  BDEError: DBIERR_???? ),         {The compression buffer parameter is out of range.} *)
       (* NatError: 1013;  BDEError: DBIERR_???? ),         {The task list is full.} *)
       (* NatError: 1014;  BDEError: DBIERR_???? ),         {Stop warning. The application still has files or...} *)
       (* NatError: 1015;  BDEError: DBIERR_???? ),         {One of the pointer parameters passed to the MicroKernel...} *)
       (* NatError: 1016;  BDEError: DBIERR_???? ),         {The MicroKernel is already initialized.} *)
       (* NatError: 1017;  BDEError: DBIERR_???? ),         {The Btrieve requester is unable to find the resource...} *)
       (* NatError: 1018;  BDEError: DBIERR_???? ),         {application attempted to call the MicroKernel from a...} *)
       (* NatError: 1019;  BDEError: DBIERR_???? ),         {The MicroKernel cancelled the operation at the request...} *)
       (* NatError: 1020;  BDEError: DBIERR_???? ),         {Btrieve requester interface communications error.} *)

       (* /***************************************************************************/	*)
       (* /* BTRIEVE REQUESTER STATUS CODES                                          */	*)
       (* /*                                                                         */	*)
       (* /* This section lists the status codes that the Btrieve Requesters         */	*)
       (* /* may generate.                                                           */	*)
       (* /***************************************************************************/	*)
       (* NatError: 2001;  BDEError: DBIERR_???? ),         {The memory allocation is insufficient.} *)
       (* NatError: 2002;  BDEError: DBIERR_???? ),         {The option is invalid or out of range.} *)
       (* NatError: 2003;  BDEError: DBIERR_???? ),         {The Requester does not allow local access to the file.} *)
       (* NatError: 2004;  BDEError: DBIERR_???? ),         {SPX is not installed.} *)
       (* NatError: 2005;  BDEError: DBIERR_???? ),         {An incorrect version of SPX is installed.} *)
       (* NatError: 2006;  BDEError: DBIERR_???? ),         {There is no available SPX connection.} *)
       (* NatError: 2007;  BDEError: DBIERR_???? ),         {A pointer parameter is invalid.} *)

       (* /***************************************************************************/	*)
       (* /* SCALABLE SQL REQUESTER STATUS CODES                                     */	*)
       (* /*                                                                         */	*)
       (* /* The Scalable SQL Requester can return the following status codes        */	*)
       (* /* to an application if the Requester encounters an error while the        */	*)
       (* /* application is running at a DOS, Windows, or OS/2 workstation. The      */	*)
       (* /* application that is using Scalable SQL should intercept these errors    */	*)
       (* /* and instruct the user to take the appropriate action.                   */	*)
       (* /***************************************************************************/	*)
       (* NatError: 2101;  BDEError: DBIERR_???? ),         {The data message buffer at the workstation is too small.} *)
       (* NatError: 2102;  BDEError: DBIERR_???? ),         {The redirection buffer is too small.}	*)
       (* NatError: 2103;  BDEError: DBIERR_???? ),         {Scalable SQL is not active on the requested server.} *)
       (* NatError: 2104;  BDEError: DBIERR_???? ),         {The maximum number of logins has been exceeded.} *)
       (* NatError: 2105;  BDEError: DBIERR_???? ),         {The server buffer is too small.} *)
       (* NatError: 2106;  BDEError: DBIERR_???? ),         {The Scalable SQL data message buffer is too small.} *)
       (* NatError: 2107;  BDEError: DBIERR_???? ),         {The application has activated the maximum number of views.} *)
       (* NatError: 2108;  BDEError: DBIERR_???? ),         {The device is not assigned to a server.} *)
       (* NatError: 2111;  BDEError: DBIERR_???? ),         {The session was reset from the server console.} *)
       (* NatError: 2112;  BDEError: DBIERR_???? ),         {The Scalable SQL Requester is not loaded.} *)
       (* NatError: 2113;  BDEError: DBIERR_???? ),  	    {The configuration file is missing or contains an...} *)
       (* NatError: 2114;  BDEError: DBIERR_???? ),         {The specified server and volume for the drive alias is...} *)
       (* NatError: 2116;  BDEError: DBIERR_???? ),         {There is insufficient server memory to process the...} *)
       (* NatError: 2117;  BDEError: DBIERR_???? ),         {The share count is invalid.} *)
       (* NatError: 2118;  BDEError: DBIERR_???? ),         {This session is not shareable.} *)
       (* NatError: 2119;  BDEError: DBIERR_???? ),         {The API is invalid for a sharer.} *)
       (  NatError: 2120;  BDEError: DBIERR_CLIENTSLIMIT ), {The task table is full.}

       (* /***************************************************************************/	*)
       (* /* SCALABLE SQL MISCELLANEOUS CODES                                        */	*)
       (* /*                                                                         */	*)
       (* /* This section describes the status codes that Scalable SQL               */	*)
       (* /* applications can receive in a platform-specific environment, such       */	*)
       (* /* as the server-based environment or the Windows environment.             */	*)
       (* /***************************************************************************/	*)
       (* NatError: 2200;  BDEError: DBIERR_???? ),         {The maximum number of sessions has been exceeded.} *)
       (* NatError: 2201;  BDEError: DBIERR_???? ),         {The Scalable SQL for MS Windows DLL cannot...} *)
       (* NatError: 2202;  BDEError: DBIERR_???? ),         {The task removing a callback did not specify a...} *)
       (* NatError: 2203;  BDEError: DBIERR_???? ),         {At the user's request, Scalable SQL canceled the operation.}*)
       (* NatError: 2204;  BDEError: DBIERR_???? ),         {While in the callback, the task attempted to make a call.} *)
       (* NatError: 2205;  BDEError: DBIERR_???? ),         {Invalid data was passed to Scalable SQL.} *)

       (* /***************************************************************************/	*)
       (* /* DATABASE NAMES FUNCTIONS STATUS CODES                                   */	*)
       (* /*                                                                         */	*)
       (* /* This section lists the status codes you may receive when using          */	*)
       (* /* the database names functions.                                           */	*)
       (* /***************************************************************************/	*)
       (* NatError: 2300;  BDEError: DBIERR_???? ),         {The end of the file was reached; no more database...} *)
       (* NatError: 2307;  BDEError: DBIERR_???? ),         {Scalable SQL cannot open the DBNAMES.CFG file,...}*)

       (* /***************************************************************************/	*)
       (* /* INFORMATIVE STATUS CODES                                                */	*)
       (* /*                                                                         */	*)
       (* /* This section lists the informative status codes that Scalable           */	*)
       (* /* SQL may return. Scalable SQL returns these codes as negative            */	*)
       (* /* values.                                                                 */	*)
       (* /***************************************************************************/	*)
       (  NatError: -101;  BDEError: DBIERR_NONE ),         {The SET statement completed successfully.}
       (  NatError: -102;  BDEError: DBIERR_NONE ),         {The INSERT statement completed successfully.}
       (  NatError: -103;  BDEError: DBIERR_NONE ),         {The UPDATE statement completed successfully.}
       (  NatError: -104;  BDEError: DBIERR_NONE ),         {The DELETE statement completed successfully.}
       (  NatError: -105;  BDEError: DBIERR_NONE ),         {The CREATE statement completed successfully.}
       (  NatError: -106;  BDEError: DBIERR_NONE ),         {The ALTER TABLE statement completed successfully.}
       (  NatError: -107;  BDEError: DBIERR_NONE ),         {The DROP statement completed successfully.}
       (* NatError: -108;  BDEError: DBIERR_???? ),         {The statement contains unresolved substitution...} *)
       (  NatError: -109;  BDEError: DBIERR_EOF ),          {The view contains no more records.}
       (  NatError: -110;  BDEError: DBIERR_NONE ),         {The GRANT statement completed successfully.}
       (  NatError: -111;  BDEError: DBIERR_NONE ),         {The REVOKE statement completed successfully.}
       (  NatError: -112;  BDEError: DBIERR_NONE ),         {The START TRANSACTION statement completed success...}
       (  NatError: -113;  BDEError: DBIERR_NONE ),         {The COMMIT WORK statement completed successfully.}
       (  NatError: -114;  BDEError: DBIERR_NONE ),         {The ROLLBACK WORK statement completed successfully.}
       (  NatError: -115;  BDEError: DBIERR_NONE ),         {Scalable SQL successfully recalled the stored SQL...}
       (  NatError: -116;  BDEError: DBIERR_NONE )          {Scalable SQL successfully executed the stored SQL...}

       (* /***************************************************************************/	*)
       (* /* NEW TITAN ERROR STATUS CODES                                            */	*)
       (* /*                                                                         */	*)
       (* /* This section lists the status codes that have been added in Titan.      */	*)
       (* /***************************************************************************/	*)
       (* NatError: 2999;  BDEError: DBIERR_???? ),         {Field conversion error.} *)
    );


Procedure ThrowBtrieveException( Error : SmallInt );
begin
  If ( Error = ISAM_EOF ) then
    ThrowEOFException
  else
    Raise EBtrieveEngineError.Create( Error )
end;


Procedure ThrowBtrieveExceptionMsg( Error : SmallInt; Const ErrorMsg : ShortString );
begin
  If ( Error = ISAM_EOF ) then
    ThrowEOFException
  else
    Raise EBtrieveEngineError.CreateMsg( Error, ErrorMsg );
end;


Constructor EBtrieveEngineError.Create( BtrieveError : SmallInt );
begin
  Inherited Create( MapNativeToDBI( @ErrorCodeMap, High( ErrorCodeMap ), BtrieveError ) );
  FNativeErrorCode := BtrieveError;
end;


Constructor EBtrieveEngineError.CreateMsg( BtrieveError : SmallInt; Const ErrorMsg : ShortString );
begin
  Create( BtrieveError );
  StrPCopy( FKeyBuffer, ErrorMsg );
  FKeyBuffSize := Length( ErrorMsg );
end;


Function EBtrieveEngineError.GetNativeErrorMsg : ShortString;

  Procedure FormatError;
  Var
    T : ShortString;
  begin
    T := BAPI_ERROR_TEXT;
    Result := Format( T, [ FNativeErrorCode, Result ] ) + '.';
    If ( FKeyBuffSize > 0 ) then
    begin
      Move( FKeyBuffer, T[ 1 ], FKeyBuffSize );
      SetLength( T, FKeyBuffSize );
      Result := Result + #13#10 + 'Key=[' + T + ']';
    end;
  end;

begin
  Result := LoadStr( BTRIEVE_ERROR_OFFSET + FNativeErrorCode );
  if ( Result <> '' ) then
    FormatError
  else
    Result := Format( BAPI_UNKNOWN_ERROR, [ FNativeErrorCode ] );
end;



end.
