home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a006 / 1.ddi / PASENG.ZIP / PXENGINE.DOC < prev    next >
Encoding:
Text File  |  1991-03-11  |  36.5 KB  |  673 lines

  1. (* pxengine.doc                                                              *)
  2. (*    Copyright (c) 1991 by Borland International, Inc.                      *)
  3.  
  4. const
  5.   InternalVersion: Longint = $02000004;        (* version number, same       *)
  6.                                                (* as found in .lib files     *)
  7.  
  8. const MaxFlds = 255;
  9.  
  10. (* Type definitions                                                          *)
  11.  
  12. type
  13.   NameString = string[25];
  14.   NameArray = array[1..MaxFlds] of NameString;
  15.   NamesArrayPtr = ^NameArray;
  16.   TableHandle = Word;
  17.   RecordHandle = Word;
  18.   FieldHandle = Word;
  19.   LockHandle = Integer;
  20.   RecordNumber = Longint;
  21.   TDate = Longint;
  22.   WordArray = array[1..MaxFlds] of Word;
  23.   FieldHandleArray = WordArray;
  24.  
  25. (* Maximum and default values for dynamic configuration.                     *)
  26. (* The default values are used if not overwritten in PXSetDefaults (DOS)     *)
  27.  
  28. const
  29.  
  30.   BLANKDATE: Longint = $80000000;
  31.   BLANKLONG: Longint = $80000000;
  32.   BLANKSHORT = $8000;
  33.   BLANKALPHA = '';
  34.  
  35.   PXDEFAULT: Longint = 0;       (* use internal default value                *)
  36.  
  37.   MaxTableHandles = 64;         (* maximum number of open                    *)
  38.                                 (* tables allowed at a time                  *)
  39.   DefTableHandles = 5;          (* default number of open                    *)
  40.                                 (* tables allowed at a time                  *)
  41.   MaxRecordHandles = 128;       (* maximum number of record                  *)
  42.                                 (* buffers available                         *)
  43.   DefRecordHandles = 10;        (* default number of record                  *)
  44.                                 (* buffers available                         *)
  45.   MaxLockHandles = 128;         (* maximum number of lock                    *)
  46.                                 (* handles per table                         *)
  47.   DefLockHandles = 32;          (* default number of lock                    *)
  48.                                 (* handles per table                         *)
  49.   MaxFileHandles = 255;         (* maximum number of DOS file                *)
  50.                                 (* handles to use                            *)
  51.   MinFileHandles = 2;           (* minimum number of DOS file                *)
  52.                                 (* handles to use                            *)
  53.   DefFileHandles = 10;          (* default number of DOS file                *)
  54.                                 (* handles to use                            *)
  55.  
  56.   DefSortOrder: Pointer = Ptr($FFFF,$FFFF);  (* default sort order (ASCII)   *)
  57.  
  58. (* Swap buffer size                                                          *)
  59.   MaxSwapSize = 256;            (* maximum buffer size allowed (k)           *)
  60.   MinSwapSize = 8;              (* minimum buffer size allowed (k)           *)
  61.   DefSwapSize = 32;             (* default buffer size (k)                   *)
  62.  
  63. (* Network codes                                                             *)
  64. (* used in PXNetInit                                                         *)
  65.  
  66.   NOTONNET = 1;                 (* not on a net                              *)
  67.   NOVELLNET = 2;                (* Novell                                    *)
  68.   THREECOMNET = 3;              (* 3Com                                      *)
  69.   THREEOPENNET = 4;             (* 3Com 3+Open                               *)
  70.   OTHERNET = 5;                 (* other: unknown DOS 3.1 compatible         *)
  71.   STARLANNET = 7;               (* Starlan                                   *)
  72.   BANYANNET = 8;                (* Banyan                                    *)
  73.   IBMPCNET = 9;                 (* IBM PC                                    *)
  74.  
  75.   LOCALSHARE = 32;              (* enables sharing on local drives with      *)
  76.                                 (* any net type                              *)
  77.                                 (* (i.e. OTHERNET + LOCALSHARE)              *)
  78.  
  79.   DefUserName = '';             (* use default username in PXNetInit()       *)
  80.  
  81. (* used in PXKeyAdd                                                          *)
  82.  
  83.   PRIMARY = 0;                  (* primary index (key)                       *)
  84.   SECONDARY = 1;                (* non-maintained secondary index            *)
  85.   INCSECONDARY = 2;             (* maintained secondary index                *)
  86.  
  87. (* used in PXSrchFld, PXSrchKey                                              *)
  88.  
  89.   SEARCHFIRST = 0;              (* search from beginning of table            *)
  90.   SEARCHNEXT = 1;               (* search from next record in table          *)
  91.   CLOSESTRECORD = 2;            (* goto 'nearest' record if no match found   *)
  92.  
  93. (* Lock types                                                                *)
  94. (* used in PXNetFileLock, PXNetFileUnlock, PXNetTblLock, PXNetTblUnlock      *)
  95.  
  96.   FL = 1;                       (* full lock, no concurrency                 *)
  97.   WL = 2;                       (* write lock                                *)
  98.   PWL = 3;                      (* prevent write lock                        *)
  99.   PFL = 4;                      (* prevent full lock, full concurrency       *)
  100.  
  101. (* commonly used constants                                                   *)
  102.  
  103.   Null: Longint = 0;
  104.  
  105. (* successful Engine function operation returns                              *)
  106.  
  107.   PXSUCCESS = 0;
  108.  
  109. (* errorcodes from Engine functions                                          *)
  110.  
  111. (* initialization errors                                                     *)
  112.  
  113.   PXERR_NOTINITERR = 78;        (* Engine not initialized                    *)
  114.   PXERR_ALREADYINIT = 82;       (* Engine already initialized                *)
  115.   PXERR_NOTLOGGEDIN = 98;       (* Could not login on network                *)
  116.                                 (* (to PARADOX.NET)                          *)
  117.   PXERR_NONETINIT = 107;        (* Engine not initialized                    *)
  118.                                 (* with PXNetInit                            *)
  119.   PXERR_NETMULTIPLE = 15;       (* multiple PARADOX.NET files                *)
  120.  
  121. (* hardware related errors                                                   *)
  122.  
  123.   PXERR_DRIVENOTREADY = 1;      (* Drive not ready                           *)
  124.   PXERR_DISKWRITEPRO = 124;     (* Disk is write protected                   *)
  125.   PXERR_GENERALFAILURE = 126;   (* General hardware error                    *)
  126.  
  127. (* directory reg error codes                                                 *)
  128.  
  129.   PXERR_DIRNOTFOUND = 2;        (* Directory not found                       *)
  130.   PXERR_DIRBUSY = 10;           (* Sharing violation                         *)
  131.   PXERR_DIRLOCKED = 11;         (* Sharing violation                         *)
  132.   PXERR_DIRNOACCESS = 12;       (* No access to directory                    *)
  133.   PXERR_DIRNOTPRIVATE = 14;     (* Single user, but directory is shared      *)
  134.  
  135. (* file oriented errors                                                      *)
  136.  
  137.   PXERR_FILEBUSY = 3;           (* File is busy                              *)
  138.   PXERR_FILELOCKED = 4;         (* File is locked                            *)
  139.   PXERR_FILENOTFOUND = 5;       (* Could not find file                       *)
  140.  
  141. (* table oriented errors                                                     *)
  142.  
  143.   PXERR_TABLEBUSY = 118;        (* Table is busy                             *)
  144.   PXERR_TABLELOCKED = 119;      (* Table is locked                           *)
  145.   PXERR_TABLENOTFOUND = 120;    (* Table was not found                       *)
  146.   PXERR_TABLEOPEN = 83;         (* Unable to perform operation               *)
  147.                                 (* on open table                             *)
  148.   PXERR_TABLEINDEXED = 94;      (* Table is indexed                          *)
  149.   PXERR_TABLENOTINDEXED = 95;   (* Table is not indexed                      *)
  150.   PXERR_TABLEEMPTY = 105;       (* Operation on empty table                  *)
  151.   PXERR_TABLEWRITEPRO = 22;     (* Table is write protected                  *)
  152.  
  153.   PXERR_TABLECORRUPTED = 6;     (* Table is corrupted                        *)
  154.   PXERR_TABLEFULL = 128;        (* Table is full                             *)
  155.   PXERR_TABLESQL = 130;         (* Table is SQL replica                      *)
  156.   PXERR_INSUFRIGHTS = 21;       (* Insufficient password rights              *)
  157.  
  158. (* index oriented errors                                                     *)
  159.  
  160.   PXERR_XCORRUPTED = 7;         (* Primary index is corrupted                *)
  161.   PXERR_XOUTOFDATE = 8;         (* Primary index is out of date              *)
  162.   PXERR_XSORTVERSION = 13;      (* Sort for index different                  *)
  163.                                 (* from table                                *)
  164.  
  165.   PXERR_SXCORRUPTED = 122;      (* Secondary index is corrupted              *)
  166.   PXERR_SXOUTOFDATE = 96;       (* Secondary index is out of date            *)
  167.   PXERR_SXNOTFOUND = 121;       (* Secondary index was not found             *)
  168.   PXERR_SXOPEN = 123;           (* Secondary index is already open           *)
  169.   PXERR_SXCANTUPDATE = 136;     (* Can't update Heap open on Secondary index *)
  170.  
  171.   PXERR_RECTOOBIG = 125;        (* Record too big for index                  *)
  172.  
  173. (* record oriented errors                                                    *)
  174.  
  175.   PXERR_RECDELETED = 50;        (* Another user deleted record               *)
  176.   PXERR_RECLOCKED = 9;          (* Record is locked                          *)
  177.   PXERR_RECNOTFOUND = 89;       (* Record was not found                      *)
  178.   PXERR_KEYVIOL = 97;           (* Key violation                             *)
  179.  
  180.   PXERR_ENDOFTABLE = 101;       (* End of table                              *)
  181.   PXERR_STARTOFTABLE = 102;     (* Start of table                            *)
  182.  
  183. (* resource errors                                                           *)
  184.  
  185.   PXERR_OUTOFMEM = 40;          (* Not enough memory to                      *)
  186.                                 (* complete operation                        *)
  187.   PXERR_OUTOFDISK = 41;         (* Not enough disk space to                  *)
  188.                                 (* complete operation                        *)
  189.   PXERR_OUTOFSTACK = 127;       (* Not enough stack space to                 *)
  190.                                 (* complete operation                        *)
  191.   PXERR_OUTOFSWAPBUF = 129;     (* Not enough swap buffer space to           *)
  192.                                 (* complete operation                        *)
  193.  
  194.   PXERR_OUTOFFILEHANDLES = 70;  (* No more file handles available            *)
  195.   PXERR_OUTOFTABLEHANDLES = 72; (* No more table handles available           *)
  196.   PXERR_OUTOFRECHANDLES = 103;  (* No more record handles available          *)
  197.   PXERR_OUTOFLOCKHANDLES = 111; (* Too many locks on table                   *)
  198.  
  199.   PXERR_NOMORETMPNAMES = 86;    (* No more temporary names                   *)
  200.                                 (* available                                 *)
  201.   PXERR_TOOMANYPASSW = 115;     (* Too many passwords specified              *)
  202.  
  203. (* invalid parameters to functions                                           *)
  204.  
  205.   PXERR_TYPEMISMATCH = 30;      (* Data type mismatch                        *)
  206.   PXERR_OUTOFRANGE = 31;        (* Argument out of range                     *)
  207.   PXERR_INVPARAMETER = 33;      (* Invalid argument                          *)
  208.   PXERR_INVDATE = 73;           (* Invalid date given                        *)
  209.  
  210.   PXERR_INVFIELDHANDLE = 75;    (* Invalid field handle                      *)
  211.   PXERR_INVRECHANDLE = 104;     (* Invalid record handle                     *)
  212.   PXERR_INVTABLEHANDLE = 76;    (* Invalid table handle                      *)
  213.   PXERR_INVLOCKHANDLE = 110;    (* Invalid lock handle                       *)
  214.  
  215.   PXERR_INVDIRNAME = 114;       (* Invalid directory name                    *)
  216.   PXERR_INVFILENAME = 108;      (* Invalid file name                         *)
  217.   PXERR_INVTABLENAME = 99;      (* Invalid table name                        *)
  218.   PXERR_INVFIELDNAME = 74;      (* Invalid field name                        *)
  219.  
  220.   PXERR_INVLOCKCODE = 106;      (* Invalid lock code                         *)
  221.   PXERR_INVUNLOCK = 109;        (* Invalid unlock                            *)
  222.   PXERR_INVSORTORDER = 112;     (* Invalid sort order table                  *)
  223.   PXERR_INVPASSW = 116;         (* Invalid password                          *)
  224.   PXERR_INVNETTYPE = 113;       (* Invalid net type (PXNetInit)              *)
  225.   PXERR_STRUCTDIFFER = 81;      (* Table structures are different            *)
  226.  
  227.   PXERR_INVENGINESTATE = 79;    (* Previous fatal error;                     *)
  228.                                 (* cannot proceed                            *)
  229.  
  230. (*----------------------------------------------------------------------     *)
  231. (* prototypes for engine functions                                           *)
  232.  
  233. (* declarations of sort order tables, used in PXSetDefaults                  *)
  234. function SortOrderAscii: Pointer;     (* ASCII sort order                    *)
  235. function SortOrderIntl: Pointer;      (* international sort order            *)
  236. function SortOrderNorDan: Pointer;    (* Norwegian/Danish sort order         *)
  237. function SortOrderSwedFin: Pointer;   (* Swedish/Finnish sort order          *)
  238.  
  239. (* INITIALIZATION AND FINALIZATION FUNCTIONS                                 *)
  240.  
  241. (* Initializes the Paradox environment for function operations               *)
  242. function PXInit: Integer;
  243.  
  244. (* Initializes the Paradox environment for network operations                *)
  245. function PXNetInit
  246.   (NetNamePath: String;               (* directory containing .NET file      *)
  247.    NetType: Integer;                  (* type of network                     *)
  248.    UserName: String): Integer;        (* user name, as put in .NET file      *)
  249.  
  250. (* closes the Paradox environment                                            *)
  251. function PXExit: Integer;
  252.  
  253. (* Sets internal default values                                              *)
  254. function PXSetDefaults
  255.   (BufSize: Integer;                  (* internal swap buffer size           *)
  256.                                       (* MinSwapSize..MaxSwapSize (8..256),  *)
  257.                                       (* default DefSwapSize (32)            *)
  258.                                       (* allocated at initialization time    *)
  259.    MaxTables: Integer;                (* max number of tables open at a time *)
  260.                                       (* range 1..MaxTableHandles, (1..64)   *)
  261.                                       (* default  DefTableHandles     (5)    *)
  262.    MaxRecBufs: Integer;               (* max number of record buffers at one *)
  263.                                       (* range 1..MaxRecordHandles, (1..128) *)
  264.                                       (* default  DefRecordHandles    (10)   *)
  265.    MaxLocks: Integer;                 (* max number of locks per table       *)
  266.                                       (* range 1..MaxLockHandles,  (1..128)  *)
  267.                                       (* default DefLockHandles       (32)   *)
  268.    MaxFiles: Integer;                 (* max number of file handles to use   *)
  269.                                       (* range MinFileHandles..MaxFileHandles*)
  270.                                       (* default DefFileHandles       (10)   *)
  271.    SortOrder: Pointer):Integer;       (* address of sort order table defined *)
  272.                                       (* internally in the Engine:           *)
  273.                                       (* SortOrderAscii/SortOrderIntl/       *)
  274.                                       (* SortOrderNorDan/SortOrderSwedFin    *)
  275.                                       (* default: SortOrderAscii             *)
  276.  
  277. (* Returns internal default values                                           *)
  278. function PXGetDefaults
  279.   (var SwapSize: Integer;             (* returns internal swap buffer size   *)
  280.    var MaxTables: Integer;            (* returns max tables at once          *)
  281.    var MaxRecBufs: Integer;           (* returns max record buffers          *)
  282.    var MaxLocks: Integer;             (* returns max locks per table         *)
  283.    var MaxFiles: Integer;             (* returns max file handles to use     *)
  284.    var SortOrder: Pointer):Integer;   (* returns pointer to default sort table *)
  285.  
  286. (* Saves/restores user critical error handler                                *)
  287. function PXSetHWHandler
  288.   (HwHandler: Boolean): Integer;      (* enable(TRUE) / disable (FALSE)      *)
  289.  
  290. (* UTILITY FUNCTIONS                                                         *)
  291.  
  292. function IsBlankAlpha(s: String): Boolean;
  293. function IsBlankDate(i: TDate): Boolean;
  294. function IsBlankShort(i: Integer): Boolean;
  295. function IsBlankDouble(i: Double): Boolean;
  296. procedure BlankDouble(var i: Double);
  297.  
  298. (* TABLE FUNCTIONS                                                           *)
  299.  
  300. (* Opens a table                                                             *)
  301. function PXTblOpen
  302.   (TblName: String;                   (* name of table to open               *)
  303.    var TblHandle: TableHandle;        (* returns handle for opened table     *)
  304.    IndexID: Integer;                  (* =0 mastertable else indexnumber     *)
  305.    SaveEveryChange: Boolean):Integer; (* save each record as it is changed?  *)
  306.  
  307. (* Closes a table                                                            *)
  308. function PXTblClose(TblHandle:TableHandle):Integer;
  309.  
  310. (* Creates an empty table                                                    *)
  311. function PXTblCreate
  312.   (TblName: String;                   (* name of table to create             *)
  313.    NFields: Integer;                  (* number of fields in table           *)
  314.    Fields,                            (* field names                         *)
  315.    Types: NamesArrayPtr): Integer;    (* field types (N, S..)                *)
  316.  
  317.  
  318. (* Removes all records from a table                                          *)
  319. function PXTblEmpty(TblName: String): Integer;
  320.  
  321. (* Delete a table and its family                                             *)
  322. function PXTblDelete(TblName: String): Integer;
  323.  
  324. (* Copies one table family to another                                        *)
  325. function PXTblCopy
  326.   ( FromName: String;           (* source table of copy                      *)
  327.     ToName: String): Integer;   (* destination table of copy                 *)
  328.  
  329. (* Changes the base name of a table family                                   *)
  330. function PXTblRename
  331.   (FromName: String;                  (* source table of copy                *)
  332.    ToName: String): Integer;          (* destination table of copy           *)
  333.  
  334. (* Adds records from one table to another table                              *)
  335. function PXTblAdd
  336.   (SrcName: String;                   (* source table of add                 *)
  337.    DestName: String): Integer;        (* destination table of add            *)
  338.  
  339. (* RECORD FUNCTIONS                                                          *)
  340.  
  341. (* Appends a record to a table                                               *)
  342. function PXRecAppend
  343.   (TblHandle: TableHandle;            (* table to append record to           *)
  344.    RecHandle: RecordHandle):Integer;  (* record to append                    *)
  345.  
  346. (* Inserts a record into a table                                             *)
  347. function PXRecInsert
  348.   (TblHandle: TableHandle;            (* table to insert record into         *)
  349.    RecHandle: RecordHandle):Integer;  (* record to insert                    *)
  350.  
  351. (* Updates the current record in a table                                     *)
  352. function PXRecUpdate
  353.   (TblHandle: TableHandle;            (* table to update record into         *)
  354.    RecHandle: RecordHandle):Integer;  (* changed record to post              *)
  355.  
  356. (* Deletes the current record from a table                                   *)
  357. function PXRecDelete(TblHandle: TableHandle): Integer;
  358.  
  359. (* Creates a record buffer                                                   *)
  360. function PXRecBufOpen
  361.   (TblHandle: TableHandle;                (* table to create buffer for      *)
  362.    var RecHandle: RecordHandle): Integer; (* returns handle to record buffer *)
  363.  
  364. (* Removes a record transfer buffer                                          *)
  365. function PXRecBufClose(RecHandle: RecordHandle): Integer;
  366.  
  367. (* Clears a record transfer buffer                                           *)
  368. function PXRecBufEmpty(RecHandle: RecordHandle): Integer;
  369.  
  370. (* Copies source record buffer to destination record buffer                  *)
  371. function PXRecBufCopy
  372.   (FromHandle: RecordHandle;          (* record buffer to copy from          *)
  373.    ToHandle: RecordHandle): Integer;  (* record buffer to copy to            *)
  374.  
  375. (* Transfers the current record to the record transfer buffer                *)
  376. function PXRecGet
  377.   (TblHandle: TableHandle;               (* table to get record from         *)
  378.    RecHandle: RecordHandle): Integer;    (* record buffer to put record in   *)
  379.  
  380. (* FIELD FUNCTIONS                                                           *)
  381.  
  382. (* Assigns an integer value to a short field                                 *)
  383. function PXPutShort
  384.   (RecHandle: RecordHandle;           (* record buffer to put value in       *)
  385.    FldHandle: FieldHandle;            (* field in record                     *)
  386.    Value: Integer): Integer;          (* value to put                        *)
  387.  
  388. (* Assigns a Double value to a field                                         *)
  389. function PXPutDoub
  390.   (RecHandle: RecordHandle;           (* record buffer to put value in       *)
  391.    FldHandle: FieldHandle;            (* field in record                     *)
  392.    Value: Double): Integer;           (* value to put                        *)
  393.  
  394. (* Assigns a long integer value to a field                                   *)
  395. function PXPutLong
  396.   (RecHandle: RecordHandle;           (* record buffer to put value in       *)
  397.    FldHandle: FieldHandle;            (* field in record                     *)
  398.    Value: Longint): Integer;          (* value to put                        *)
  399.  
  400. (* Assigns a string value to a field                                         *)
  401. function PXPutAlpha
  402.   (RecHandle: RecordHandle;           (* record buffer to put value in       *)
  403.    FldHandle: FieldHandle;            (* field in record                     *)
  404.    Value: String): Integer;           (* value to put                        *)
  405.                                 
  406. (* Assigns a date value to a field                                           *)
  407. function PXPutDate
  408.   (RecHandle: RecordHandle;           (* record buffer to put value in       *)
  409.    FldHandle: FieldHandle;            (* field in record                     *)
  410.    value: TDate): Integer;            (* value to put                        *)
  411.  
  412. (* Assigns a blank value to a field                                          *)
  413. function PXPutBlank
  414.   (RecHandle: RecordHandle;           (* record buffer to put blank in       *)
  415.    FldHandle: FieldHandle): Integer;  (* field in record                     *)
  416.  
  417. (* Retrieves a short integer from a field                                    *)
  418. function PXGetShort
  419.   (RecHandle: RecordHandle;        (* record buffer to get value from        *)
  420.    FldHandle: FieldHandle;         (* field to get value from                *)
  421.    var SValue: Integer): Integer;  (* returns value                          *)
  422.  
  423. (* Retrieves a Double value from a field                                     *)
  424. function PXGetDoub
  425.   (RecHandle: RecordHandle;        (* record buffer to get value from        *)
  426.    FldHandle: FieldHandle;         (* field to get value from                *)
  427.    var DValue: Double): Integer;   (* returns value                          *)
  428.  
  429. (* Retrieves a long integer value from a field                               *)
  430. function PXGetLong
  431.   (RecHandle: RecordHandle;        (* record buffer to get value from        *)
  432.    FldHandle: FieldHandle;         (* field to get value from                *)
  433.    var LValue: Longint): Integer;  (* returns value                          *)
  434.  
  435. (* Retrieves a string from an alphanumeric field                             *)
  436. function PXGetAlpha
  437.   (RecHandle: RecordHandle;     (* record buffer to get value from           *)
  438.    FldHandle: FieldHandle;      (* field to get value from                   *)
  439.    var Dest: String): Integer;  (* return buffer                             *)
  440.  
  441. (* Retrieves a date value from a date field                                  *)
  442. function PXGetDate
  443.   (RecHandle: RecordHandle;           (* record buffer to get value from     *)
  444.    FldHandle: FieldHandle;            (* field to get value from             *)
  445.    var Value: TDate): Integer;        (* returns value                       *)
  446.  
  447. (* tests if a field is blank                                                 *)
  448. function PXFldBlank
  449.   (RecHandle: RecordHandle;           (* record to test value in             *)
  450.    FldHandle: FieldHandle;            (* field to test                       *)
  451.    var Blank: Boolean): Integer;      (* returns TRUE/FALSE                  *)
  452.  
  453. (* Moves to a specified record                                               *)
  454. function PXRecGoto
  455.   (TblHandle: TableHandle;            (* tblHandle of table to move in       *)
  456.    RecNum: RecordNumber): Integer;    (* record number to move to            *)
  457.  
  458. (* Moves to the first record of a table                                      *)
  459. function PXRecFirst
  460.   (TblHandle: TableHandle): Integer;  (* table to move in                    *)
  461.  
  462. (* Moves to last record of a table                                           *)
  463. function PXRecLast
  464.   (TblHandle: TableHandle): Integer;  (* table to move in                    *)
  465.  
  466. (* Moves to the next record of a table                                       *)
  467. function PXRecNext
  468.   (TblHandle: TableHandle): Integer;  (* table to move in                    *)
  469.  
  470. (* Moves to the previous record in a table                                   *)
  471. function PXRecPrev
  472.   (TblHandle: TableHandle): Integer;  (* table to move in                    *)
  473.  
  474. (* INDEX FUNCTIONS                                                           *)
  475.  
  476. (* Creates a primary or secondary index on a table                           *)
  477. function PXKeyAdd
  478.   (TblName: String;                   (* name of table to add index for      *)
  479.    NFlds: Integer;                    (* number of fields in index           *)
  480.    var FldHandles: FieldHandleArray;  (* array of field numbers in index     *)
  481.    Mode: Integer): Integer;           (* type of index to create             *)
  482.                                       (* PRIMARY/SECONDARY/INCSECONDARY      *)
  483.  
  484. (* Deletes primary or secondary index                                        *)
  485. function PXKeyDrop
  486.   (TblName: String;                   (* name of table to delete index for   *)
  487.    IndexID: Integer): Integer;        (* 0 if primary key, else field number *)
  488.                                       (* of secondary index                  *)
  489.  
  490. (* DATE FUNCTIONS                                                            *)
  491.  
  492. (* Convers internal date to calendar date                                    *)
  493. function PXDateDecode
  494.   (Date: TDate;                (* long value to decode                       *)
  495.    var Mo: Integer;            (* decoded month value                        *)
  496.    var Da: Integer;            (* decoded date value                         *)
  497.    var Yr: Integer): Integer;  (* decoded year value                         *)
  498.  
  499. (* Converts calendar date to internal format                                 *)
  500. function PXDateEncode
  501.   (Mo: Integer;                (* month value to encode                      *)
  502.    Da: Integer;                (* date value to encode                       *)
  503.    Yr: Integer;                (* year value to encode                       *)
  504.    var Date: TDate): Integer;  (* encoded date value                         *)
  505.  
  506. (* SEARCH FUNCTIONS                                                          *)
  507.  
  508. (* Searches a table for a (sub) key match                                    *)
  509. function PXSrchKey
  510.   (TblHandle: TableHandle;            (* table to search in                  *)
  511.    RecHandle: RecordHandle;           (* record buffer with key to find      *)
  512.    NFlds: Integer;                    (* number of fields in key             *)
  513.    Mode: Integer): Integer;           (* searching from first/next record    *)
  514.  
  515. (* Searches a table on a specified field                                     *)
  516. function PXSrchFld
  517.   (TblHandle: TableHandle;            (* table to search in                  *)
  518.    RecHandle: RecordHandle;           (* record buffer with field to find    *)
  519.    FldHandle: FieldHandle;            (* field number to search on           *)
  520.    Mode: Integer): Integer;           (* searching from first/next record    *)
  521.  
  522. (* PASSWORD FUNCTIONS                                                        *)
  523.  
  524. (* Tests if the table is encrypted                                           *)
  525. function PXTblProtected
  526.   (TblName: String;                   (* name of table to check              *)
  527.    var Protected: Boolean): Integer;  (* returns TRUE/FALSE                  *)
  528.  
  529. (* enters a password                                                         *)
  530. function PXPswAdd
  531.   (Password: String): Integer;        (* password to enter into system       *)
  532.  
  533. (* Removes a password                                                        *)
  534. function PXPswDel
  535.   (Password: String): Integer;        (* password to remove from system      *)
  536.  
  537. (* Encrypts a table                                                          *)
  538. function PXTblEncrypt
  539.   (TblName: String;                   (* name of table to encrypt            *)
  540.    Password: String): Integer;        (* password for encrypted table        *)
  541.  
  542. (* Decrypts a table                                                          *)
  543. function PXTblDecrypt
  544.   (TblName: String): Integer;         (* name of table to decrypt            *)
  545.  
  546. (* INFORMATIONAL FUNCTIONS                                                   *)
  547.  
  548. (* Tests if a named table exists                                             *)
  549. function PXTblExist
  550.   (TblName: String;                   (* name of table to check              *)
  551.    var Exist: Boolean): Integer;      (* returns TRUE/FALSE                  *)
  552.  
  553. (* Finds table name corresponding to a table handle                          *)
  554. function PXTblName
  555.   (TblHandle: TableHandle;            (* table to return name of             *)
  556.    var TblName: String): Integer;     (* name of table, without extension    *)
  557.  
  558. (* Finds the current record number of a table                                *)
  559. function PXRecNum
  560.   (TblHandle: TableHandle;            (* table to get record number from     *)
  561.    var Recnum: RecordNumber): Integer;(* returns record number               *)
  562.  
  563. (* Finds the number of records in a table                                    *)
  564. function PXTblNRecs
  565.   (TblHandle: TableHandle;            (* table to get number of records from *)
  566.    var NRecs: RecordNumber): Integer; (* returns number of records           *)
  567.  
  568. (* Finds the number of fields in a table                                     *)
  569. function PXRecNFlds
  570.   (TblHandle: TableHandle;            (* table to get number of fields from  *)
  571.    var NFlds: Integer): Integer;      (* returns number of fields in record  *)
  572.  
  573. (* Finds the number of key fields in a table                                 *)
  574. function PXKeyNFlds
  575.   (TblHandle: TableHandle;            (* table to get key size for           *)
  576.    var NKeyFlds: Integer): Integer;   (* returns number of fields in key     *)
  577.  
  578. (* Gets the field handle for a given field name                              *)
  579. function PXFldHandle
  580.   (TblHandle: TableHandle;            (* table to get field number from      *)
  581.    FieldName: String;                 (* name of field in table              *)
  582.    var FldHandle: FieldHandle): Integer; (* returns field number             *)
  583.  
  584. (* Gets the field type for a given field handle                              *)
  585. function PXFldType
  586.   (TblHandle: TableHandle;            (* table to get field type from        *)
  587.    FldHandle: FieldHandle;            (* field number of field in table      *)
  588.    var FldType: NameString): Integer; (* field type of field as string       *)
  589.  
  590. (* Gets the name of a field for a given field handle                         *)
  591. function PXFldName
  592.   (TblHandle: TableHandle;            (* table to get field name from        *)
  593.    FldHandle: FieldHandle;            (* field number of field in table      *)
  594.    var FldName: NameString): Integer; (* returns name of field               *)
  595.  
  596. (* MISCELLANEOUS FUNCTIONS                                                   *)
  597. (* Sets maximum size for any table                                           *)
  598. function PXTblMaxSize
  599.   (Maxsize: Integer): Integer;         (* max size of table 64/128/256 Mbytes*)
  600.  
  601. (* Flushes all buffers and writes them to disk                               *)
  602. function PXSave: Integer;
  603.  
  604. (* CONCURRENCY FUNCTIONS                                                     *)
  605. (* can be used only if PXNetInit() was successful                            *)
  606.  
  607. (* Obtains net name of user                                                  *)
  608. function PXNetUserName
  609.   (var UserName: String): Integer;    (* returns user name                   *)
  610.  
  611. (* Locks a file                                                              *)
  612. function PXNetFileLock
  613.   (FileName: String;                  (* name of file to lock                *)
  614.    LockType: Integer): Integer;       (* type of lock (FL, WL, PFL, PWL)     *)
  615.  
  616. (* Unlocks a file                                                            *)
  617. function PXNetFileUnlock
  618.   (FileName: String;                  (* name of file to unlock              *)
  619.    LockType: Integer): Integer;       (* type of lock (FL, WL, PFL, PWL)     *)
  620.  
  621. (* locks a table                                                             *)
  622. function PXNetTblLock
  623.   (TblHandle: TableHandle;            (* table to lock                       *)
  624.    LockType: Integer): Integer;       (* type of lock (FL, WL, PFL, PWL)     *)
  625.  
  626. (* unlocks a table                                                           *)
  627. function PXNetTblUnlock
  628.   (TblHandle: TableHandle;            (* table to unlock                     *)
  629.    LockType: Integer): Integer;       (* type of lock (FL, WL, PFL, PWL)     *)
  630.  
  631. (* Locks the current record                                                  *)
  632. function PXNetRecLock
  633.   (TblHandle: TableHandle;               (* table to lock record in          *)
  634.    var LckHandle: LockHandle): Integer;  (* returns handle to lock           *)
  635.  
  636. (* Unlocks a record                                                          *)
  637. function PXNetRecUnlock
  638.   (TblHandle: TableHandle;            (* table to unlock record in           *)
  639.    LckHandle: LockHandle): Integer;   (* lock handle of record to unlock     *)
  640.  
  641. (* Determines whether a record has been locked                               *)
  642. function PXNetRecLocked
  643.   (TblHandle: TableHandle;            (* table to check current record in    *)
  644.    var Locked: Boolean): Integer;     (* returns TRUE/FALSE                  *)
  645.  
  646. (* Returns to a previously locked record                                     *)
  647. function PXNetRecGotoLock
  648.   (TblHandle: TableHandle;            (* table to move in                    *)
  649.    LckHandle: LockHandle): Integer;   (* lock handle to record               *)
  650.  
  651. (* Tests if any of a table's internal buffers are out of synch due to        *)
  652. (* concurrent use by another user on the network                             *)
  653. function PXNetTblChanged
  654.   (TblHandle: TableHandle;            (* table to test                       *)
  655.    var Changed: Boolean): Integer;    (* returns TRUE/FALSE                  *)
  656.  
  657. (* Resynchronizes a table                                                    *)
  658. function PXNetTblRefresh
  659.   (TblHandle: TableHandle): Integer;  (* tabel to refresh                    *)
  660.  
  661. (* reports error message                                                     *)
  662. function PXErrMsg(ErrCode:Integer): String;
  663.  
  664. (* Reports name of user causing locking error                                *)
  665. function PXNetErrUser
  666.   (var UserName: String): Integer;   (* returns user name                    *)
  667.  
  668. (* Specifies the name and path of the Engine overlay file                    *)
  669. (* -- if used, this must be the very first Engine function you call          *)
  670. function PXLoadOverlay
  671.   (OverlayName: String): Integer; (* full name e.g. 'c:\engine\pxengine.ovl' *)
  672.                                                         
  673.