PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 1/11 TITLE : Common issues/tips/questions for the Paradox Engine. Paradox Engine Common Issues ============================ The Paradox Engine is a library of functions that give you access to Paradox's proprietary format tables. The Library supports C and Pascal, with version 3.0 of the Engine adding the Database Framework class hierarchy. This document is a basic reference guide and answers common questions concerning the Engine. Paradox Field Types =================== A Paradox table is limited to 255 fields. The allowed field types are: Alphanumeric ( Annn ) : Ascii Characters. Where nnn is the size of the field, 255 characters or less. Number ( N ) : Stored as a signed double Currency ( $ ) : Also stored as a signed double Short Number ( S ) : Signed integer Date ( D ) : Stored as an unsigned long int, days since Jan 1, 100 BLOb Fields: Memo ( Mnnn ) Binary ( Bnnn ) Formatted ( Fnnn ) Graphics ( Gnnn ) OLE ( Onnn ) : Up to 256MB of Ascii or Binary Data. Where nnn refers to the size of the 'leader' ( the first nnn bytes of the Memo, viewable within paradox ), maximum of 240. There are five different types of Memo fields, although the engine only provides support for M and B type memo fields. The additional formats are provided for compatibility with Paradox for Windows ( i.e. allows Engine Apps. to open and access PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 2/11 TITLE : Common issues/tips/questions for the Paradox Engine. tables containing these fields ). See pg. 59 of the Users Guide for more information on specific BLOb types. The first nnn bytes of a Memo field ( up to 240 ) are stored within the table itself, regardless of the size of the memo. When the memo field is smaller than nnn, a separate memo file is not created: the entire field is stored within the table. If the Memo field is larger than nnn, the entire memo is stored in a separate file, as well as the first nnn bytes being stored in the table. Sorting Data ( Indexes ) ======================== It is possible to order data in a table in several ways. These orderings are stored as Indexes. Each table can have a maximum of 1 primary index, 255 non-composite secondary indexes, and 255 composite secondary indexes. The only limitation is that you cannot have a composite secondary index comprised of only one field when that field is already a part of a non-composite secondary index. The primary index determines the physical order of the data on disk. This primary index consists of the first N fields of the table and is always case sensitive. There are two forms of secondary indexes, non-composite secondary index and composite secondary indexes. Non-composite secondary indexes consist of only one field, while composite secondary indexes consist of up to 16 fields. Composite indexes can also be case-insensitive, while non-composite secondary indexes are always case sensitive. Composite secondary indexes are only supported by v3.0 of the engine. See pages 21-24 of the Paradox Engine User's Guide for more information on indices.. Files Used by the Paradox Engine ================================ PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 3/11 TITLE : Common issues/tips/questions for the Paradox Engine. There are a number of different files that the Engine creates as it goes about its tasks. They are: .db: This is the table which stores the information ( except for BLOB, or Memo fields ). .mb: This file contains all data from BLOB, or Memo fields. Each table will only have one .mb file which stores all memo field information. .px: This file contains the primary index information. .Xnn .Ynn: These two files contain the secondary indexes. Number 00 through ff represent non-composite secondary indexes ( the number represents the indexed field ). Numbers G0 through VF represent composite secondary indexes. .lck: This is the file used by v2.0 of the Engine to handle all locks on the given table. You will normally not see this file because it gets deleted when the engine exits. paradox.net: This is the file used by v2.0 of the Engine for directory access. This file will be created if one does not already exist. paradox.lck: Directory lock used by the engine 3.0 ( Paradox 4.0 ) to keep out Engine 2.0 Applications, and Paradox versions lower than v4.0 ( i.e. anything using Paradox 3.5 locking ). You will normally not see this file because it gets deleted when the engine exits. pdoxusrs.lck: This is the file used by v3.0 of the Engine to handle locks. You will normally not see this or any .lck file because it is deleted when the engine cleans up. See pages 29-34 of the Paradox Engine User's Guide for more information on 'Locking and Lock Files'. PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 4/11 TITLE : Common issues/tips/questions for the Paradox Engine. pdoxusrs.net: This is the file used in Paradox 4.0 style locking for user ID and use counts. Also used to coordinate locking. This file will be created if one does not already exist. Engine Initialization ===================== There are three different modes for initializing a Paradox Engine application: PXInit : Used for single-user DOS applications. PXNetInit : Can be used in single-user or multiuser DOS applications. Use PXNetInit if a Paradox engine application is running in a DOS box under windows. Share.exe must be loaded to share local tables. PXWinInit : Used in a windows application, whether single or multiuser. SHARE.EXE must always be loaded when sharing local tables under Windows. See pages 39-41 of the Paradox Engine User's Guide for more information on 'Initializing the Engine'. New Features of version 3.0 of the Engine: ========================================== 1) Multi-field secondary indexes ( Use the PXKeyMap feature ). 2) Case-insensitive indexes ( Use the PXKeyMap function ). 3) BLOb ( Binary Large Object ), or Memo fields. 4) A new, faster locking scheme. 5) The Database Framework - A class hierarchy ( C++ or Pascal ) which encapsulates the engine functionality. Some important numbers: ======================= PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 5/11 TITLE : Common issues/tips/questions for the Paradox Engine. Max Table size ( PXTblMaxSize ): 256MB Max BLOb size: 256MB Max BLOb's per table: 4GB Max record size*: Non-indexed table: 4000 bytes Indexed table: 1325 bytes Max Number of fields: 255 Max Number of secondary indexes: 255 Max Number of composite indexes: 255 Max userName size: 14 Chars * Note that the max record size includes the BLOb leader size ( which is specified when the BLOb is created ), but does not include the entire BLOb. Engine Recommendations: ======================= Make certain that the application is compiled with all warnings turned on ( Options | Compiler | Messages | Display | All) and test stack overflow enabled ( Options | Compiler | Entry/Exit code | Test Stack Overflow). You must have standard stack frame selected to use Stack Checking. NOTE: stack checking does not apply in the Windows environment. The Paradox Engine is stack intensive, so a good rule of thumb is to have at least 1k of stack available when an engine function is called ( see the file helpme!.doc to change the stack size under Borland C++). For DOS application, one can watch '_SP' [C/C++ applications] to determine the amount of stack space available. Paradox Engine functions do not display any error messages, but they do return their state. We can use this return code to do our own error checking. What follows is an example of doing this under C: #include #include // add #include for Database Framework // applications. #define PXErr(parm) PXError( __FILE__, __LINE__, \ #parm, parm ) PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 6/11 TITLE : Common issues/tips/questions for the Paradox Engine. int GlobalPXErr ; PXCODE PXError( char *module, int line, char *function, int retval ) { if ( retval == PXSUCCESS ) { GlobalPXErr = PXSUCCESS ; return retval ; } printf( "module: %s, function %s, line %d - error# %d -> %s\n", module, function, line, retval, PXErrMsg( retval ) ) ; // Change PXErrMsg to PXOopErrMsg for Database // Framework applications. GlobalPXErr = retval ; return retval ; } int main( void ) { PXErr( PXInit() ); PXErr( PXExit() ); return( 0 ); } Paradox Engine Common Questions and Answers =========================================== QUESTION: Can the Paradox Engine be Overlayed ? ANSWER: The Paradox Engine can be overlayed with Borland C++, Borland Pascal 7.0, or Turbo Pascal 6.0 and 7.0 in the DOS environment ( except for version 1.0 of the Engine ). Large applications can be fairly slow if the overlay buffer is not increased ( using the _ovrbuffer variable ) to about 0x2000. PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 7/11 TITLE : Common issues/tips/questions for the Paradox Engine. Increasing this value is described in the section on Overlays in the Borland C++ Programmers Guide. QUESTION: How do I call the Paradox Engine from Visual Basic ? ANSWER: The file VBPXENG.ZIP, available on the Borland local BBS, (408) 431-5096, as well as CompuServe ( go bdevtool - lib 3 ), describes how to call the Engine from Visual Basic. There are other files in the same section on CompuServe which have more information and examples. There is also further information available from the Microsoft Visual Basic Forum on CompuServe. Currently Borland does not provide technical support for any languages besides C/C++, and Pascal. QUESTION: Can I call the Paradox Engine from a DOS extender such as Pharlap's ? ANSWER: The Paradox Engine currently does not support protected mode, so you cannot call any engine functions from a DOS extender. The Paradox Engine does support extended memory usage when used with Borland Pascal 7.0. QUESTION: Why am I experiencing conflicts with the locking mechanism: the user name is the same for all engine applications ? QUESTION: Version 3.0 of the engine will not determine the user name from the network, while version 2.0 did. This allows the engine to be more generic. This means that all engine apps will default to the same user name, pxEngine, unless the user name is set. This may causes conflicts with locks because the locking protocol uses the user name to keep track of who owns a lock. Set the user name using the third parameter to PXNetInit() in the DOS environment, or using the pxengcfg.exe utility in the Windows environment. A PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 8/11 TITLE : Common issues/tips/questions for the Paradox Engine. routine may be written to retrieve the user name depending on the environment. QUESTION: Why am I getting odd behavior from my Paradox Engine application under Windows? ANSWER: Make certain that you are using the correct version of the Paradox Engine DLL. An older version of the DLL will be linked into your application if it is somewhere on the path before the correct version of the DLL. Do a 'DIR px*.dll /s' to find all versions of the DLL on a given drive partition. QUESTION: Why is my application larger under version 3.0 of the engine than under version 2.0 ? ANSWER: Applications created with version 3.0 or the Paradox Engine will be approximately 65k - 70k larger in C/C++, and up to 160K larger in Pascal than applications compiled under version 2.0 of the Engine. The application will be larger because support has been added for a new locking protocol, composite secondary indexes, and for BLOb, or Memo fields. QUESTION: Why is my application having problems when share is loaded? ANSWER: One possibility is that share could be running out of locks or file handles. The command line 'share /L:75 /F:4096' will increase the number of files that can be locked to 75 and the memory available for files to 4096 ( the default is 20 and 2048 ). See your DOS or WINDOWS manual for more information on share. PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 9/11 TITLE : Common issues/tips/questions for the Paradox Engine. Database Framework Common Questions and Answers =============================================== QUESTION: Which compiler can I use with the Database Framework?" ANSWER: The Database Framework works with any 3.x version of Borland C++, Borland Pascal v7.0, Turbo Pascal v6.0 and v7.0, Turbo Pascal for Windows v1.5, and Microsoft C/C++ v7.0. QUESTION: Where is the Database Framework library, DBFENG.LIB ? ANSWER: The Database Framework is shipped in source code format; hence you will need to run one of the included makefiles ( see \PXENG30\C\SOURCE directory ) to create the library ( users of TCW will have to create a project file to build the libraries ). Use the MAKEFILE.BC with Borland Compilers and the MAKEFILE.MSC for Microsoft compilers. The top portion of the makefile includes directions on how to use the makefile. Notice that the makefile will use the same filename for all versions of the Database framework, so it is suggested to copy the library before creating a different version ( the Framework has to be compiled differently for DOS and Windows, for example ). The TechFax document TI1169.zip has more information on compiling the Database Framework, especially for use in or as a DLL. QUESTION: What are Custom Records ? What does this generate utility do ? ANSWER: The generate utility will create a "Custom Record" from either a Paradox table or from a special map file, described in the HELPME.TXT file. The most important uses for Custom Records are to allow the access of fields without having to PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 10/11 TITLE : Common issues/tips/questions for the Paradox Engine. use the GetField\PutField functions, and it allows the use of "virtual" fields. "Virtual" fields can only be created from a Custom Record map file, where you can match any number of fields from the table to a variable to be used in the Custom Record. We are currently creating on a Technical Information Sheet on Custom Records, so check the BBS at (408) 431-5096, or TechFax at (800) 822-4269 for that document soon. QUESTION: Why am I having problems saving records to a table using Custom Records ? ANSWER: It is possible that the nulVec data member is not set correctly. Use the 'Custom::isNull' member function to test if the custom record is treating a given field as Null. The clear() member function sets all fields to Null, so you might want to add your own function unClear() to mark all fields to being used. QUESTION: Will the Database Framework work in a DLL ? ANSWER: Yes, get the file px30p2.zip from CompuServe or from our local BBS at ( 408 ) 431-5096 for information about the required changes to use the Database Framework in a DLL. Note that this workaround only works when using the Database Frameworks with Borland C++. Additional Information ====================== File Name: Description: ============================================================ DOSBLOB.ZIP - Using BLOb fields with the Database PRODUCT : Paradox Engine NUMBER : 1325 VERSION : 3.0 OS : All DATE : October 25, 1993 PAGE : 11/11 TITLE : Common issues/tips/questions for the Paradox Engine. Frameworks from DOS. MEMFLD.ZIP - Using BLOb fields from DOS. OWLBLOB.ZIP - Using BLOb fields with the Database Frameworks from OWL. PX30P2.ZIP - Using the Database Framework in a DLL. PXENG.ZIP - Norton Guide to the Paradox Engine. PXETIP.ZIP - Additional Tips for the Paradox Engine. Also available as Appendix A of the Paradox Engine v3.0 Users Guide. PXNG3.ZIP - Norton Guide to the Paradox Engine 3.0 ( C only ). TI1000.ZIP - Understanding the Paradox.net file. TI1001.ZIP - Further information on "Internal Errors". TI1002.ZIP - Dealing with lock file contention. TI1003.ZIP - Further information on Error #50 - "Another user deleted record". TI1004.ZIP - How to pack a Paradox database. TI1063.ZIP - Discussion of new lock types ( Found in the Paradox sections on CompuServe or the local DLBBS. TI1295.ZIP - Covers common error messages generated by the Paradox Engine and their non-obvious causes. TI1372.ZIP - Custom Records and the Database Framework TI1375.ZIP - Table Passwords and the Paradox Engine ============================================================ These files are available from our local DLBBS at ( 408 ) 431-5096, CompuServe in BDEVTOOLS, lib 3, and the TI files are available from our fax-back service at ( 800 ) 822-4269. DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.