home *** CD-ROM | disk | FTP | other *** search
/ TestDrive Super Store 2.3 / TESTDRIVE_2.ISO / realizer / lib / db / pxengine.rlz < prev   
Encoding:
Text File  |  1992-09-30  |  23.2 KB  |  515 lines

  1. '********************************************************************************************************************************************************
  2. '                           PxEngine.RLZ   Version:  1.1
  3. '
  4. '    Paradox(TM)  Engine Interface for Realizer Version 1.0
  5. '    Paradox is a trademark of Borland International.
  6. '
  7. '    Copyright ⌐ 1991-1992 Computer Associates International, Inc.
  8. '   All rights reserved.
  9. '
  10. '    Realizer Version 1.0 high-level Paradox Engine 2.0 interface.
  11. '
  12. '    The entire low-level Paradox Engine 2.0 interface is included in PxEngine along with error numbers, constants, and routines
  13. '    for testing field contents.  Complete documentation on the Paradox engine is available with the purchase of the engine
  14. '    from Borland International.  Included, in PXEngin2.RLZ, is the complete high-level interface to the Paradox Engine 2.0.
  15. '
  16. '    NOTE:
  17. '        When using the PXTblCreate routine the PDoxDLL.EXE Dynamic Link Library (DLL) must be copied to the
  18. '        Windows directory (same directory as the PXEngWin.DLL).  This DLL is designed to support the double
  19. '        pointer reference for the fieldList and typeList parameters.  PXTblCreate has the following interface from
  20. '        Realizer:
  21. '                fieldList = {"Name", "Address", "Zip", "Age", "Salary"}
  22. '                typeList = {"A20", "A30", "A5", "S", "$"}
  23. '                error = PXTblCreate("Sample", 5, fieldList, typeList)
  24. '
  25. '    High-level overview:
  26. '        PXEngine supports the low-level interface to the Paradox Engine 2.0
  27. '        from Borland International.  PXEngine also includes a high-level
  28. '        interface to the engine.  The purpose of the high-level interface
  29. '        is to eliminate, for the average Paradox programmer, the handling of table handles, record buffers,
  30. '        field buffers and knowledge of each field type to get or put data to a field.  The high-level PXEngine interface
  31. '        assumes upto 5 tables (files) can be openned at a time and routines such as Search and GotoRecord to change the
  32. '        current record pointer in a table.  Access to data is performed on a record-by-record basis therefore to look at data
  33. '        a GetRecord must first be called to move the entire record to a Working-Record-Buffer (WRB).  To read or write data
  34. '        for a field use GetField or PutField depending upon the operation required.  To update the current record with the
  35. '        data in the current (WRB) use UpdateRecord, use AddRecord to add the current WRB as a new record.  To delete
  36. '        the current WRB from the table use DeleteRecord.  Use SelectTable to change the current table to another openned
  37. '        table or CurrentTable to return the current table ID
  38. '
  39. '    High-level routines:
  40. '        PROC SelectTable (tableID) - Change the current table to the table with the tableID reference, all subsequent
  41. '                             Paradox calls are directed to this table.
  42. '        FUNC CurrentTable - Return the tableID of the current table.
  43. '        FUNC ParadoxInit - Initialize Paradox Engine for Windows.
  44. '        FUNC ParadoxExit - Unload the Paradox Engine DLL for this application.
  45. '        FUNC OpenTable (tbl) - Open an existing Paradox database file (table).
  46. '        FUNC CloseTable - Close the openned database file (table).
  47. '        FUNC GetRecNumber - Return the current record number.
  48. '        FUNC GotoRecord (recNumber) - Make the recNumber the current record.
  49. '        FUNC Search(whichField, what, searchHow) - Find a record that matches whichField with the what buffer.
  50. '        FUNC GetRecord - Get the current record into the record buffer, use GetField to see the data.
  51. '        FUNC NewRecord - Make the current record buffer an empty record buffer.
  52. '        FUNC GetField (whichField, buff) - Get a field for the current record buffer.
  53. '        FUNC PutField (whichField, buff) - Change a field's data for the current record buffer.
  54. '        FUNC BlankField (whichField) - Blank the field in the current record buffer.
  55. '        FUNC IsBlankField (whichField) - Is the field in the current record buffer blank.
  56. '        FUNC InsertRecord - Insert a record into the database file (table).
  57. '         FUNC UpdateRecord - Update the current record.
  58. '        FUNC DeleteRecord - Delete the current record
  59. '        FUNC GotoRecord - Goto a particular record number.
  60. '
  61. '    High-level usage:
  62. '        First initialize the engine with the ParadoxInit call and then open an existing table with OpenTable. OpenTable
  63. '        sets %%currentTable to the id of table just openned. There are a couple of different ways to access data.
  64. '        To search for an existing record use the Search routine followed by GetRecord to load the current record
  65. '        (record found) into the record buffer use multiple GetField calls to retrieve each field for the record.
  66. '*******************************************************************************************************************************************************
  67. IF QVar(%%PXEngine, _Defined) THEN
  68.     EXIT MACRO
  69. END IF
  70. %%PXEngine = 1
  71.  
  72. PDX_Version        = 17369347                    ' 0x01090903 Version # same as found in .lib files.
  73.  
  74. ' Maximum and default values for dynamic configuration. The default values are used if not overwritten in WIN.INI.
  75. PDX_PXDefault            = 0                ' Use internal default value.
  76. PDX_MAXTABLEHANDLES    = 64                ' Max # open tables allowed at a time.
  77. PDX_DEFTABLEHANDLES    = 5                ' Default # open  tables allowed at a time.
  78. PDX_MAXRECORDHANDLES    = 128                ' Max # of record  buffers available.
  79. PDX_DEFRECORDHANDLES    = 10                ' Default number of record  buffers available.
  80. PDX_MAXLOCKHANDLES    = 128                ' Max #r of lock handles per table.
  81. PDX_DEFLOCKHANDLES    = 32                 ' Default number of lock handles per table.
  82. PDX_MAXFILEHANDLES        = 255                 ' Max # of DOS file handles to use.
  83. PDX_MINFILEHANDLES        = 2                 ' Min # of DOS file handles to use.
  84. PDX_DEFFILEHANDLES        = 10                ' Default number of DOS file handles to use.
  85.  
  86. ' Swap buffer size
  87. PDX_MAXSWAPSIZE        = 256                ' Max buffer size allowed (k)
  88. PDX_MINSWAPSIZE        = 8                ' Min buffer size allowed (k)
  89. PDX_DEFSWAPSIZE        = 32                ' Default buffer size (k)
  90.  
  91.  
  92. PDX_DEFSORTORDER        = -1                ' Default sort order (ASCII)
  93.  
  94. ' Values for ShareMode argument to PXWinInit.
  95. PDX_PXSINGLECLIENT        = 0                ' Allow no other client access to Engine DLL.
  96. PDX_PXEXCLUSIVE        = 1                ' Open all tables with FULL LOCK.
  97. PDX_PXSHARED            = 2                ' Open all tables with PREVENT FULL LOCK.
  98.  
  99. ' Used in PXKeyAdd.
  100. PDX_PRIMARY            = 0                ' Primary index (key).
  101. PDX_SECONDARY            = 1                ' Not maintained secondary index.
  102. PDX_INCSECONDARY        = 2                ' Mmaintained secondary index.
  103.  
  104. ' Used in PXSrchFld, PXSrchKey.
  105. PDX_SEARCHFIRST        = 0                ' Search from beginning of table.
  106. PDX_SEARCHNEXT        = 1                ' Search from next record in table.
  107. PDX_CLOSESTRECORD        = 2                ' (modifier) goto 'nearest' record if  no match found (ordered fields only).
  108.  
  109. '  Lock types used in PXNetFileLock, PXNetFileUnlock, PXNetTblLock, PXNetTblUnlock.
  110. PDX_FL                = 1                ' Full lock, no concurrency.
  111. PDX_WL                = 2                ' Write lock.
  112. PDX_PWL                = 3                ' Prevent write lock.
  113. PDX_PFL                = 4                ' Prevent full lock, full concurrency.
  114.  
  115. ' Declarations of sort order tables, used in PXSetDefaults.
  116. PDX_SortOrderAscii            = "a"                ' ASCII sort order.
  117. PDX_SortOrderIntl            = "i"                ' International sort order.
  118. PDX_SortOrderNorDan        = "n"                ' Norwegian/Danish sort order.
  119. PDX_SortOrderSwedFin        = "s"                ' Swedish/Finnish sort order.
  120.  
  121. ' Macros for checking blank values.
  122. PDX_BLANKDATE            = 2147483648        '0x80000000L
  123. PDX_BLANKLONG            = 2147483648        '0x80000000L
  124. PDX_BLANKSHORT        = 32768            '0x8000
  125.  
  126. FUNC PXISBLANKALPHA (x)
  127.     RETURN(LEN(x) = 0)
  128. END FUNC
  129.  
  130. FUNC PXISBLANKSHORT(x)
  131.     RETURN(x = PDX_BLANKSORT)
  132. END FUNC
  133.  
  134. FUNC PXISBLANKLONG(x)
  135.     RETURN(x = PDX_BLANKLONG)
  136. END FUNC
  137.  
  138. FUNC PXISBLANKDATE(x)
  139.     RETURN(x = PDX_BLANKDATE)
  140. END FUNC
  141.  
  142. ' Successful Engine function operation returns.
  143.  
  144. PDX_PXSUCCESS            = 0  
  145.  
  146. ' ENGINE ERROR CODES:
  147.  
  148. ' Initialization errors:
  149. PDX_PXERR_NOTINITERR    = 78                ' Engine not initialized.
  150. PDX_PXERR_ALREADYINIT    = 82                '  Engine already initialized.
  151. PDX_PXERR_NOTLOGGEDIN    = 98                '  Could not login on network (to PARADOX.NET).
  152. PDX_PXERR_NONETINIT    = 107                '  Engine not initialized  with PXNetInit.
  153. PDX_PXERR_NETMULTIPLE    = 15                '  Multiple PARADOX.NET files.
  154. PDX_PXERR_CANTSHAREPDOXNET    = 134            '  Can't lock PARADOX.NET -- is  SHARE.EXE loaded?
  155. PDX_PXERR_WINDOWSREALMODE    = 135            '  Can't run Engine in Windows  real mode.
  156.  
  157. ' Hardware related errors:
  158. PDX_PXERR_DRIVENOTREAD    = 1                ' Drive not ready.
  159. PDX_PXERR_DISKWRITEPRO    = 124                ' Disk is write protected.
  160. PDX_PXERR_GENERALFAIL    = 126                ' General hardware error.
  161.  
  162. ' Directory reg error codes:
  163. PDX_PXERR_DIRNOTFOUND    = 2                ' Directory not found.
  164. PDX_PXERR_DIRBUSY        = 10                ' Sharing violation
  165. PDX_PXERR_DIRLOCKED    = 11                ' Sharing violation
  166. PDX_PXERR_DIRNOACCESS    = 12                ' No access to directory
  167. PDX_PXERR_DIRNOTPRIVATE    = 14                ' Single user, but directory is shared.
  168.  
  169. ' File oriented errors:
  170. PDX_PXERR_FILEBUSY        = 3                ' File is busy.
  171. PDX_PXERR_FILELOCKED    = 4                ' File is locked.
  172. PDX_PXERR_FILENOTFOUND    = 5                ' Could not find file.
  173.  
  174. ' Table oriented errors:
  175. PDX_PXERR_TABLEBUSY    = 118                ' Table is busy.
  176. PDX_PXERR_TABLELOCKED    = 119                ' Table is locked.
  177. PDX_PXERR_TABLENOTFOU    = 120                ' Table was not found.
  178. PDX_PXERR_TABLEOPEN    = 83                ' Unable to perform operation on open table.
  179. PDX_PXERR_TABLEINDEXED    = 94                ' Table is indexed.
  180. PDX_PXERR_TABLENOTIND    = 95                ' Table is not indexed.
  181. PDX_PXERR_TABLEEMPTY    = 105                ' Operation on empty table.
  182. PDX_PXERR_TABLEWRITEPR    = 22                ' Table is write protected.
  183. PDX_PXERR_TABLECORRUPT    = 6                ' Table is corrupted.
  184. PDX_PXERR_TABLEFULL    = 128                ' Table is full.
  185. PDX_PXERR_TABLESQL        = 130                ' Table is SQL replica.
  186. PDX_PXERR_INSUFRIGHTS    = 21                ' Insufficient password rights.
  187.  
  188. ' Index oriented errors:
  189. PDX_PXERR_XCORRUPTED    = 7                ' Primary index is corrupted.
  190. PDX_PXERR_XOUTOFDATE    = 8                ' Primary index is out of date.
  191. PDX_PXERR_XSORTVERSION    = 13                ' Sort for index different from table.
  192. PDX_PXERR_SXCORRUPTED    = 122                ' Secondary index is corrupted.
  193. PDX_PXERR_SXOUTOFDATE    = 96                ' Secondary index is out of date.
  194. PDX_PXERR_SXNOTFOUND    = 121                ' Secondary index was not found.
  195. PDX_PXERR_SXOPEN        = 123                ' Secondary index is already open.
  196. PDX_PXERR_SXCANTUPDATE    = 136                ' Can't update Heap open on Secondary.
  197. PDX_PXERR_RECTOOBIG    = 125                ' Record too big for index.
  198.  
  199. ' Record oriented errors:
  200. PDX_PXERR_RECDELETED    = 50                ' Another user deleted record.
  201. PDX_PXERR_RECLOCKED    = 9                ' Record is locked.
  202. PDX_PXERR_RECNOTFOUND    = 89                ' Record was not found.
  203. PDX_PXERR_KEYVIOL        = 97                ' Key violation.
  204. PDX_PXERR_ENDOFTABLE    = 101                ' End of table.
  205. PDX_PXERR_STARTOFTABLE    = 102                ' Start of table.
  206.  
  207. ' Errors specific for Windows Engine DLL:
  208. PDX_PXERR_TOOMANYCLIEN    = 131
  209. PDX_PXERR_EXCEEDSCONF    = 132
  210. PDX_PXERR_CANTREMAPFIL    = 133
  211.  
  212. ' Resource errors:
  213. PDX_PXERR_OUTOFMEM    = 40                ' Not enough memory to complete operation.
  214. PDX_PXERR_OUTOFDISK    = 41                ' Not enough disk space to complete operation.
  215. PDX_PXERR_OUTOFSTACK    = 127                ' Not enough stack space to  complete operation.
  216. PDX_PXERR_OUTOFSWAPBU    = 129                ' Not enough swap buffer space to complete operation.
  217. PDX_PXERR_OUTOFFILEHDL    = 70                ' No more file handles available.
  218. PDX_PXERR_OUTOFTABLEH    = 72                ' No more table handles available.
  219. PDX_PXERR_OUTOFRECHDL    = 103                ' No more record handles available.
  220. PDX_PXERR_OUTOFLOCKHDL    = 111                ' Too many locks on table.
  221. PDX_PXERR_NOMORETMPN    = 86                ' No more temporary names available.
  222. PDX_PXERR_TOOMANYPASS    = 115                ' Too many passwords specified.
  223.  
  224. ' Invalid parameters to functions:
  225. PDX_PXERR_TYPEMISMATCH    = 30                ' Data type mismatch.
  226. PDX_PXERR_OUTOFRANGE    = 31                ' Argument out of range.
  227. PDX_PXERR_INVPARAMETER    = 33                ' Invalid argument.
  228. PDX_PXERR_INVDATE        = 73                ' Invalid date given.
  229. PDX_PXERR_INVFIELDHAND    = 75                ' Invalid field handle.
  230. PDX_PXERR_INVRECHANDLE    = 104                ' Invalid record handle.
  231. PDX_PXERR_INVTABLEHAND    = 76                ' Invalid table handle.
  232. PDX_PXERR_INVLOCKHAND    = 110                ' Invalid lock handle.
  233. PDX_PXERR_INVDIRNAME    = 114                ' Invalid directory name.
  234. PDX_PXERR_INVFILENAME    = 108                ' Invalid file name.
  235. PDX_PXERR_INVTABLENAME    = 99                ' Invalid table name.
  236. PDX_PXERR_INVFIELDNAME    = 74                ' Invalid field name.
  237. PDX_PXERR_INVLOCKCODE    = 106                ' Invalid lock code.
  238. PDX_PXERR_INVUNLOCK    = 109                ' Invalid unlock.
  239. PDX_PXERR_INVSORTORDER    = 112                ' Invalid sort order table.
  240. PDX_PXERR_INVPASSW    = 116                ' Invalid password.
  241. PDX_PXERR_INVNETTYPE    = 113                ' Invalid net type (PXNetInit).
  242. PDX_PXERR_BUFTOOSMALL    = 117                ' Buffer too small for result.
  243. PDX_PXERR_STRUCTDIFFER    = 81                ' Table structures are different.
  244. PDX_PXERR_INVENGINESTAT    = 79                ' Previous fatal error;  cannot proceed.
  245.  
  246.  
  247. '------------------------------------------------------------------------------------ Engine Routines ------------------------------------------------------------------------------------
  248.  
  249.  
  250. ' INITIALIZATION AND FINALIZATION FUNCTIONS.
  251.  
  252. ' Iinitialize Engine connection.
  253. EXTERNAL "PXEngWin.DLL" FUNC PXWinInit (POINTER clientName, INTEGER ShareMode) AS INTEGER
  254.  
  255. ' Exit and deallocate.
  256. EXTERNAL "PXEngWin.DLL" FUNC PXExit AS INTEGER
  257.  
  258. ' Overwrites internal default values.
  259. EXTERNAL "PXEngWin.DLL" FUNC PXSetDefaults (INTEGER bufSize, INTEGER maxTables, INTEGER maxRecBufs, INTEGER maxLocks, INTEGER maxFiles, CHAR sortOrder) AS INTEGER
  260.  
  261. ' Returns current default settings.
  262. EXTERNAL "PXEngWin.DLL" FUNC PXGetDefaults (POINTER swapSize, POINTER maxTables, POINTER maxRecBufs, POINTER MaxLocks, POINTER maxFiles, POINTER sortTable) AS INTEGER
  263.  
  264.  
  265. ' UTILITY FUNCTIONS.
  266.  
  267. EXTERNAL "PXEngWin.DLL" FUNC ISBLANKDOUBLE (REAL x) as INTEGER
  268. EXTERNAL "PXEngWin.DLL" PROC BLANKDOUBLE (POINTER)
  269.  
  270.  
  271. ' TABLE FUNCTIONS
  272.  
  273. ' Open table for access, returning table handle.
  274. EXTERNAL "PXEngWin.DLL" FUNC PXTblOpen (POINTER tblName, POINTER ptblHandle, INTEGER indexID, INTEGER saveEveryChange) AS INTEGER
  275.  
  276. ' Close access to table.
  277. EXTERNAL "PXEngWin.DLL" FUNC PXTblClose (WORD tblHandle) AS INTEGER
  278.  
  279. ' Create empty table.
  280. FUNC PXTblCreate(tName, nFlds, flds, typ)
  281.     EXTERNAL "PDoxDLL" FUNC PDXTblCreate (POINTER tblName, INTEGER nFields, POINTER fields, POINTER types) AS INTEGER ALIAS 2
  282.  
  283.     RETURN(PDXTblCreate(tName, nFlds, flds, typ))
  284. END FUNC
  285.  
  286. ' Clear table for records.
  287. EXTERNAL "PXEngWin.DLL" FUNC PXTblEmpty (POINTER tblName) AS INTEGER
  288.  
  289. ' Delete table and its family.
  290. EXTERNAL "PXEngWin.DLL" FUNC PXTblDelete (POINTER tblName) as INTEGER
  291.  
  292. ' Copy table and its family.
  293. EXTERNAL "PXEngWin.DLL" FUNC  PXTblCopy (POINTER fromName, POINTER toName) AS INTEGER
  294.  
  295. ' Rrename table and its family.
  296. EXTERNAL "PXEngWin.DLL" FUNC PXTblRename (POINTER fromName, POINTER toName) AS INTEGER
  297.  
  298. ' Add records from one table to another table.
  299. EXTERNAL "PXEngWin.DLL" FUNC PXTblAdd (POINTER srcName, POINTER destName) AS INTEGER
  300.  
  301.  
  302. ' RECORD FUNCTIONS.
  303.  
  304. ' Insert record buffer in database (as last record if Heap).
  305. EXTERNAL "PXEngWin.DLL" FUNC PXRecAppend (WORD tblHandle, WORD recHandle) AS INTEGER
  306.  
  307. ' Insert record buffer in database (before current if Heap).
  308. EXTERNAL "PXEngWin.DLL" FUNC PXRecInsert (WORD tblHandle, WORD recHandle) AS INTEGER
  309.  
  310. ' Updates current record in database with contents of the record buffer.
  311. EXTERNAL "PXEngWin.DLL" FUNC PXRecUpdate (WORD tblHandle, WORD recHandle) AS INTEGER
  312.  
  313. ' Delete current record in table.
  314. EXTERNAL "PXEngWin.DLL" FUNC PXRecDelete (WORD tblHandle) AS INTEGER
  315.  
  316. ' Creates a record buffer for a table.
  317. EXTERNAL "PXEngWin.DLL" FUNC PXRecBufOpen (WORD tblHandle, POINTER precHandle) AS INTEGER
  318.  
  319. ' Deletes a record buffer for a table.
  320. EXTERNAL "PXEngWin.DLL" FUNC PXRecBufClose (WORD recHandle) AS INTEGER
  321.  
  322. ' Clears the record buffer (to blanks).
  323. EXTERNAL "PXEngWin.DLL" FUNC PXRecBufEmpty (WORD recHandle) AS INTEGER
  324.  
  325. ' Copy record from a record buffer to another (compatible) record buffer.
  326. EXTERNAL "PXEngWin.DLL" FUNC PXRecBufCopy (WORD fromHandle, WORD toHandle) AS INTEGER
  327.  
  328. ' Gets the current record from the database into the record buffer.
  329. EXTERNAL "PXEngWin.DLL" FUNC PXRecGet (WORD tblHandle, WORD recHandle) AS INTEGER
  330.  
  331.  
  332. ' FIELD FUNCTIONS.
  333.  
  334. ' Put short value into N/$/S field in record buffer.
  335. EXTERNAL "PXEngWin.DLL" FUNC PXPutShort (WORD recHandle, WORD fldHandle, INTEGER value) AS INTEGER
  336.  
  337. ' Put double value into N/$/S field in record buffer.
  338. EXTERNAL "PXEngWin.DLL" FUNC PXPutDoub (WORD recHandle, WORD fldHandle, REAL value) AS INTEGER
  339.  
  340. ' Put long value into N/$/S field in record buffer.
  341. EXTERNAL "PXEngWin.DLL" FUNC PXPutLong (WORD recHandle, WORD fldHandle, LONG value) AS INTEGER
  342.  
  343. ' Put string into Alpha field in record buffer.
  344. EXTERNAL "PXEngWin.DLL" FUNC PXPutAlpha (WORD recHandle, WORD fldHandle, POINTER value) AS INTEGER
  345.  
  346. ' Put long value into date field (encoded value) in record buffer.
  347. EXTERNAL "PXEngWin.DLL" FUNC PXPutDate (WORD recHandle, WORD fldHandle, LONG value) AS INTEGER
  348.  
  349. ' Put blank value into field in record buffer.
  350. EXTERNAL "PXEngWin.DLL" FUNC PXPutBlank (WORD recHandle, WORD fldHandle) AS INTEGER
  351.  
  352. ' Get value from N/$/S field in record buffer, into short.
  353. EXTERNAL "PXEngWin.DLL" FUNC PXGetShort (WORD recHandle, WORD fldHandle, POINTER SValue) AS INTEGER
  354.  
  355. ' Get value from N/$/S field in record buffer, into double.
  356. EXTERNAL "PXEngWin.DLL" FUNC PXGetDoub (WORD recHandle, WORD fldHandle, POINTER DValue) AS INTEGER
  357.  
  358. ' Get value from N/$/S field in record buffer, into long.
  359. EXTERNAL "PXEngWin.DLL" FUNC PXGetLong (WORD recHandle, WORD fldHandle, POINTER LValue) AS INTEGER
  360.  
  361. ' Get string from alpha field in record buffer.
  362. EXTERNAL "PXEngWin.DLL" FUNC PXGetAlpha (WORD recHandle, WORD fldHandle, INTEGER bufSize, POINTER dest) AS INTEGER
  363.  
  364. ' Get value from date field in record buffer, into long  (encoded value).
  365. EXTERNAL "PXEngWin.DLL" FUNC PXGetDate (WORD recHandle, WORD fldHandle, POINTER Date) AS INTEGER
  366.  
  367. ' Is value in specified field in record buffer a blank?
  368. EXTERNAL "PXEngWin.DLL" FUNC PXFldBlank (WORD recHandle, WORD fldHandle, POINTER Blank) AS INTEGER
  369.  
  370. ' Move to record with specified record number.
  371. EXTERNAL "PXEngWin.DLL" FUNC PXRecGoto (WORD tblHandle, LONG recNum) AS INTEGER
  372.  
  373. ' Move to first record in table.
  374. EXTERNAL "PXEngWin.DLL" FUNC PXRecFirst (WORD tblHandle) AS INTEGER
  375.  
  376. ' Move to last record in table.
  377. EXTERNAL "PXEngWin.DLL" FUNC PXRecLast (WORD tblHandle) AS INTEGER
  378.  
  379. ' Move to next record in table.
  380. EXTERNAL "PXEngWin.DLL" FUNC PXRecNext (WORD tblHandle) AS INTEGER
  381.  
  382. ' Move to previous record in table.
  383. EXTERNAL "PXEngWin.DLL" FUNC PXRecPrev (WORD tblHandle) AS INTEGER
  384.  
  385.  
  386. ' INDEX FUNCTIONS.
  387.  
  388. ' Add a primary or secondary (maintained/nonmaintained) index .
  389. EXTERNAL "PXEngWin.DLL" FUNC PXKeyAdd (WORD tblName, INTEGER nFlds, POINTER pfldHandles, INTEGER mode) AS INTEGER
  390.  
  391. ' Delete an index for a table (primary/secondary).
  392. EXTERNAL "PXEngWin.DLL" FUNC PXKeyDrop (WORD tblName, INTEGER indexID) AS INTEGER
  393.  
  394.  
  395. ' DATE FUNCTIONS.
  396.  
  397. ' Decodes a date value stored in the Paradox format.
  398. EXTERNAL "PXEngWin.DLL" FUNC PXDateDecode (LONG date, POINTER mo, POINTER da, POINTER yr) AS INTEGER
  399.  
  400. ' Encodes a date value to a long value in Paradox format.
  401. EXTERNAL "PXEngWin.DLL" FUNC PXDateEncode (INTEGER mo, INTEGER da, INTEGER yr, POINTER pdate) AS INTEGER
  402.  
  403.  
  404. ' SEARCH FUNCTIONS.
  405.  
  406. ' Searches a table for a given (sub) key.
  407. EXTERNAL "PXEngWin.DLL" FUNC PXSrchKey (WORD tblHandle, WORD recHandle, INTEGER nFlds, INTEGER mode) AS INTEGER
  408.  
  409. EXTERNAL "PXEngWin.DLL" FUNC PXSrchFld (WORD tblHandle, WORD recHandle, WORD fldHandle, INTEGER mode) AS INTEGER
  410.  
  411.  
  412. ' PASSWORD FUNCTIONS.
  413.  
  414. ' Checks if table is encrypted.
  415. EXTERNAL "PXEngWin.DLL" FUNC PXTblProtected (WORD tblName, POINTER Protected) AS INTEGER
  416.  
  417. ' Enters a password to the Engine.
  418. EXTERNAL "PXEngWin.DLL" FUNC PXPswAdd (POINTER password) AS INTEGER
  419.  
  420. ' Deletes a password previously entered.
  421. EXTERNAL "PXEngWin.DLL" FUNC PXPswDel (POINTER password) AS INTEGER
  422.  
  423. ' Encrypt a table and make it password protected.
  424. EXTERNAL "PXEngWin.DLL" FUNC PXTblEncrypt (WORD tblName, POINTER password) AS INTEGER
  425.  
  426. ' Decrypt a table, password must already have been entered.
  427. EXTERNAL "PXEngWin.DLL" FUNC PXTblDecrypt (WORD tblName) AS INTEGER
  428.  
  429.  
  430. ' INFORMATIONAL FUNCTIONS.
  431.  
  432. ' Checks if table exists.
  433. EXTERNAL "PXEngWin.DLL" FUNC PXTblExist (POINTER tblName, POINTER Exist) AS INTEGER
  434.  
  435. ' Returns table name corresponding to a table handle.
  436. EXTERNAL "PXEngWin.DLL" FUNC PXTblName (POINTER tblName, INTEGER bufSize, POINTER tblName) AS INTEGER
  437.  
  438. ' Returns record number of current record in table.
  439. EXTERNAL "PXEngWin.DLL" FUNC PXRecNum (WORD tblHandle, POINTER precnum) AS INTEGER
  440.  
  441. ' Returns number of records in table.
  442. EXTERNAL "PXEngWin.DLL" FUNC PXTblNRecs (WORD tblHandle, POINTER pnRecs) AS INTEGER
  443.  
  444. ' Returns number of fields in a record.
  445. EXTERNAL "PXEngWin.DLL" FUNC PXRecNFlds (WORD tblHandle, POINTER nFlds) AS INTEGER
  446.  
  447. ' Return number of fields in key for table.
  448. EXTERNAL "PXEngWin.DLL" FUNC PXKeyNFlds (WORD tblHandle, POINTER nKeyFlds) AS INTEGER
  449.  
  450. ' Returns field number of a given field name in a table.
  451. EXTERNAL "PXEngWin.DLL" FUNC PXFldHandle (WORD tblHandle, POINTER fieldName, POINTER pfldHandle) AS INTEGER
  452.  
  453. ' Returns field type of a given field in a table.
  454. EXTERNAL "PXEngWin.DLL" FUNC PXFldType (WORD tblHandle, WORD fldHandle, INTEGER bufSize, POINTER fldType) AS INTEGER
  455.  
  456. ' Returns field name of a given field in a table.
  457. EXTERNAL "PXEngWin.DLL" FUNC PXFldName (WORD tblHandle, WORD fldHandle, INTEGER bufSize, POINTER fldName) AS INTEGER
  458.  
  459.  
  460. ' MISCELLANEOUS FUNCTIONS.
  461. ' Sets maximum size of tables created with PXTblCreat().
  462. EXTERNAL "PXEngWin.DLL" FUNC PXTblMaxSize (INTEGER maxSize) AS INTEGER
  463.  
  464. ' Saves all buffered changes to disk.
  465. EXTERNAL "PXEngWin.DLL" FUNC PXSave() AS INTEGER
  466.  
  467.  
  468. ' CONCURRENCY FUNCTIONS.
  469. ' Can be used only if PXWinInit() was successful.
  470.  
  471. ' Returns name of user as known on network.
  472. EXTERNAL "PXEngWin.DLL" FUNC PXNetUserName (INTEGER bufSize, POINTER userName) AS INTEGER
  473.  
  474. ' Locks a file with specified lock (general function).
  475. EXTERNAL "PXEngWin.DLL" FUNC PXNetFileLock (POINTER fileName, INTEGER lockType) AS INTEGER
  476.  
  477. ' Unlocks a file with specified lock (general function).
  478. EXTERNAL "PXEngWin.DLL" FUNC PXNetFileUnlock (POINTER fileName, INTEGER lockType) AS INTEGER
  479.  
  480. ' Locks an open table with specified lock.
  481. EXTERNAL "PXEngWin.DLL" FUNC PXNetTblLock (WORD tblHandle, INTEGER lockType) AS INTEGER
  482.  
  483. ' Unlocks an open table with specified lock.
  484. EXTERNAL "PXEngWin.DLL" FUNC PXNetTblUnlock (WORD tblHandle, INTEGER lockType) AS INTEGER
  485.  
  486. ' Locks the current record in a table.
  487. EXTERNAL "PXEngWin.DLL" FUNC PXNetRecLock (WORD tblHandle, POINTER plckHandle) AS INTEGER
  488.  
  489. ' Unlocks record associated with lock handle in the table.
  490. EXTERNAL "PXEngWin.DLL" FUNC PXNetRecUnlock (WORD tblHandle, POINTER lckHandle) AS INTEGER
  491.  
  492. ' Checks if current record in table is locked (by any user).
  493. EXTERNAL "PXEngWin.DLL" FUNC PXNetRecLocked (WORD tblHandle, POINTER Locked) AS INTEGER
  494.  
  495. ' Moves to the record in the table associated with the lock handle.
  496. EXTERNAL "PXEngWin.DLL" FUNC PXNetRecGotoLock (WORD tblHandle, POINTER lckHandle) AS INTEGER
  497.  
  498. ' Checks if table was changed by other user since last refresh.
  499. EXTERNAL "PXEngWin.DLL" FUNC PXNetTblChanged (WORD tblHandle, POINTER Changed) AS INTEGER
  500.  
  501. ' Forces a refresh of a table if it was changed by another user.
  502. EXTERNAL "PXEngWin.DLL" FUNC PXNetTblRefresh (WORD tblHandle) AS INTEGER
  503.  
  504.  
  505. ' ERROR FUNCTIONS.
  506.  
  507. ' Returns error text associated with the error number.
  508. EXTERNAL "PXEngWin.DLL" FUNC PXErrMsg (INTEGER errCode) AS STRUCTURE 255
  509.  
  510. ' Returns name of user causing a locking error.
  511. EXTERNAL "PXEngWin.DLL" FUNC PXNetErrUser (INTEGER bufSize, POINTER userName) AS INTEGER
  512.  
  513.  
  514. RUN "DB\PXEngin2"                                        ' Load in the high-level interface library.
  515.