The file PXENGINE.RLZ contains the entire low-level Paradox Engine 2.0 interface along with the error numbers and constants. Complete documentation on the Paradox Engine is available with the purchase of the engine from Borland International. By executing the line RUN "PXENGINE" in the program, you get access to the low-level interface as well as the high-level. If you prefer not to include the high-level interface, comment out the last line in PXENGINE.RLZ (' RUN "DB\PXEngin2"). The file PXENGIN2.RLZ contains a high-level interface to the Paradox Engine that was developed by Within Technologies, Inc. By executing the line RUN "PXENGIN2" in your program, you get access to the high-level interface. Note:Share should be installed prior to running the Paradox Engine. High-level overview: The purpose of the high-level interface is to eliminate, for the average Paradox programmer, the manipulation of table handles, record buffers, field buffers and detailed knowledge of Paradox field types. The maximum number of tables that can be opened at once defaults to 5. If you need to change it, refer to the manuals provided with the Paradox Engine (see PXSetDefaults). Two concepts must be understood to use the high-level interface: - current record number (CRN) and current record - working record buffer (WRB) The current record number is a position indicator for a table, and the actual record in the table at the CRN is called the current record. The working record buffer is an image of a record in a table. It may or may not contain data matching a particular record in a table. The Paradox Engine maintains a current record number (CRN) for each table opened. The CRN determines which record will be retrieved by GetRecord or changed by UpdateRecord. The CRN can be changed by GotoRecord and Search. If the file is indexed, the CRN might also change due to UpdateRecord or InsertRecord. The high-level interface function GetRecNumber returns the CRN. The high-level interface maintains a working record buffer (WRB) for each table opened. GetRecord retrieves a copy of the current record into the WRB. NewRecord blanks every field in the WRB. GetField and IsBlankField examine a single field in the WRB. PutField and BlankField change a single field in the WRB. High-level usage: First initialize the engine with the ParadoxInit call and then open an existing table with OpenTable. There are several ways to access data. To search for an existing record use the Search routine. To move to a specific record in the table use GotoRecord. Access to data is performed on a record-by-record basis. Call GetRecord to load the current record into the WRB, and use multiple GetField calls to retrieve fields of the record. You may change a field in the WRB by calling PutField or BlankField. To update the current record with the data in the current WRB use UpdateRecord. Use InsertRecord to add the current WRB as a new record. If you have multiple tables opened, use SelectTable to change the current table to another opened table or CurrentTable to return the current table ID. NOTE on low-level interface: When using the PXTblCreate routine, the PDoxDLL.EXE Dynamic Link Library (DLL) must be copied to the Windows directory (same directory as the PXEngWin.DLL). PXTblCreate has the following interface from Realizer: fieldList = {"Name", "Address", "Zip", "Age", "Salary"} typeList = {"A20", "A30", "A5", "S", "$"} error = PXTblCreate("Sample", 5, fieldList, typeList) In all of the descriptions below, 1) rsSuccess is 1 if the execution of the function was successful, 0 if the function failed 2) gsWhichField may be either a field name or a field number (faster). If you don't know the field number, you can use PXFldHandle: fldHandle = String$(2, 0) err = PXFldHandle(tableHandle, "My Field Name", fldHandle) IF NOT err THEN myFieldNumber = CVI(fldHandle) END IF Summary of the high-level functions: Engine operations: rsSuccess = ParadoxInit rsSuccess = ParadoxExit Table operations: rsSuccess = OpenTable (asFileName) rsTableID = CurrentTable SelectTable (rsTableID) rsSuccess = CloseTable Record operations: rsRecNum = GetRecNumber rsSuccess = GotoRecord (rsRecNum) rsSuccess = Search (gsWhichField, gsWhat, rsSearchHow) rsSuccess = GetRecord rsSuccess = NewRecord rsSuccess = InsertRecord rsSuccess = UpdateRecord rsSuccess = DeleteRecord Field operations: rsSuccess = GetField (gsWhichField, gsBuf) rsSuccess = PutField (gsWhichField, gsBuf) rsSuccess = BlankField (gsWhichField) rsIsBlank = IsBlankField (gsWhichField) SYNTAX rsSuccess = ParadoxInit DESCRIPTION This function initializes Paradox Engine for Windows. Once successfully called, you cannot call it a second time without first closing the environment with ParadoxExit. SYNTAX rsSuccess = ParadoxExit DESCRIPTION This function unloads the Paradox Engine DLL for this application. SYNTAX rsSuccess = OpenTable (asFileName) DESCRIPTION This function opens an existing Paradox database file (table). By default, the total number of files that can be opened at once is 5. You can change this default (1-64) with PXSetDefaults. SYNTAX rsSuccess = CloseTable DESCRIPTION This function closes the current database file (table). SYNTAX SelectTable (rsTableID) DESCRIPTION This command changes the current table to table rsTableID. All subsequent Paradox calls are directed to this table, until the next OpenTable or SelectTable. SYNTAX rsTableID = CurrentTable DESCRIPTION This function returns rsTableID of the current table. Call after OpenTable and remember the rsTableID if you plan to open multiple tables. SYNTAX rsRecNum = GetRecNumber DESCRIPTION This function returns the current record number. SYNTAX rsSuccess = GotoRecord (rsRecNum) DESCRIPTION This function makes record rsRecNum the current record. SYNTAX rsSuccess = Search (gsWhichField, gsWhat, rsSearchHow) DESCRIPTION This function finds a record that matches gsWhichField with gsWhat buffer. You can control the scope of the search by setting rsSearchHow to PDX_SEARCHFIRST, PDX_SEARCHNEXT, or PDX_SEARCHNEXT. If rsSearchHow is set to PDX_SEARCHFIRST, the search starts at the first record. In case of PDX_SEARCHNEXT, the search proceeds from the record after the current record. In both cases, the current record number is not changed if the specified target is not found. If you set rsSearchHow to PDX_CLOSESTRECORD, the search starts at the first record. To use this mode, the field must be indexed. If there is no exact match but there is a record that has a value greater than the search value, the first such record becomes the current record. If there isn't a record that has a value greater than or equal to the search value, the last record becomes the current record. SYNTAX rsSuccess = GetRecord DESCRIPTION This function retrieves the current record into the WRB. Use GetField to examine the data. SYNTAX rsSuccess = NewRecord DESCRIPTION This function clears the WRB to all blanks. SYNTAX rsSuccess = InsertRecord DESCRIPTION This function inserts the WRB into the database file (table). The position of the new record in the table depends on whether the table is indexed or not. The inserted record becomes the new current record. The WRB is not changed. SYNTAX rsSuccess = UpdateRecord DESCRIPTION This function updates the current record with the contents of the WRB. SYNTAX rsSuccess = DeleteRecord DESCRIPTION This function deletes the current record from the table (WRB is not changed). The first record after the deleted one becomes the new current record. SYNTAX rsSuccess = GetField (gsWhichField, gsBuf) DESCRIPTION This function gets a field value from the WRB. SYNTAX rsSuccess = PutField (gsWhichField, gsBuf) DESCRIPTION This function changes a field's value in the WRB. SYNTAX rsSuccess = BlankField (gsWhichField) DESCRIPTION This function blanks the field in the WRB. SYNTAX rsIsBlank = IsBlankField (gsWhichField) DESCRIPTION This function checks if the field in the WRB is blank. If it is blank, rsIsBlank = 1, otherwise, rsIsBlank = 0.